Cookie Help! Very odd problem!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Damascus
Forum Newbie
Posts: 1
Joined: Fri Sep 06, 2002 11:45 pm

Cookie Help! Very odd problem!

Post by Damascus »

Ok, so I'm working on a personal discussion board script for my site:

PsyBoard

And I've setup a flood control system that allows you to post a thread or reply every ten seconds. Here is the code:

Code: Select all

if($configї'config_floodcontrol'] == 1){

  setcookie("user_lastpost", time(), time()+($configї'config_flooddelay']),"/");

}


Basically, if flood control is activated then set a cookie to expire in whatever amount of time I specify. In this case 10 seconds.

Here is the code that blocks the user from posting too soon:

Code: Select all

if((time() - $_COOKIEї'user_lastpost']) < $configї'config_flooddelay']){

	message("The administrator of this board has activated the flood-control feature. This features allows you to post at <b>{$configї'config_flooddelay']}</b> second intervals.", "javascript:history.back(-1)");

}


If the cookie value exists and is not expired then call up the message function that will tell the user why they can't post and redirect them to the previous page.

You can register at the board to try it out.

I say it's odd because on my test server here on my home network all cookies work PERFECTLY. When setup on my host ALL cookies work except for the one mentioned above.

Is there a certain condition or parameter that needs to be set so it works correctly at a different location? If so, then what?

I'm no idiot when it comes to PHP/MySQL so preach on, I encourage it!

Thank you!
Post Reply