I have a problem with the session not using cookies.

The code below doesn´t seem to set a cookie even though my php.ini has it
set.
If I use the header after initializing the session, nothing appears in
getsess.php.
If I click the link on the other hand, the PHPSESSID-variable is added to
the URL.

What do I do to enable the cookies?
(I know how ordinary cookies work and how to set and delete them=

<?
// -- default.php -->
if ($submit) {

 $pref_username = "tobias";
 $pref_password = "password";

 if ($pref_username == $username && $pref_password == $password) {
 session_start();

 session_register("SESSION");
 $SESSION["username"] = $username;
 $SESSION["password"] = $password;
 // header("Location: getsess.php");
 // echo "<a href=getsess.php>go</a>";
 } else {
 header("Location: $PHP_SELF?username=$username");
 }
}
?>

<form method="post" action="<? echo $PHP_SELF; ?>">
Username: <input type="text" name="username" value="<? echo $username; ?>">
<br>
Password: <input type="text" name="password">
<br>
<input type="submit" name="submit">
</form>

// -- getsess.php -->
<?
session_start();
echo $SESSION["username"];
echo $SESSION["password"];
?>

What am I missing?

Thanks
// Tobias



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to