I want to put a remember me button on my website in the login page... Any good example?

When you create the login cookie, simply specify an expire time loooong into the future if the remember me checkbox is ticked.

Member Avatar


I think your Google skills are as good as ours. I would imagine that most of us would have to search unless somebody felt the urge to write something for you. As Dani says, the implementation revolves around setting a future distant expiring cookie.

Thanks. Yes i got it. I saw something online that could work. If it does i will post it here for other users...

This one should work right?

if($_POST['user'] && $_POST['passcode'] )
    if (strlen($username)>0 && strlen($password)>0)

            setcookie("cookname", $username, time()+60*60*24*100, "/");
            setcookie("cookpass", $password, time()+60*60*24*100, "/");
            $login_error="<span class='error'>Username or Password is invalid</span>";

                        <div id="label"><?php echo $lang['UsernameOrEmail'];?>:
                        <input type="text" name="user" class="input" AUTOCOMPLETE='OFF'/>
                        <input type="checkbox" name="remember" /> Remember Me<br /><br />

                        <div id="label"><?php echo $lang['password'];?>:
                            <input type="password" name="passcode" class="input" AUTOCOMPLETE='OFF'/>
                            <div ><?php echo $login_error; ?></div>