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 for diafol

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'] )
{
    $username=$_POST['user'];
    $password=$_POST['passcode'];
    if (strlen($username)>0 && strlen($password)>0)
    {
        $login=$User->User_Login($username,$password);

        if($login)
        {
            if(isset($_POST['remember'])){
            setcookie("cookname", $username, time()+60*60*24*100, "/");
            setcookie("cookpass", $password, time()+60*60*24*100, "/");
            }
            $_SESSION['uid']=$login;
            header("Location:index.php");
        }
        else
        {
            $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'/>
                        </div>
                        <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>
                        </div
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.