View Full Version : Classes

07-24-2007, 06: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;

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?

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

07-24-2007, 06: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.

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

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum