NYCPHP Meetup

NYPHP.org

[nycphp-talk] why does setcookie fail?????

Brian Pang bpang at bpang.com
Sat Sep 6 15:41:53 EDT 2003


ok, I ended up on the blue fruit of the loom page...
is that the proper page?

cookie manager (Mozilla 1.4; Linux)
shows

host: www.nordicnet.no
name: nordicnet_registration
content: {}

what are you trying to store as the content?

so, it looks like the cookie was set.

Where on the blue page are you reading back the cookie data?




> http://www.nordicnet.no go to "Logg inn" and enter this username and
> password:
> 
> ppowell100001
> 6vKYtEwM
> 
> You should see a text with link, click onto the link and then either
you'll
> go to the right URL or to logginn.php again (the WRONG URL!)
> 
> Phil
> ----- Original Message ----- 
> From: "Brian Pang" <bpang at bpang.com>
> To: "NYPHP Talk" <talk at lists.nyphp.org>
> Sent: Saturday, September 06, 2003 3:22 PM
> Subject: Re: [nycphp-talk] why does setcookie fail?????
> 
> 
> > Phil, can you send me your url so I can try it in my browser?
> >
> > I maintain my recommendation that you should quote the cookie value you
> > wish to set.
> >
> > setcookie('nordicnet_registration',
> > "$row['nnet_user_registrationnumber']", 0, '/');
> >
> >
> > > This is a multi-part message in MIME format.
> > >
> > >
> > > Fourth attempt.. it fails now in login, I check by printing
> > $_COOKIE['nordicnet_registration'] and there is no value there!  Guys,
> > what on earth do I do about this????
> > >
> > > Here is the code that sets the cookie:
> > >
> > > if ($hasLoggedIn && ($row = mysql_fetch_row($query))) {
> > >    setcookie('nordicnet_registration',
> > $row['nnet_user_registrationnumber'], 0, '/');
> > >    @mysql_free_result($query);
> > >    mysql_close($dbConn) or die('Could not close db');
> > >    $html .= $font . '<font color=000099>Takk for logging inn.  For
> > forsatte ' .
> > >             "<a
> >
href=http://$serverName/index.php?content=membersites/Palogget%20S1.php "
> .
> > >             '  target=_top>klikk her</a></font></font>';
> > >   } else if (sizeof($_POST) > 0) {
> > >    $errorMsg .= $font . '<font color=cc0000><li>Det finns en problem
> > med db</li></font></font><p>';
> > >    $hasLoggedIn = 0;
> > >   }
> > >
> > >
> > > Because the PHP script is in a frame, instead of using header() I
> > print out some text with a link <a href=mylink.php target=_top> for the
> > user to click and to go to another page.  By then the cookie should be
> > registered, yet it's not there!
> > >
> > > I'm at a complete loss.
> > >
> > > Phil
> > >
> >
> >
> >
> > _______________________________________________
> > talk mailing list
> > talk at lists.nyphp.org
> > http://lists.nyphp.org/mailman/listinfo/talk
> 
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> 






More information about the talk mailing list