I created a login script and am trying to have a checkbox to have sort of a "Remember Me" sort of thing.
Here is the code:
<?php
session_start();
if(isset($remember))
{
session_set_cookie_params(604800);
}
?>
Further down the page is the form for the login
echo "<form name=\"login\" method=\"post\" action=\"user.php?a=1\">
<table width=\"200\" border=\"0\" align=\"center\" cellpadding=\"1\" cellspacing=\"0\" class=\"text\">
<tr>
<td width=\"70\"><b>Username:</b></td>
<td><input name=\"username\" type=\"text\" id=\"username\" size=\"20\"></td>
</tr>
<tr>
<td width=\"70\"><b>Password:</b></td>
<td><input name=\"password\" type=\"password\" id=\"password\" size=\"20\"></td>
</tr>
<tr>
<td width=\"70\"><b>Remember Me:</b></td>
<td><input name=\"remember\" type=\"checkbox\" id=\"remember\" value=\"rememberme\"></td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\"><input name=\"submit\" type=\"submit\" id=\"submit\" value=\"Login\"></td>
</tr>
</table>
</form>";
Now after I login using the form (checkbox unchecked), and then I close the browser... the session is supposed to be destroyed, that is how sessions work. So to test, I logged in, with the box unchecked, closed the browser, and then came back to only find I was still logged in.
I only want the session_set_cookie_params(); to execute if the checkbox is checked... where am I messing up?