Cookies!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm trying to create a simple login script for user to the web application I'm
writing.  I previously wrote it for using PHP4 & Apache, however I've recently
had to move to IIS5, and also upgraded to PHP5.
[script]
if (isset($_POST["username"]) AND isset($_POST["password"])) {
	$res=mysql_query('SELECT username, password, agent_id FROM user where
username="'.$_POST["username"].'"');
	if (mysql_num_rows($res)==0) {
		$message="Username does not exist.";
	} elseif (mysql_num_rows($res)==1) {
		while ($user=mysql_fetch_array($res)) {
			if (strtolower($user["password"])!=strtolower($_POST["password"])) {
				$message="Incorrect Password.";
			} else {
				setcookie("username",$user["username"],time()+31449600,"/");
				setcookie("agent_ID",$user["agent_id"],time()+31449600,"/");
				setcookie("logged_in",time(),time()+60*60*12,"/");
				header("Location: http://".$_SERVER["HTTP_HOST"]."/";);
				exit;
			}
		}
	}
}
[/script]

The above works fine on Apache, but on IIS, it would seem no cookie is set. 
I've found something suggesting I change php.exe to nph-php.exe - is this true,
does it work - it seems a little drastic - is there another way around it?

Cheers as ever
Nunners

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux