Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Sponsored Reviews   Improve your ranking, submit to directories   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 10-12-2007, 06:25 AM   #1 (permalink)
Member
 
Join Date: 07-08-07
Posts: 44
iTrader: 0 / 0%
Latest Blog:
None

Kareem is just really niceKareem is just really niceKareem is just really niceKareem is just really niceKareem is just really niceKareem is just really niceKareem is just really niceKareem is just really niceKareem is just really nice
Blog comment flood problem!

I am in desperate need of your help.

I have followed a tutorial and made my own comment script for my own blog, but I get multiple comments, sometimes 4 or 5, even more, this slows down my MySQL and sometimes leads to internal server errors. How do I prevent someone or a bot from making multiple comments?
Please help as this has become a huge problem for me.
Thanks in advance!
Kareem is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 10-12-2007, 07:07 AM   #2 (permalink)
v7n Mentor
 
mikey.'s Avatar
 
Join Date: 10-12-07
Posts: 769
iTrader: 0 / 0%
Latest Blog:
None

mikey. is a highly respected web promikey. is a highly respected web promikey. is a highly respected web promikey. is a highly respected web promikey. is a highly respected web promikey. is a highly respected web promikey. is a highly respected web promikey. is a highly respected web promikey. is a highly respected web promikey. is a highly respected web promikey. is a highly respected web pro
Ok bro, there's a real simple way of doing this, that's to add a little script within your own comment script that checks the IP of the last poster, that way prevents multiple comments

first if you made the comment script, you have to make sure your comment table has an IP field if it doesn't, you will need to add it. Log in to your PHPMyAdmin and open your comments table, run this query:

Code:
ALTER TABLE table ADD ip VARCHAR(20)
You have to combine the below script with your comment script

PHP Code:
<?php
// Database connection here

$query="SELECT * FROM table where ip='$ip' and date > CURDATE() - INTERVAL 5 MINUTE ";
$resultmysql_query($query) or die ("Could not execute query : $query." mysql_error());

if (
mysql_num_rows($result) == '0') {

// Insert your comments adding query and everything else here

} else {

echo 
"You're not allowed to post so soon after your last comment.";

}
?>
That's it really, oh and change table with your actual table name and date, if your date field has another name.

Like i said ff you didn't have an ip field before, you will need to edit your comments adding query and add the IP thing. You will need to edit your comments form too, add this:

Code:
<input type="hidden" name="ip" value="<?php $visitorip = $_SERVER['REMOTE_ADDR']; echo "$visitorip"; ?>" />
Kareem, if you're still confused and shit try what you can and post some feed back here bro.
mikey. is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-12-2007, 07:47 AM   #3 (permalink)
v7n Mentor
 
Costin Trifan's Avatar
 
Join Date: 04-13-07
Location: Romania
Posts: 2,952
iTrader: 0 / 0%
Costin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web pro
Why not using a captcha?
It won't block someone to post multiple comments but will block the bots, at least...
http://www.finalwebsites.com/snippets.php?id=39
__________________
JUNE - JavaScript Framework
Costin Trifan is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-12-2007, 07:54 AM   #4 (permalink)
v7n Mentor
 
mikey.'s Avatar
 
Join Date: 10-12-07
Posts: 769
iTrader: 0 / 0%
Latest Blog:
None

mikey. is a highly respected web promikey. is a highly respected web promikey. is a highly respected web promikey. is a highly respected web promikey. is a highly respected web promikey. is a highly respected web promikey. is a highly respected web promikey. is a highly respected web promikey. is a highly respected web promikey. is a highly respected web promikey. is a highly respected web pro
His point is how to stop the same person from posting over and over again.
He can use the same script for the bots too, 2 birds with one stone i think, a solution would be not checking the IP, but only add the comment if the last one (by anyone, from any IP) was added more than X minutes ago.
mikey. is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-12-2007, 08:16 AM   #5 (permalink)
v7n Mentor
 
Costin Trifan's Avatar
 
Join Date: 04-13-07
Location: Romania
Posts: 2,952
iTrader: 0 / 0%
Costin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web pro
I see your point now, and you're right.
__________________
JUNE - JavaScript Framework
Costin Trifan is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-15-2007, 01:02 AM   #6 (permalink)
Member
 
Join Date: 07-08-07
Posts: 44
iTrader: 0 / 0%
Latest Blog:
None

Kareem is just really niceKareem is just really niceKareem is just really niceKareem is just really niceKareem is just really niceKareem is just really niceKareem is just really niceKareem is just really niceKareem is just really nice
Mike, thank you so much! I will try this later on and tell you how it went.
Kareem is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Blog comment contest javaongsan Blog Promotion 0 01-16-2008 11:48 PM
comment on my blog. mabel01 Blog Promotion 8 05-03-2007 05:25 PM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 01:15 AM.
© Copyright 2008 V7 Inc