Eisenzange

Redirect on login

Mar 17th, 2013
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. <?php
  2.  
  3. //Checking if both input fields are set
  4. if (isset($_POST["username"],$_POST["password"])){
  5.     //Checking if username/password matches your defined username/password
  6.     if (trim($_POST["username"]) == "yourusername" && trim($_POST["password"]) == "yourpassword"){
  7.         header("Location:https://google.com");//Redirect to google.com
  8.         die;//Stop the script
  9.     }
  10. }
  11.  
  12. ?>
  13. <!DOCTYPE html>
  14. <html lang="en">
  15.     <head>
  16.         <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
  17.         <title>Redirect on login</title>
  18.     </head>
  19.     <body>
  20.         <form action="<?php echo $_SERVER["REQUEST_URI"]; ?>" method="post">
  21.             <label>Username: <input type="text" name="username"></label><br>
  22.             <label>Password: <input type="password" name="password"></label><br>
  23.             <input type="submit">
  24.         </form>
  25.     </body>
  26. </html>
Advertisement
Add Comment
Please, Sign In to add comment