- Forums
- PHP
- Simple Php Script To Detect If A Comments Post Is Spam Or Not
if you are getting alot of people posting html on your website, you can remove all that hmtl tags with a simple php function: this is a simple script you can use to see how the function works [996], Last Updated: Sat May 18, 2024
edwino
Thu Dec 14, 2006
1 Comments
3630 Visits
if you are getting alot of people posting html on your website, you can remove all that hmtl tags with a simple php function: this is a simple script you can use to see how the function works
CODE:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>How To Ban Deny Forbid some strings like letters or numbers characters forms</title>
<style type="text/css">
<!--
.style1 {
color: #FF0000;
font-weight: bold;
}
.style2 {color: #0000FF}
.style4 {color: #0000FF; font-weight: bold; }
.style5 {color: #33CC33}
-->
</style>
</head>
<body>
<h1 align="center">How To Limit Number of Characters Tutorial Guide by <a href="http://www.wallpaperama.com">Wallpaperama</a> </h1> <hr />
<p align="center">PHP Hosting at <a href="http://www.webune.com">Webune.com</a> </p>
<?
$forbiden="<";
if($_POST['submit'] && $_POST['letter'])
{
if(strpos($forbiden, $_POST['letter'])==$forbiden)
{
echo '<h2 class="style1">Sorry, <span class="style2">"'.$_POST['letter'].'"</span> is not allowed"</h2><hr />';
}
else
{
echo '<h2 class="style5">Congratulations! <span class="style2">"'.$_POST['letter'].'"</span> is allowed '.strpos($forbiden, $_POST['letter']).' </h2><hr />';
}
}
?>
<p><strong>This is the value of <span class="style2">$string</span>: </strong><span class="style1">"<a href="http://www.wallpaperama.com">This is a spam link</a>" </span></p>
<form name="form1" method="post" action="">
What letter do you want to search for in <span class="style4">$string</span> ?
<input name="letter" type="text" id="letter" value="">
<input type="submit" name="submit" value="<? if($_POST['submit']){ echo "Submit";} else { echo"Submit Again"; } ?>">
<br /><br /> For Example, You can search for the letter <span class="style1"><strong>W</strong></span> or the phrase <span class="style1"><strong>wallpaperama</strong></span>
</form>
<p> </p>
<p><a href="http://www.wallpaperama.com/forums"><< Go back to Turorial </a></p>
<p align="center">PHP Hosting at <a href="http://www.webune.com">Webune.com</a> </p>
</body>
</html>
you can try it, just upload it to your web server and see it in action. hope this helps
https://www.wallpaperama.com/forums/how-to-stop-html-tags-from-submitting-in-forms-deny-block-ban-forbid-submit-t607.html