Ho inserito nel form per il mio guestbook, uno script che deve impedire l'uso del codice html all'interno dei campi...
L'ho provato per il campo textarea, ma non funziona..
Il codice è questo:
Codice PHP:
#<?php echo($i + 1); ?> - <?php echo($this->timestamp); ?>
Nome: <?php echo($this->name); ?>
E-mail: [email="<?php echo($this->email); ?>"] <?php echo($this->email); ?>[/email]
Spazio-tempo: <?php echo($this->spaziotempo); ?>
WWW - Homepage: [url="http://<?php echo($this->homepage); ?>"] <?php echo($this->homepage); ?>[/url]
Messaggio: <?php echo($this->entry);
function removeAttributes($htmlText)
{
$stripAttrib = "'\\s(class)=\"(.*?)\"'i"; //remove classes from html tags;
$htmlText = stripslashes($htmlText);
$htmlText = preg_replace($stripAttrib, '', $htmlText);
$stripAttrib = "/(font\-size|color|font\-family|line\-height):\\s".
"(\\d+(\\x2E\\d+\\w+|\\W)|\\w+)(;|)(\\s|)/i";
//remove font-style,color,font-family,line-height from style tags in the text;
$htmlText = stripslashes($tagSource);
$htmlText = preg_replace($stripAttrib, '', $htmlText);
$htmlText = str_replace(" style=\"\"", '', $htmlText); //remove empty style tags, after the preg_replace above (style="");
return $htmlText;
}
function removeEvilTags($source)
{
return preg_replace('/<(.*?)>/ie', "'<'.removeEvilAttributes('\\1').'>'", $source);
}
?>
<hr />
Ma il server mi restituisce questo errore:
Fatal error: Cannot redeclare removeattributes() in /membri2/lv4er/guestbook/html_entry.php on line 9
ovvero function removeAttributes($htmlText)
non viene riconosciuto..
mA forse c'è anche altro che non va...
è uno script vche ho trovato bello e pronto, non conosco php... Qualcuno mi sa aiutare?
Grazie