#20141 [NEW]: Can't get setcookie to work with CGI version.
| From: | tim at brogdon dot net | Date: | Mon, 28 Oct 2002 21:15:08 +0000 |
| Subject: | #20141 [NEW]: Can't get setcookie to work with CGI version. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-23595@lists.php.net to get a copy of this message | ||
From: tim@brogdon.net
Operating system: Windows 2000
PHP version: 4.2.1
PHP Bug Type: Session related
Bug description: Can't get setcookie to work with CGI version.
I have been trying to setup cookies on a new site I'm working on. However
no matter what I try I can't create the cookie. The best I can tell this
just doesn't work with the CGI version of PHP. I am running windows 2000
server with IIS. Below is my code to create the cookie.
THANKS
<?php
$username = $_POST['username'];
$password = $_POST['password'];
include_once('homeconnect.inc');
$result = mysql_query("SELECT * from users where home_user='$username'
AND home_pass='$password'");
$num = mysql_num_rows($result); // how many rows match our query?
if ($num == 0) // if none?
{ die ("Username or password was incorrect, or you have not yet
registered. <a href='signup.php'>Click Here</a> to sign up now.");}
mysql_close($db);
setcookie ("user", $username);
header("Location: http://tim.brogdon.net/homepage/default.php");
exit;
?>
--
Edit bug report at http://bugs.php.net/?id=20141&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=20141&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=20141&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=20141&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=20141&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=20141&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=20141&r=support
Expected behavior: http://bugs.php.net/fix.php?id=20141&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=20141&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=20141&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=20141&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20141&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=20141&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=20141&r=isapi