I’m new to PHP (been using Cold Fusion for 6 years now) and I am having serious trouble with the Header(“Location: blahblah”); thing… Do you know of any special settings in the php.ini file that I may be missing? I’m using PHP 4.3.6 on Windows 2000 with IIS5.0.
Page 1 (Member_Login.php):
[php]
if($HTTP_POST_VARS[‘action’]==“login”){
if($totalRows_rsLogin==0){
//$errorMessage = “Not Active”;
header(“Location: NoAccess.php?Page=Member_Login”);exit;
mysql_free_result($rsLogin);
} else {
mysql_free_result($rsLogin);
setcookie(“UserID”,$HTTP_POST_VARS[‘username’],time() + 2592000,"/");
// Expire Date: 30
// Expire Time: 12:00:00
header(“Location: members/process.php?mem=” . $HTTP_POST_VARS[‘username’] . “”);exit;
}
}
[/php]
Page 2 (Process.php):
[php]
if(!isset($HTTP_COOKIE_VARS[‘UserID’])){
header(“Location: …/NoAccess.php?Page=Process”);exit;
}
[/php]
Here are my php.ini settings:
session.save_path=C:winnttemp
sessions.use_cookies=1
session.use_only_cookies=1
session.cookie_lifetime=0
session.cookie_path=C:winnttemp
register_globals = On
Whenever I try to set a cookie, it will not set properly. I check my Cookies folder and nothing will appear. If I remove the Redirect in the Member_Login.php file, the cookie will set properly. However, if there is a redirect, the cookie is never set and the page just redirects without recognizing the cookie.
Any help would be apprecaited.
Thanks.