Whats wrong with my cookies?
Posted
by William
on Stack Overflow
See other posts from Stack Overflow
or by William
Published on 2010-03-15T02:15:51Z
Indexed on
2010/03/15
2:19 UTC
Read the original article
Hit count: 327
For some reason This php script won't echo my cookie variable:
<?php
require 'connection.php';
require 'variables.php';
$name = $_POST['name'];
$pass = $_POST['pass'];
if(($name == $admin_name) && ($pass == $admin_pass)){
setcookie($forum_url."name",$name,time()+604800);
setcookie($forum_url."pass",$pass,time()+604800);
}
else
echo 'Failed';
?>
heres the html that gets sent to admin_login.php
<form method=post action=admin_login.php>
<div id="formdiv">
<div class="fieldtext1">Name</div>
<div class="fieldtext1">Pass</div>
<input type="text" name=name size=25 />
<input type="password" name=pass size=25 />
</div>
<input type=submit value="Submit" id="submitbutton">
</form>
here is the index, where I want the info echoed
<?php echo $_COOKIE[$forum_url."name"]; ?>
What am I doing wrong?
© Stack Overflow or respective owner