Bad-Word-Filter

Discuss coding issues, and scripts related to PHP and MySQL.
User avatar
JanMolendijk
Posts: 190
Location: Holland Rotterdam

Bad-Word-Filter

I`m building a hashtag system but now recently I getting some nasty spam
How can I add simply a filter to protect it ????

Code: Select all

<?php
//if hashtag is requested
if(isset($_GET['hashtag']) && !empty($_GET['hashtag'])){
$hashtag = mysql_real_escape_string(strip_tags(trim($_GET['hashtag'])));
$query = mysql_query("SELECT * FROM message WHERE hashtag LIKE '%$hashtag%' ORDER BY id DESC");
$title = "Search Result For <span style='color:red;'>".$hashtag."</span> <a href='index.php'>clear</a>";
}else{ // if not
$query = mysql_query("SELECT * FROM message ORDER BY id DESC LIMIT 15");
$title = "All Updates";
}
?>
The results are comming into <li>'.$final_msg.'</li>

Code: Select all

<?php

echo $title;
//display the messages
if(mysql_num_rows($query) > 0){

while ($row = mysql_fetch_assoc($query)) {
$final_msg = convert_to_links($row['message']);
echo '<div id="posts">
 <ul>

 <li>'.$final_msg.'</li>
 <ul>
 </div>';
 }  
 }

 ?>

Admin
Sorry, i not understand.
What nasty spam do you refer?
Where or to what do you want to add filter?
What do you want to protect?
Do you want an Anti-spam Captcha verification code like in this tutorial:
coursesweb.net/php-mysql/create-simple-anti-spam-captcha-verification-code_t

Similar Topics