Guest SwordKing Posted December 11, 2006 Share Posted December 11, 2006 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 More sharing options...
.josh Posted December 11, 2006 Share Posted December 11, 2006 look into captcha Link to comment https://forums.phpfreaks.com/topic/30280-shoutbox-spams/#findComment-139291 Share on other sites More sharing options...
Guest SwordKing Posted December 11, 2006 Share Posted December 11, 2006 [quote author=Crayon Violent link=topic=118233.msg482949#msg482949 date=1165874777]look into captcha[/quote]What is it? I don' know what you mean Link to comment https://forums.phpfreaks.com/topic/30280-shoutbox-spams/#findComment-139296 Share on other sites More sharing options...
.josh Posted December 11, 2006 Share Posted December 11, 2006 as in, that's the google keyword you want to use. image verification. Link to comment https://forums.phpfreaks.com/topic/30280-shoutbox-spams/#findComment-139298 Share on other sites More sharing options...
fert Posted December 11, 2006 Share Posted December 11, 2006 captcha is a system of text in images used to block spiders from doing stuff such as registering on sites and such. Link to comment https://forums.phpfreaks.com/topic/30280-shoutbox-spams/#findComment-139300 Share on other sites More sharing options...
marcus Posted December 11, 2006 Share Posted December 11, 2006 Yeah, you can use captcha for the security code. And to block http:// and wwwYou can do:[code]<?php$message = $_POST['message'];$message = str_replace("http://","",$message);$message = str_replace("www","",$message);?>[/code] Link to comment https://forums.phpfreaks.com/topic/30280-shoutbox-spams/#findComment-139301 Share on other sites More sharing options...
Guest SwordKing Posted December 11, 2006 Share Posted December 11, 2006 okay. I understand that, but how to show an error? I used[code]if($action=="add" AND $cont<>"www" AND $cont<>"http://" ) {[/code]But if someone posted "http://myurl.de" it's useless. What can I use instead of <> ? Link to comment https://forums.phpfreaks.com/topic/30280-shoutbox-spams/#findComment-139313 Share on other sites More sharing options...
kenrbnsn Posted December 11, 2006 Share Posted December 11, 2006 The operator you're looking for is "!=". (not equal) You should use "&&" instead of "AND".Ken Link to comment https://forums.phpfreaks.com/topic/30280-shoutbox-spams/#findComment-139322 Share on other sites More sharing options...
.josh Posted December 11, 2006 Share Posted December 11, 2006 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 More sharing options...
Guest SwordKing Posted December 11, 2006 Share Posted December 11, 2006 [code]Parse error: parse error, unexpected '{' [/code]there stand :[code] if((!substr($cont,"http://") && (!substr($cont,"www")) { [/code]Should I post the whole code? Link to comment https://forums.phpfreaks.com/topic/30280-shoutbox-spams/#findComment-139336 Share on other sites More sharing options...
marcus Posted December 11, 2006 Share Posted December 11, 2006 [code] if(!substr($cont,"http://") && !substr($cont,"www")) { [/code] Link to comment https://forums.phpfreaks.com/topic/30280-shoutbox-spams/#findComment-139338 Share on other sites More sharing options...
.josh Posted December 11, 2006 Share Posted December 11, 2006 i forgot some )'s. sorry:[code]if((!substr($cont,"http://")) && (!substr($cont,"www"))) { [/code] Link to comment https://forums.phpfreaks.com/topic/30280-shoutbox-spams/#findComment-139341 Share on other sites More sharing options...
Guest SwordKing Posted December 11, 2006 Share Posted December 11, 2006 thank you. thats it.I will use it that way. When I have additional questions, I'll come back. cu :) Link to comment https://forums.phpfreaks.com/topic/30280-shoutbox-spams/#findComment-139344 Share on other sites More sharing options...
Guest SwordKing Posted December 27, 2006 Share Posted December 27, 2006 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 More sharing options...
conker87 Posted December 27, 2006 Share Posted December 27, 2006 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 More sharing options...
Guest SwordKing Posted December 27, 2006 Share Posted December 27, 2006 That's not the right solution.It's always [quote]Please <strong>don't</strong> Spam[/quote] once again. Link to comment https://forums.phpfreaks.com/topic/30280-shoutbox-spams/#findComment-148267 Share on other sites More sharing options...
alpine Posted December 27, 2006 Share Posted December 27, 2006 Try:[code]<?phpif ($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 More sharing options...
Guest SwordKing Posted December 27, 2006 Share Posted December 27, 2006 ahh thank you. That's it ! :) Link to comment https://forums.phpfreaks.com/topic/30280-shoutbox-spams/#findComment-148281 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.