Guest User

Untitled

a guest
Oct 9th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. $salt = 'random string of chars found in config file';
  2. $password = md5($_POST['password'].$salt);
  3. $query = "SELECT * FROM `user` WHERE password = '$password';";
  4. ...
  5.  
  6. <?php
  7. if ($_POST['submit']) {
  8.  
  9. //your host detail
  10. $link = mysql_connect('localhost', 'root', 'root') or die(mysql_error());
  11.  
  12. //your dbname
  13. mysql_select_db('moodle_23') or die(mysql_error());
  14.  
  15. $salt = 'MG.b.;w>0B)3c.^:OqDd#?^h'; //change with your salt
  16. $password = md5($_POST['password'] . $salt);
  17.  
  18. $query = "SELECT * FROM mdl_user WHERE username = '{$_POST['username']}' AND password = '$password'";
  19.  
  20. $result = mysql_query($query) or die(mysql_error());
  21.  
  22. echo '<pre>';
  23.  
  24. while ($row = mysql_fetch_assoc($result)) {
  25. print_r($row);
  26. }
  27. }
  28. ?>
  29. <form action='' method="post">
  30. <p>Username = <input type="text" name ="username"/></p>
  31. <p>Password = <input type="password" name ="password"/></p>
  32. <input type="submit" value="submit" name="submit"/>
  33. </form>
  34.  
  35. //your host detail
  36. $link = mysql_connect('localhost', 'root', 'root') or die(mysql_error());
  37.  
  38. //your dbname
  39. mysql_select_db('moodle_23') or die(mysql_error());
  40.  
  41. $salt = 'MG.b.;w>0B)3c.^:OqDd#?^h'; //change with your salt
  42. $password = md5($_POST['password'] . $salt);
  43.  
  44. $query = "SELECT * FROM mdl_user WHERE username = '{$_POST['username']}' AND password = '$password'";
  45.  
  46. $result = mysql_query($query) or die(mysql_error());
  47.  
  48. echo '<pre>';
  49.  
  50. while ($row = mysql_fetch_assoc($result)) {
  51. print_r($row);
  52. }
  53. }
  54. ?>
  55. <form action='' method="post">
  56. <p>Username = <input type="text" name ="username"/></p>
  57. <p>Password = <input type="password" name ="password"/></p>
  58. <input type="submit" value="submit" name="submit"/>
  59. </form>
Add Comment
Please, Sign In to add comment