Jump to content

Shoutbox Spams


Guest SwordKing

Recommended Posts

Guest SwordKing
Hi Community,

I just created a shoutbox. Day by day I get senseless spams in it. I think there are a few oppurtiunitys how to keep my shoutbox clear and safe.
A security code would maybe help and a blocking of 'www' or 'http://' !

How do I do that? If you have any suggestions, please le me know. thanks
Link to comment
https://forums.phpfreaks.com/topic/30280-shoutbox-spams/
Share on other sites

well AND doesn't really matter unless he's mixing operators cuz AND and && has a different order of precedence.  In this particular condition (and in most conditions) it really doesn't matter.

i think what you are really trying to do in this condition is for instance this:

[code]
if ($action == "add") {
  if((!substr($cont,"http://") && (!substr($cont,"www")) {
    // add stuff here
  } else {
    // is spam
  }
}
[/code]
Link to comment
https://forums.phpfreaks.com/topic/30280-shoutbox-spams/#findComment-139332
Share on other sites

  • 3 weeks later...
Guest SwordKing
hi I am here once again.

There is a problem with your code. Or maybe I did wrong :

[code]if ($action == "add") {
  if(!substr($cont,"http://") && !substr($cont,"www")) {
    $add="INSERT INTO shoutbox (name, content) VALUES ('$name', '$content')"; $sqlaction=mysql_query($add);
  print "entry <strong>done</strong> ...  [ <a href=\"index.php?show=news\">go on</a> ]";
  } else {
  print "Please <strong>don't</strong>Spam !";
  }
}[/code]

He is always showing "Please don't Spam". I am not able to insert an entry.

What's wrong here?

Link to comment
https://forums.phpfreaks.com/topic/30280-shoutbox-spams/#findComment-148232
Share on other sites

I THINK you might have your variables mixed up.

Is the box with the shoutbox message in called $content? If so then use the following:

[code]if ($action == "add")
{
if(!substr($content,"http://") | !substr($content,"www"))
{
$add="INSERT INTO shoutbox (name, content) VALUES ('$name', '$content')"; $sqlaction=mysql_query($add);
print "entry <strong>done</strong> ...  [ <a href=\"index.php?show=news\">go on</a> ]";
}
else
{
print "Please <strong>don't</strong> Spam !";
}
}[/code]
Link to comment
https://forums.phpfreaks.com/topic/30280-shoutbox-spams/#findComment-148259
Share on other sites

Try:
[code]
<?php

if ($action == "add") {
  if(strpos($content, "http://") === false && strpos($content, "www") === false){
  $add = "INSERT INTO shoutbox (name, content) VALUES ('$name', '$content')";
  $sqlaction = mysql_query($add);
  print "entry <strong>done</strong> ...  [ <a href=\"index.php?show=news\">go on</a> ]";
  } else {
  print "Please <strong>don't</strong>Spam !";
  }
}

?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/30280-shoutbox-spams/#findComment-148274
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.