PDA

View Full Version : Clean string.



Independent
11-06-2008, 09:00 PM
function waffles2($loginstring)
{
$loginstring = mysql_escape_string($loginstring);
$loginstring = stripslashes($loginstring);
$loginstring = htmlentities($loginstring);
$loginstring = htmlspecialchars($loginstring);
$loginstring = strip_tags($loginstring);

return $loginstring;
}


Just to make sure, would that work?
as I added or die("Error"); and it displayed the error.

If anybody could, I'd be greatful..
If anyone could post a securer cleaner function.

Agnostic Bear
11-06-2008, 09:02 PM
[php]function waffles2($loginstring)
{
$loginstring = mysql_escape_string($loginstring);
$loginstring = stripslashes($loginstring);
$loginstring = htmlentities($loginstring);
$loginstring = htmlspecialchars($loginstring);
$loginstring = strip_tags($loginstring);

return $loginstring;
}
[\php]

Just to make sure, would that work?
as I added or die("Error"); and it displayed the error.

If anybody could, I'd be greatful..
If anyone could post a securer cleaner function.

this is good for cleaning sql:



if( ( function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc( ) ) || ( ini_get( 'magic_quotes_sybase' ) && ( strtolower( ini_get( 'magic_quotes_sybase' ) ) !== 'off' ) ) )
{
stripslashes( $string );
}
$string = mysql_real_escape_string( $string );
return $string;

Independent
11-06-2008, 09:03 PM
Should I nest it into the function?

Agnostic Bear
11-06-2008, 09:10 PM
Should I nest it into the function?

No that's a function in itself.

Independent
11-06-2008, 09:12 PM
No that's a function in itself.
Yeah, but can I do that if I wish..

because, I have waffles2(); all over the site in clean fucntions..

but I've nested it and it appears it's working, ty.

I owe you 2rep points.

Independent
12-06-2008, 03:27 AM
Couldn't edit the post above..

How do I stop it from displaying the slash?

Dentafrice
12-06-2008, 11:57 AM
#1 you don't need all that ****, and you need to put Dan's code into a function.

You remove slashes on display, stripslashes();

Independent
12-06-2008, 12:55 PM
#1 you don't need all that ****, and you need to put Dan's code into a function.

You remove slashes on display, stripslashes();
ty - I have already.

Want to hide these adverts? Register an account for free!