Re: [PHP] Setting Cookies
Please explain what is "messed up".
Also, I guess it's messed up, because you aren't setting any cookies. :eh:
Re: [PHP] Setting Cookies
Please explain where do you set the cookie as i don't see it, that's the first part, second even if the cookie is set are you sure that's a long term one, no just for one session ? As for is the cookie set on same page or another ?
Re: [PHP] Setting Cookies
Ok, i got my agreement page. I want an agree and disagree button at the bottom, when the person clicks agree i want it to set a cookie called habblingcookie, if you click disagree it takes them to http://habbling.net/goodbye/.
On the habbling.net/smf index i want a code that checks for the "habblingcookie" and if it is there i dont want it to ask them to agree again. but if they dont have the cookie i want it to tell them to agree to it. if that makes sense?
Re: [PHP] Setting Cookies
ok for the agree button page:
PHP Code:
if(isset($_POST['submit'])) {
if(isset($_POST['agree']) && strtolower($_POST['agree']) == 'agree') {
/* or whatever else you type in that text input */
$expire = mktime(0, 0, 0, 1, 1, 2038) // expires at 1st January 2038
setCookie('varname','varvalue',$expire);
}
} else {
die('fuck ya');
}
Now for the cancel button you may use simple javascript
Code:
<input type="submit" name="cancel" value="I disagree" onClick="javascript:window.location('http://habbling.net/goodbye')" />
And that's pretty much it.
Re: [PHP] Setting Cookies
Thanks alot, but don't i need a cookie checker on the board index? to check if the person has the cookie allready?
Re: [PHP] Setting Cookies
yes you do but you did already manage how to do it ;-).
Also i suggest changing the "I disagree" button to reset button not submit, cause i'm not sure what has higher priority onClick or standart submit, so the form might get submitted anyway,
Code:
<input type="reset" name="cancel" value="I disagree" onClick="javascript:window.location('http://habbling.net/goodbye')" />
Re: [PHP] Setting Cookies
Confused me a bit there, but thankyou so much for the help. Can you accept my msn request please?