...

View Full Version : Classes



ole90
07-24-2007, 07:49 PM
So heres my class:


class secure{
var $data2;

function check() {
$data2 =mysql_real_escape_string($data2);
$data2 = htmlentities($data2);
$data2 = strip_tags($data2);
}
}

Basically what i want to do, is everytime i have a variable in my page that say is inputted from the user, say $message = ($_POST['mesage']);, then i want this to take the data and check it for all of the above.


$username = ($_POST['username']);
$check = new secure;
$check->data2 = $username;
$check->check();
echo"$username<br>";

But the problem is this doesn't seem to be working.

I typed in my username as <b>username</b> and it still comes up bold when it clearly should remove the bold statements.

Any help?

Mwnciau
07-24-2007, 07:52 PM
Replace
$data2 =mysql_real_escape_string($data2);
with
$data2 =mysql_real_escape_string($this->data2);

wordnerd
07-24-2007, 07:53 PM
if you use htmlentities() first, you're replacing "<b>" and "</b>" with the html entity string &amp;lt;b&amp;gt; so strip_tags() cannot parse it, I think.

ole90
07-24-2007, 07:59 PM
Thanks, got it to work!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum