[nycphp-talk] why does setcookie fail?????
Phil Powell
soazine at erols.com
Sat Sep 6 16:49:31 EDT 2003
Nope it was that... check it out:
if ($hasLoggedIn) {
$sql = 'SELECT nnet_user_registrationnumber FROM nnet_usermetadata ' .
'WHERE nnet_username = \'' . $brukernavn . '\' ' .
' AND nnet_password = \'' . $passord . '\' ';
$query = mysql_query($sql) or die('Could not perform query');
if (mysql_num_rows($query) == 0) {
$hasLoggedIn = 0;
$errorMsg .= $font . '<font color=cc0000><li>Vi kann ikke tykka
brukernavnen eller passorden '.
' inn vår db</li></font></font><p>';
}
}
//---END OF SERVER-SIDE VALIDATION
BLOCK-------------------------------------------------------------
// IF hasLoggedIn IS STILL TRUE WE FOUND THEIR LOGIN INFORMATION - CLOSE
UP, SET COOKIE AND REDIRECT
if ($hasLoggedIn && ($row = mysql_fetch_row($query))) {
setcookie('nordicnet_registration', $row[0], 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=/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;
}
Phil
----- Original Message -----
From: "Patrick Hunt" <pat at vote.com>
To: "NYPHP Talk" <talk at lists.nyphp.org>
Sent: Saturday, September 06, 2003 4:48 PM
Subject: Re: [nycphp-talk] why does setcookie fail?????
>
> you changed from $row['nnet_user_registrationnumber'] to $row[0].
>
> I'd bet that the name of column 0 in the sql resulset isn't
> 'nnet_user_registrationnumber'
>
> ----------------------------------------------
>
> On Sat, 6 Sep 2003 16:43:48 -0400, Phil Powell wrote:
>
> >Well this is how I solved it:
> >
> >if ($hasLoggedIn && ($row = mysql_fetch_row($query)) {
> > setcookie('nordicnet_registration', $row[0], 0, '/');
> > ...
> >}
> >
> >That works!! Apparently the problem was neither setcookie nor header, AND
it
> >was BOTH!
> >
> >Figure that one out, geniuses!!! ;)
> >
> >Phil
> >----- Original Message -----
> >From: "Brian Pang" <bpang at bpang.com>
> >To: "NYPHP Talk" <talk at lists.nyphp.org>
> >Sent: Saturday, September 06, 2003 4:38 PM
> >Subject: Re: [nycphp-talk] why does setcookie fail?????
> >
> >
> >> it's quite possible that $row['nnet_user_registrationnumber'] null, but
> >> my cookie was set with a value of
> >> {}
> >>
> >> which is not null, though probably not what was expected.
> >> but would indicate that the var was null/empty/undefined/false
> >>
> >> > 2. I suspect the real problem is that
> >> > $row['nnet_user_registrationnumber'] is null. That would definitely
> >> > make the browser discard the cookie.
> >>
> >> _______________________________________________
> >> 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
> >
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
More information about the talk
mailing list