Wednesday, July 30, 2025

Password Remember using php

 


Video Link - Go to video

Full code - 

<?php
 if($_SERVER['REQUEST_METHOD']=="POST")
 {
     $email = $_POST['email'];
     $password = $_POST['password'];


                    if(isset($_POST['remember'])){

                        setcookie("email", $email, time()+(86400 * 30));
                        setcookie("password", $password, time()+(86400 * 30));

                    }
                    else{
                        setcookie("email", "", time()-3600);
                        setcookie("password", "", time()-3600);
                    }

     echo "Login Successfull";

 }
?>


<html>
    <head>
        <title>Password Remember using php</title>
    </head>
    <body>
      <form method="POST">
        Email - <input type="textbox" name="email" value="<?php echo isset($_COOKIE['email']) ? $_COOKIE['email'] : ''; ?>"><br><br>
        Password - <input type="password" name="password" value="<?php echo isset($_COOKIE['password']) ? $_COOKIE['password'] : ''; ?>"><br><br>
        <input type="checkbox" name="remember"<?php if(isset($_COOKIE['email'])) echo "checked"; ?>> Remember Me <br><br>
        <input type="submit" value="Login">
      </form>
    </body>
</html>



No comments:

Post a Comment

Custom method using prototype in JavaScript.

<!DOCTYPE html> <html> <head>   <title>Custom Prototype Method</title> </head> <body>   <h2>...