SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2005
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php cookie or server problem ?

    after I moved data to new server, my authentication script does not work, it says "thank for looging" but when it proeced, to the next pages it asks toe re-login..

    after sending a lot of time, I am not sure if its a script error or the server. the same script works great on MANY other servers but not on tihs speciic server.

    after spending almost 3 hours, I have found that if I add time() to the cookie, its not saved, but if time() is not added cookie is saved..

    thi works fine
    setcookie ("cName", "cookieone");

    but this does not work
    setcookie ("cName", "cookieone", time() + 3600);

    my code for loggin user is

    $val has different values, I just put random here to give u an idea..


    Code:
    $val = "1,ss";
    $cdomain = ".mysite.com";
    		
    if(!setcookie('user',$val,time()+ (3600*24),'/',$cdomain))
    	echo  'Please set your browser cookies ON, in order to log in.';
    	
    else {								
       echo "successfuly logged, redirecting to blah blah blah...";
    }
    can anyone tell me what could be wrong ? this script works fine on other server, but this server has PHP Version 5.2.4

    thanks for your time..
    Last edited by janu; Oct 26, 2007 at 00:53. Reason: spell


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •