Need help cookie
| From: | Alain ROMERO | Date: | Fri, 04 May 2001 15:05:10 +0000 |
| Subject: | Need help cookie | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-51427@lists.php.net to get a copy of this message | ||
This code works fine on Win NT/IIS with Netscape but not with IE4 :
cookie is not set ?????
<?php
include "include.php";
if (authUser($username,$userpass)) {
// do not work with IIS
//$exp = gmdate ("M d Y H:i:s", time()-3600);
//setcookie("AUTHORIZER",$username.":".md5($username.$userpass),$exp."
GMT");
$exp = gmdate("M d Y H:i:s", time()+86400)." GMT";
print "<script language='javascript'>";
print "var expdate=new Date ();";
print "expdate.setTime(expdate.getTime()+(24*60*60*1000*31));";
print
"document.cookie='MYCOOKIE='+escape('".$username.":".md5($username.$userpass)."')
+';expires=expires '+expdate.toGMTString();";
print "</script>";
}
//not header behind print
//header("Location: $HTTP_REFERER");
print "<script language='javascript'>";
print "document.location='$HTTP_REFERER';";
print "</script>";
?
$HTTP_COOKIE_VARS['MYCOOKIE'] is always empty in $HTTP_REFERER and this
only with IE 4/5
Help !!!!!!!