Re: cookies on localhost WinXP

From: Date: Wed, 30 Jul 2003 19:14:52 +0000
Subject: Re: cookies on localhost WinXP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-157577@lists.php.net to get a copy of this message
Sorry about that. Here is my code: if(isset($coach_access[login_id])){ }elseif(($lusername) && ($lpassword)) {
        if(($lusername=="me") AND ($lpassword=="apass")){
                        $cookhost=$_SERVER["HTTP_HOST"];
                        setcookie ("coach_access[login_id]", "coach",0,"/","$cookhost");
        }else{
                $result=get_mysql_query("SELECT login_id,cont_id FROM login_coach where login='$lusername' AND login_passwd='$lpassword'");
                if($row=mysql_fetch_row($result)){
                        $cookhost=$_SERVER["HTTP_HOST"];
                        setcookie ("coach_access[login_id]", "$row[0]",0,"/","$cookhost");
                }else{
                        login_page();
                }
        }
}else{
        login_page();
} I have put in the "if(($lusername=="me") AND ($lpassword=="apass"))" statement so that I can bypass the database lookup. I have also tried to just set a cookie on a page like this: <? setcookie ("coach_access[login_id]", "coach",0,"/","localhost"); ?> That doesn't seem to work either. I am using two browsers for testing. Netscape 7.1 and MS IE 6.0.2800. Netscape 7.1 has a cookie manager that will let me see all cookies that are set and it doesn't show up in there after I try to set it. Again, the program will set the cookie if run from my RedHat/Apache/PHP/MySQL server. Thanks Steve At 02:54 PM 7/30/2003 -0400, CPT John W. Holmes wrote:
I have PHP/Apache/MySQL installed on my WinXP laptop. I do this so that I can write programs when not connected to the Internet (like when traveling). I am trying to set a cookie from the http://localhost site on my computer and it doesn't get set. Does this sound like something wrong in my php.ini file or my browsers? The program works fine on my RedHat/Apache/PHP/MySQL server. HOW are you trying to set it? What browser are you using? How do you know it's "not set"?


« previous php.general (#157577) next »