Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cookie problem

Status
Not open for further replies.

KryptoS

Programmer
Feb 7, 2001
240
BE
<? include(&quot;connection&quot;);

$result = mysql_query(&quot;SELECT userid, password FROM tblUsers where inlognaam='&quot; .$_POST['inlognaam'] .&quot;'&quot;, $link);
if(mysql_num_rows($result) > 0) {
Setcookie(&quot;ID&quot;, mysql_result($result,0,'userid'),time()+3600);
Setcookie(&quot;Ingelogd&quot;,&quot;1&quot;,time()+3600);
Header(&quot;Location: gegevens.php&quot;);
}
Setcookie(&quot;ID&quot;,&quot;0&quot;,time()+3600);
Setcookie(&quot;Ingelogd&quot;,&quot;0&quot;,time()+3600);
?>

the problem is here ... when I set my cookie and I redirect to gegevens.php, the cookies are not set. Why is this? If I don't redirect everything works. How can I work around this? The One And Only KryptoS
 
Are you running PHP on IIS?

When you issue a &quot;Location:&quot; header, the server's HTTP response statuse is not 200 (success) but 302 (moved). IIS will not send cookies when the server response is 302.

Two workarounds: issue the redirect in a <META> tag in your HTML output or to issue sufficient JavaScript code to programmatically change the page. Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top