ole90
07-19-2008, 03:28 PM
$comment = nl2br(checkinput($_POST['comment']));
I use this to try and add in the breaklines that a user does without adding the <br> codes.
But this just doesn't seem to be putting in the linebreaks :X
My checkinput function does this:
function checkinput($value) {
$value = mysql_real_escape_string($value);
$value = strip_tags($value);
$value = htmlentities($value);
//Scan for bad words. GO GO GO
//our smilie codes
$smilie_codes = "java, script, javascript";
//our smilie images
$smilie_images = "-blocked-,-blocked-,-blocked-";
//set our smilie codes into an array
$smilies = explode(", ", $smilie_codes);
//set our smilie images into an array
$images = explode(", ", $smilie_images);
$amount = count($smilies)-1; //we'll decrease it by 1, since all array's start with the number [0] and not [1], and counting of them DOES start by1, so if we want to know the last array number string, we gotta decrease it by 1
for($i=0;$i<=$amount;$i++)
{
$value = str_replace($smilies[$i],$images[$i], $value);
}
return $value;
}
any help?
I use this to try and add in the breaklines that a user does without adding the <br> codes.
But this just doesn't seem to be putting in the linebreaks :X
My checkinput function does this:
function checkinput($value) {
$value = mysql_real_escape_string($value);
$value = strip_tags($value);
$value = htmlentities($value);
//Scan for bad words. GO GO GO
//our smilie codes
$smilie_codes = "java, script, javascript";
//our smilie images
$smilie_images = "-blocked-,-blocked-,-blocked-";
//set our smilie codes into an array
$smilies = explode(", ", $smilie_codes);
//set our smilie images into an array
$images = explode(", ", $smilie_images);
$amount = count($smilies)-1; //we'll decrease it by 1, since all array's start with the number [0] and not [1], and counting of them DOES start by1, so if we want to know the last array number string, we gotta decrease it by 1
for($i=0;$i<=$amount;$i++)
{
$value = str_replace($smilies[$i],$images[$i], $value);
}
return $value;
}
any help?