close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Cookied are not stored

Thread began 1/28/2010 3:14 am by jim.anderson395726 | Last modified 1/28/2010 10:40 am by Dani Chankhour | 1371 views | 1 replies |

jim.anderson395726

Cookied are not stored

Hi.

Below is a simple form

<?php
if ((((isset($_POST["rememberme"]))?$_POST["rememberme"]:"") != "")) {
setcookie("uname", "".((isset($_POST["mem_mail"]))?$_POST["mem_mail"]:"") ."", time()+(60*60*24*30), "/", "", 0);
}?>
<?php
if ((((isset($_POST["rememberme"]))?$_POST["rememberme"]:"") != "")) {
setcookie("password", "".((isset($_POST["mem_pwd"]))?$_POST["mem_pwd"]:"") ."", time()+(60*60*24*30), "/", "", 0);
}?>
<?php
if ((((isset($_POST["rememberme"]))?$_POST["rememberme"]:"") != "")) {
setcookie("remember", "1", time()+(60*60*24*30), "/", "", 0);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Login form</title>
</head>

<body>
<form id="frm_login" name="frm_login" method="post" action="logged.php">
<p>
<label for="mem_mail">Email:</label>
<input name="mem_mail" type="text" id="mem_mail" value="<?php echo((isset($_COOKIE["uname"]))?$_COOKIE["uname"]:"") ?>">
</p>
<p>
<label for="mem_pwd">Password:</label>
<input name="mem_pwd" type="text" id="mem_pwd" value="<?php echo((isset($_COOKIE["password"]))?$_COOKIE["password"]:"") ?>">
</p>
<p>
<input <?php if (!(strcmp($_COOKIE['remember'],1))) {echo "checked=\"checked\"";} ?> type="checkbox" name="rememberme" id="rememberme">
<label for="rememberme">Remember Me</label>
</p>
<p>&nbsp;</p>
<p>
<input type="submit" name="submit" id="submit" value="Submit">
</p>
</form>
</body>
</html>

Unfortunately the cookies are not stored.

Can someone tell me what is wrong please?

Thanks.

Sign in to reply to this post

Dani Chankhour

It looks like your cookies will only be set if you have the check box checked.

I would change your cookies check to:

<?php
if ((((isset($_POST["mem_mail"]))?$_POST["mem_mail"]:"") != "")) {
setcookie("uname", "".((isset($_POST["mem_mail"]))?$_POST["mem_mail"]:"") ."", time()+(60*60*24*30), "/", "", 0);
}?>
<?php
if ((((isset($_POST["mem_pwd"]))?$_POST["mem_pwd"]:"") != "")) {
setcookie("password", "".((isset($_POST["mem_pwd"]))?$_POST["mem_pwd"]:"") ."", time()+(60*60*24*30), "/", "", 0);
}?>

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...