prevent users from using form again until 48hours
Moderator: General Moderators
-
Cruzado_Mainfrm
- Forum Contributor
- Posts: 346
- Joined: Sun Jun 15, 2003 11:22 pm
- Location: Miami, FL
prevent users from using form again until 48hours
how do i prevent users from sending a form if they have already sent it, and that they can after 48 hours?
thnx in advance
thnx in advance
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
You have to register somehow that they've seen it. It's probably easiest if they have to login to send the form because then you can store that information against their username. However, generally this isn't the case so you're going to have to set a cookie, it's not infallible but will work for some users. IP address is fairly unreliable for things like this because they'll change for many users because of dialup or a group of users will have the same one because they are behind the same proxy.
Mac
Mac
-
Cruzado_Mainfrm
- Forum Contributor
- Posts: 346
- Joined: Sun Jun 15, 2003 11:22 pm
- Location: Miami, FL
then you should read
Sticky: Before Post Read: Warning: Cannot add header information
Sticky: Before Post Read: Sessions with a Minor in User Logins
cookies are sent as response-header. Headers can only be sent before any response-body contents (the document shown in the browser) and both topics cover this matter somewhere.
The first is more about headers-before-contents, the second also shows you how to use sessions the way you need it.
Sticky: Before Post Read: Warning: Cannot add header information
Sticky: Before Post Read: Sessions with a Minor in User Logins
cookies are sent as response-header. Headers can only be sent before any response-body contents (the document shown in the browser) and both topics cover this matter somewhere.
The first is more about headers-before-contents, the second also shows you how to use sessions the way you need it.
-
Cruzado_Mainfrm
- Forum Contributor
- Posts: 346
- Joined: Sun Jun 15, 2003 11:22 pm
- Location: Miami, FL
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
-
Cruzado_Mainfrm
- Forum Contributor
- Posts: 346
- Joined: Sun Jun 15, 2003 11:22 pm
- Location: Miami, FL
-
Cruzado_Mainfrm
- Forum Contributor
- Posts: 346
- Joined: Sun Jun 15, 2003 11:22 pm
- Location: Miami, FL
While the ini_set manual entry says it can be set at runtime, using
I'm not sure if it would make a difference. Make sure you call ini_set before you call session_start and it might work, but I'm not sure about the timing issues required.
If it doesn't work you can try reading $_COOKIE["PHPSESSID"] and compare it to session_id(). If they don't match then the session id was passed by the URL/POST and you should reject it.
Code: Select all
ini_set("session.use_cookies_only","1");If it doesn't work you can try reading $_COOKIE["PHPSESSID"] and compare it to session_id(). If they don't match then the session id was passed by the URL/POST and you should reject it.