Bad-Word-Filter
Posted: 19 Jan 2019, 11:14
I`m building a hashtag system but now recently I getting some nasty spam
How can I add simply a filter to protect it ????
The results are comming into <li>'.$final_msg.'</li>
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";
}
?>
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>';
}
}
?>