Page 1 of 1
What's wrong with this code?
Posted: Wed Jun 16, 2004 1:40 pm
by SashaSlutsker
I have been using sessions since I started programming in PHP, but now I need to use cookies. Anyway, this code is returning true. However, the cookie is not getting stored on the computer.
Code: Select all
if (!setcookie ("stay",crypt($_POST['password']),time() + 60*60*24*30*2, '.solarconflict.com', 0))
Posted: Wed Jun 16, 2004 1:46 pm
by qads
try
Code: Select all
<?php
if(!isset($_COOKIE['cookiename']))
{
setcookie('cookiename', 'value', time() + (60*60*24*30*2));
}
?>
Posted: Wed Jun 16, 2004 2:01 pm
by SashaSlutsker
Well, that's pretty much what I did. The only difference is that you checked if it was set, (I did that, but didn't post it) left out the last two parameters, and put parentheses around the numbers. Well, I tried doing that to my variables and it still did not work.
Posted: Wed Jun 16, 2004 2:33 pm
by John Cartwright
Is your browser set to enabled cookies?
Posted: Wed Jun 16, 2004 2:41 pm
by SashaSlutsker
Yes, it is.
*EDIT*
I got it to work. It was having problems with the domain part.