PDA

View Full Version : Comment Flood Protection and UTC - spam gets through but not regular comments?


phule
08-20-2008, 02:39 AM
I only recently discovered that people are unable to place comments on blog entries. It seems that the server does not have a UTC off-set (despite its physical location at UTC-5). That's fine. If the admins want it set up that way, then I just have to set pixelpost to UTC with no off-set for comments to work.

Because when I have the UTC value in pixelpost set to UTC-5, I cannot post comments. I receive the message: "Comment flood protection is enabled. You need to wait 0 seconds before posting another comment." This behavior has been noted in one other thread in the archives.

Yet, if I do set the value to UTC-5 and I do receive the error message above and I am not able to post comments as a result, how am I still receiving comment spam?

How and why is flood control blocking me and family/friends from posting when I have the UTC offset value set incorrectly, but not blocking the spammers? This makes zero sense to me.

Dennis
08-20-2008, 05:34 AM
Just for understanding how the spam flood protection works:
When a comment is posted a database call is made resulting the date and time of the last comment by the same IP address. This date and time is compared to the actual date and time. If the delay between those values is smaller than the value set in Spam Control Options (for example 30 seconds), the script dies with the spam flood message.

So it really shouldn't matter to which time zone your blog is set as long as you don't change that in between. Time in Pixelpost is always absolute GMT time (which is the same on all servers in the world, no matter in which timezone they are located), corrected by the value you have set in Admin Options.
Pixelpost never relies on your server or local time, it uses only the GMT * Timezone setting.

You mentioned that the physical location is UTC-5. I hope you are aware that physical location does not mean the server actually has its time set to UTC-5? Despite the physical location you can set the server time to almost anything, so that might throw you off.

The GMT (=UTC) which is used by Pixelpost has to be provided by the server. I don't think that servers have a connection to a world time server and update that regularily, but calculate the GMT (UTC) back from their own (set) server time. If now the server time is set to the wrong time zone, the GMT (UTC) it produces can never be correct.

Hence, a "wrong" date and time are stored. If you have been playing with the settings you might have caused a shift in time, making the problem worse. This could leave a small window in which comments can be posted.

SPAM comments are mostly automatically and I wouldn't be surprised if you see that all SPAM comments are posted in a window of a few hours. I also wouldn't be surprised you're trying to test it outside the window, hence it won't work.

So, what can you do? Well, for starters contact your hosting company. Ask them about the timezone set on the server (note: this is different then in which timezone the server is in).

phule
08-20-2008, 01:54 PM
What does "that" mean? In between what? Why can I not be able to post comments when pixelpost is configured to UTC-5 and am able to post when pixelpost is set to UTC despite the fact that I had not posted a comment from my own IP address in weeks?

With "in between" I meant changing it from one to another setting and then try to comment. Your post clearly states you used two different settings: UTC and UTC-5.

Thank you for reading what I wrote here: "It seems that the server does not have a UTC off-set (despite its physical location at UTC-5)."

"It seems" still isn't "I'm sure".

As previously stated, I have not touched these settings since I first installed pixelpost.
Your post clearly states you used two different settings: UTC and UTC-5.

I'll get back to this later in more detail.

Dennis
08-20-2008, 08:10 PM
Shoot... I shouldn't be doing this this late... Sorry I messed up on this.

phule
08-21-2008, 11:16 AM
The whole reason for the post is that, with no change, to the configuration of pixelpost, I discovered that I was not able to leave comments. I am rather surprised that this is not clear.

Only then did I try setting the time between comments value to zero. (that part was removed from my reply here). When that did not change the behavior of the spam control, I came here and read what you had already posted previously.

At that point I checked the actual time of the server, discovered the server time is not off-set from UTC and, as a test, changed the UTC offset value in pixelpost from -5 to zero.

Yet again, let me be clear. This change to the UTC offset value came AFTER testing and confirming 1) that spam control was preventing me from posting comments using the same configuration I have been running since 1.7 was released and 2) that after confirming #1, spam control with a setting of zero seconds still was preventing me from posting comments.

I did not change the UTC offset value in pixelpost until after #1 and #2.

[["It seems" still isn't "I'm sure".]]

The context clearly indicates otherwise.

Dennis
08-21-2008, 06:11 PM
Ok, then here goes the whole debugging process...

1) Please provide an URL. (so I can test)
2) Did you do a new install of version 1.71 or did you upgrade from an earlier version?
3) Are you comfortable with PHPMyAdmin? If so, have a look at your database, in particular the "pixelpost_comments" table. It should have these fields:

id
parent_id
datetime
ip
message
name
url
email
publish


Browse the content of the table. Sort on datetime, compare this with your local time.

Dennis
08-21-2008, 06:24 PM
Scratch that...

I think I have it.

Open the file functions_comments.php in the includes folder with an Ascii editor.

Search for this line (around line 44)

if ((strtotime($datetime) - $time_latest_comment) < ($cfgrow['comment_timebetween']))


Replace with:

$datetime = gmdate("Y-m-d H:i:s",time()+(3600 * $cfgrow['timezone'])) ;
if ((strtotime($datetime) - $time_latest_comment) < ($cfgrow['comment_timebetween']))


Save and upload.

Does this fix your problem?

constant
12-19-2008, 07:31 AM
Thanks, Dennis. That fixed it for me.

crossbone80
12-23-2008, 09:34 AM
hell yeah, finally it works! I was messing around for hours to get the comment function work.

@Dennis: I guess you should post this code changes to the FAQ now!