Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.