Jump to content

Forms


bigrossco

Recommended Posts

How about we do something to embarrass who ever does it, allow them to put code but it wont be functional. From the sounds of it you do have PHP, so do this.


[code]<?php
function replace_tags($string) {
$html = array("<", ">");
$text = array("&lt;", "&gt;");

return str_replace($html, $text, $string);
}
?>[/code]

Just make sure the forum runs through this before the information is actually added. It will make it so < and > show up as letters and don't turn into code. This will also help anyone asking questions about how to do something in HTML and them needing an HTML answer.

Usage:
[code]
<?php

// Example 1
$text="<HTML></HTML>";
echo replace_tags($text);
// Output : <HTML></HTML>
// As text not actual html.

// Example 2
echo replace_tags("<HTML></HTML>");
// Output : <HTML></HTML>
// As text not actual html.

?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/33198-forms/#findComment-155498
Share on other sites

you always can use regular expression to remove the script tags, or just change the script tag using php

for example
[code]
<?PHP
$text = str_replace(array("<script", "<SCRIPT", "<Script"), "<!-- ", $text);
$text = str_replace(array("</script>", "</SCRIPT>", "</Script>"), " -->", $text);
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/33198-forms/#findComment-159547
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.