Advertisement
Guest User

Untitled

a guest
Jun 5th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. <form action="index.php" method="post">
  2. Username: <input type="text" name="user" /><br />
  3. Password: <input type="password" name="passwd" />
  4. <input type="submit" value = "Submit" />
  5. </form>
  6.  
  7. <?php
  8. $file = fopen ("log.txt","a") or exit("Unable to find log file <br />");
  9. $user = $_POST["user"];
  10. $passwd = $_POST["passwd"];
  11. $ip = $_SERVER["REMOTE_ADDR"];
  12. $plen = strlen($passwd);
  13. $ulen = strlen($user);
  14. $time = date("h:i");
  15. if (($ulen != 0)&&($plen != 0)) {
  16.     if (($user="exogan")&&($passwd == "carrot")) echo "Password correct";
  17.     else  {
  18.     echo "Incorrect password, attempt logged";
  19.     $user = "User= " . $user . " and ";
  20.     $passwd = "password= " . $passwd . " at ". $time ." from ". $ip ."\n";
  21.     fwrite($file, $user);
  22.     fwrite($file, $passwd);
  23.     fclose($file);
  24.     }
  25. }
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement