I've been reading up on the mysql_real_escape_string on php.net and some other places & someone had recommended to me that I also use it when displaying the database info, so I got a little confused & I'll take that out of my scripts.
I was also using strip_tags() before, and I was told to take them out of my script, so now I'm really getting confused. Looks like I'll need to add that back in.
And...I was completely unaware of htmlentities() & it seems like something I'm going to need to add also.
So, just to be absolutely clear, for example, when a user enters data on any form, I should scrub all my variables as such before entering into my database:
if (issett($_POST['formname'] {
$value1 = $_POST['value1'];
$value2 = $_POST['value2'];
$value3 = $_POST['value3'];
$value1 = strip_tags($value1);
$value1 = htmlentities ($value1);
$value1 = mysql_real_escape_string($value1);
$value2 = strip_tags($value2);
$value2= htmlentities ($value2);
$value2= mysql_real_escape_string($value2);
$value3 = strip_tags($value3 );
$value3 = htmlentities ($value3 );
$value3 = mysql_real_escape_string($value3 );
}
If I'm wrong, don't beat me up too bad. Just trying to make sure that my site is at least minimally protected & that everything formats correctly once I display it on the website.
I don't want members to be able to use HTML in the forums/guestbook/forms, etc., but I do want to be able to display the return carriages if they enter information as paragraphs.