close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Remember Me not working

Thread began 4/30/2012 9:57 pm by chssagmi366905 | Last modified 5/14/2012 11:38 am by Jason Byrnes | 1160 views | 9 replies |

chssagmi366905

Remember Me not working

I've tried to get the remember me check box to work but so far it isn't storing WA cookie.

<td><label>
<input <?php if (!(strcmp(((isset($_COOKIE["rem"]))?$_COOKIE["rem"]:""),1))) {echo "checked=\"checked\"";} ?> type="checkbox" name="rem" id="rem" />
<span class="style6">Remeber Me</span></label></td>



Is there anything here that is wrong?
Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

imposible to tell from that code snippet, please send a copy of the entire page so i can see the code in context and a link where i can see the problem.

Sign in to reply to this post

chssagmi366905

The link would be "http://www.reunionbusiness.com/admin/mem_login.php". I included an attachment of the page.

Thanks

Attached Files
rememberMe.zip
Sign in to reply to this post

Jason ByrnesWebAssist

your page is missing the set cookie value behaviors to set cookies for the username and password if the remember me option is selected.

on the server behaviors panel, click the plus button and select WebAssist -> Cookies -> Set Cookie Value.

for the trigger and value, click the plus button and select the Remember me checkbox. set the name to "rem"

repeat this, but this time, for the value select the username element and set the name to "username"

repeat again, but this time, for the value select the password element and set the name to "password"

Sign in to reply to this post

chssagmi366905

I still didn't quite understand so I will show the code for others to see but I also included an attachment. Thanks


<th width="28%" height="39"><span class="style4">Username</span></th>
<td width="72%"><input name="username" type="text" value="<?php echo((isset($_COOKIE["username"]))?$_COOKIE["username"]:"") ?>" size="40" maxlength="40" /></td>
</tr>
<tr>
<th height="43"><span class="style4">Password</span></th>
<td><input name="password" type="password" value="<?php echo((isset($_COOKIE["password"]))?$_COOKIE["password"]:"") ?>" size="40" maxlength="40" id="password" /></td>
</tr>
<tr>
<th height="43">&nbsp;</th>
<td><label>
<input name="rem" type="checkbox" id="rem" value="1" <?php if (!(strcmp(((isset($_COOKIE["rem"]))?$_COOKIE["rem"]:""),1))) {echo "checked=\"checked\"";} ?> />
<span class="style6">Remeber Me</span></label></td>

Attached Files
rememberMe.zip
Sign in to reply to this post

Jason ByrnesWebAssist

the code you pasting is to use cookies that have been set.


the problem is that code to set the cookies does not exist.

you need to add the behaviors to set the cookies by following the instructions in my previous reply

Sign in to reply to this post

chssagmi366905

I have done this numerous times using your help print out for remember me. Every screen is what I have done and looks the same. Can I have a support ticket please.

Sign in to reply to this post

Jason ByrnesWebAssist

I have added the set cookie behaviors and it is not working, send a copy of the page so i can see the code, it is probably the trigger being used or the name of the cookie, i can probably spot the issue fairly quick if you send a copy of the page.

Sign in to reply to this post

chssagmi366905

I hope this is what you meant. I did delete some lines that I thought you didn't need.

<?php require_once("../WA_SecurityAssist/WA_SHA1Encryption.php"); ?>
<?php require_once('../connections/dbc.php');?>
<?php require_once( "../WA_SecurityAssist/Helper_PHP.php" ); ?>
<?php
if(isset($_POST["LogIn"])){
$WA_Auth_Parameter = array(
"connection" => $dbc,
"database" => $database_dbc,
"tableName" => "tbl_users",
"columns" => explode($WA_Auth_Separator,"username".$WA_Auth_Separator."password"),
"columnValues" => explode($WA_Auth_Separator,"".((isset($_POST["username"]))?$_POST["username"]:"") ."".$WA_Auth_Separator."".WA_SHA1Encryption(((isset($_POST["password"]))?$_POST["password"]:"")) .""),
"columnTypes" => explode($WA_Auth_Separator,"text".$WA_Auth_Separator."text"),
"sessionColumns" => explode($WA_Auth_Separator,"userID".$WA_Auth_Separator."rcode"),
"sessionNames" => explode($WA_Auth_Separator,"userID".$WA_Auth_Separator."rcode"),
"successRedirect" => "../redirect.php",
"failRedirect" => "mess_loginFailed.php",
"gotoPreviousURL" => FALSE,
"keepQueryString" => TRUE
);

WA_AuthenticateUser($WA_Auth_Parameter);
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "../redirect.php";
$MM_redirectLoginFailed = "mess_loginFailed.php";
$MM_redirecttoReferrer = true;
mysql_select_db($database_dbc, $dbc);

$LoginRS__query=sprintf("SELECT userID, password FROM tbl_users WHERE userID=%s AND password=%s",
GetSQLValueString($loginUsername, "int"), GetSQLValueString($password, "text"));

$LoginRS = mysql_query($LoginRS__query, $dbc) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";

//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;

if (isset($_SESSION['PrevUrl']) && true) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}

// start session varible
if (!isset($_SESSION)) {
session_start();
}

mysql_select_db($database_dbc, $dbc);

?>
<?php
if ((((isset($_POST["rem"]))?$_POST["rem"]:"") != "")) {
setcookie("rem", "".((isset($_POST["rem"]))?$_POST["rem"]:"") ."", time()+(60*60*24*90), "/", "", 0);
}
?>
<?php
if ((((isset($_POST["rem"]))?$_POST["rem"]:"") != "")) {
setcookie("password", "".((isset($_POST["password"]))?$_POST["password"]:"") ."", time()+(60*60*24*90), "/", "", 0);
}
?>
<?php
if ((((isset($_POST["rem"]))?$_POST["rem"]:"") != "")) {
setcookie("username", "".((isset($_POST["username"]))?$_POST["username"]:"") ."", time()+(60*60*24*90), "/", "", 0);
}?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
</head>

<body onload="document.WAATKLogInForm.username.focus()">
<div id="container">
<div id="header">
<h2 align="center"><strong>Member Login</strong></h2>
</div>
<form ACTION="<?php echo $loginFormAction; ?>" method="POST" name="WAATKLogInForm" id="WAATKLogInForm">
<table width="55%" border="0" align="center" cellpadding="5" cellspacing="0" class="WAATKDataTable">
<tr>
<th width="28%" height="39"><span class="style4">Username</span></th>
<td width="72%"><input name="username" type="text" value="<?php echo((isset($_COOKIE["username"]))?$_COOKIE["username"]:"") ?>" size="40" maxlength="40" /></td>
</tr>
<tr>
<th height="43"><span class="style4">Password</span></th>
<td><input name="password" type="password" value="<?php echo((isset($_COOKIE["password"]))?$_COOKIE["password"]:"") ?>" size="40" maxlength="40" id="password" /></td>
</tr>
<tr>
<th height="43">&nbsp;</th>
<td><label>
<input name="rem" type="checkbox" id="rem" <?php if (!(strcmp(((isset($_COOKIE["rem"]))?$_COOKIE["rem"]:""),1))) {echo "checked=\"checked\"";} ?> />
<span class="style6">Remeber Me</span></label></td>
</tr>
<tr>
<th height="43">&nbsp;</th>
<td><a href="forgot_password.php"><span class="style4"><strong>Forgot Password</strong></span></a></td>
</tr>
</table>
<p>&nbsp;</p>
<div align="center">
<input type="Submit" name="LogIn" id="LogIn" value="Log In">
</div>

</form>
<p>&nbsp;</p>
<table width="25%" border="1" align="center" cellpadding="5">
<tr>
<td><label> </label>
<div align="center">
<input name="redirect" type="button" id="redirect" onClick="MM_goToURL('plugins/parent','../redirect.php');return document.MM_returnValue" value="Homepage">
</div></td>
</tr>
</table>
</div>
</body>
</html>

Sign in to reply to this post

Jason ByrnesWebAssist

the set cookie code:

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


needs to be moved to line 1 of the page.

Sign in to reply to this post
loading

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...