Guest User

Untitled

a guest
Apr 26th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ALL);
  3. require("..\configuration.php");
  4. if(isset($_POST['name'])){
  5. $username = mysql_real_escape_string($_POST['name']);
  6. echo($username);
  7. $password = md5(mysql_real_escape_string($_POST['email']));
  8. $query = mysql_query("SELECT * FROM `admin` WHERE `username` = '$username' AND `password` = '$password'");
  9. $file = fopen("{$_SERVER['TMP']}/hi.txt", "w");
  10. fwrite($file, "hi");
  11. fclose($file);
  12. if( mysql_num_rows($query) >= 1 ) {
  13. session_start();
  14. $_SESSION['username'] == $username;
  15. $sessionid = session_id();
  16. die($_SESSION['username']);
  17. header("LOCATION: index.php?PHPSESSID=$sessionid");
  18. } else {
  19. $err = "Invalid username or password.";
  20. }
  21. }
  22.  
  23. ?>
  24.  
  25.  
  26.  
  27. Results:
  28.  
  29. arleslie
  30. Notice: Undefined index: username in C:\xampp\htdocs\login.php on line 14
  31.  
  32. Notice: Undefined index: username in C:\xampp\htdocs\login.php on line 16
Add Comment
Please, Sign In to add comment