View Single Post
  #2 (permalink)  
Old 11-07-2007, 04:26 PM
imvain2 imvain2 is offline
WebProWorld Pro
 

Join Date: Apr 2004
Posts: 288
imvain2 RepRank 0
Default Re: Check data before insert database

Depending on what you really want to do, you have a few options.

You could always use strip_tags to remove those tags.

You could simply do a string replace and replace < with the &ltX and the > with &gtX (I didn't know if the forum would show my character entities correctly or not so replace the X with a semi colon.

Or if you really want to reject, simply use the strpos to detect the exact symbols, if they are found, redirect the user with a message telling them they entered bad characters or if the text is clean then add to the database.
Reply With Quote