Im running user input through the following function before its inputted into the database and then outputting it back into the textarea for editing:
However if I enter this onto the form:
The input is accepted.
If this is outputted onto a webpage sumwhere, then nothing is printed. However it does print onto the source (view->source).
Is there any way I can stop someone trying to enter php code?
Or is there additional checks I need to make on the input?
Thx
jd
Code:
function formatStringInput($string)
{
// Trim whitespace
$string = trim($string);
// Escape naughty characters
$string = mysql_real_escape_string($string);
// Return string
return $string;
}
function formatStringOutputOntoForm($string)
{
// Strip slashes
$string = stripslashes($string);
// Return string
return $string;
}
However if I enter this onto the form:
Code:
<?php echo $test; ?>
The input is accepted.
If this is outputted onto a webpage sumwhere, then nothing is printed. However it does print onto the source (view->source).
Is there any way I can stop someone trying to enter php code?
Or is there additional checks I need to make on the input?
Thx
jd
Last edited: