Link to home
Start Free TrialLog in
Avatar of John Account
John Account

asked on

Again, problems with a remember me option

I have this code, which I initially had problems with, then posted a question on experts and found a working solution, only that solution is no longer working for some strange reason.  I tried several different things, but those darn username and password cookies never get set... can anyone look my code over and see if there is anything wrong with that?

Julia

====================

<script language="JavaScript" src="inc/js/bot.js"></script>

<?

if (isset($_GET[remember])) {
$username = $_GET[user_name];
 setcookie("username",$username,time()+3600*24*30, '/');
$password = $_GET[password];
 setcookie("password",$password,time()+3600*24*30, '/');

}
elseif (isset($_COOKIE[username])) {
$username = $_COOKIE[username];
$password = $_COOKIE[password];

}




?>

 
<script language="JavaScript">
      var fileType = "php";
      function openChat() {
            var user_name = document.ChatForm.user_name.value;
            var password = document.ChatForm.password.value;


window.open('messengerxm.php?user_name='+user_name+'&password='+password,'','toolbars=0,menubar=0,scrollbars=0,status=0;');window.focus();      
      }



</script>
<style>
      BODY,P,TD {font-family:Verdana, Arial, Helvetica, sans-serif;font-size:10px;}
</style>
</head>




<body leftmargin="50" topmargin="0" scroll=no background="http://www.lovelinepersonals.com/images/messbg.gif" scroll="auto">


<form action= "#thanks" name="ChatForm" >
<table border="0"  >
      
<tr>
            <td><a name="login">username&nbsp;&nbsp;&nbsp;   <input type="text" name="user_name" value="<? if (isset ($username)) { echo $username; } ?>" size="10"></td>
      </tr>
      
<tr>
            <td>password&nbsp;&nbsp;&nbsp;    <input type="password" name="password" value="<? if (isset ($password)) {echo $password; } ?>" size="10"></td>


<? if (isset($username)) {
echo '';
} else { ?>

</tr><tr><td colspan="2" align="left"><input type="checkbox" name="remember">
<font size="2"><font size=1>Remember me</font></td></tr>
<? } ?>
</table>


Avatar of Lachie_xyz
Lachie_xyz

Hi There,

Try putting single quotes around all your array indexes.

ie. $_POST[username] becomes $_POST['username']

The same goes for your $_COOKIE array indexes as well.
Avatar of John Account

ASKER

nope, I already tried that... not working
ASKER CERTIFIED SOLUTION
Avatar of cool12399
cool12399

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
p.s., please award points to both your questions :) thanks!