Forum Moderators: coopster

Message Too Old, No Replies

Sanitising data for message board re links

         

denisl

11:04 am on Nov 11, 2009 (gmt 0)

10+ Year Member Top Contributors Of The Month



I'm creating a script for a simple message board and am sanitising the user inputed data with this in a function:

$data=trim($data);
$data=stripslashes($data);
$data=htmlspecialchars($data);
$data=mysql_real_escape_string($data);
$data = str_replace("&lt;", "<!-- ", $data);
$data = str_replace("&gt;", " -->", $data);
return $data;

The last two lines of the function ar designed to stop links from showing (although the link text will still show).

This appears to work fine but am I missing anything - am I creating any potential problems?

I'm not a php expert.

optik

6:35 pm on Nov 11, 2009 (gmt 0)

10+ Year Member



that should be ok but maybe look at the strip_tags function