GM Project 2012 (validate users)


/ Published in: PHP
Save to your folder(s)

A fast description of an sql cell with comparison and response.


Copy this code and paste it in your HTML
  1. <body>
  2. <center>
  3. <?php
  4.  
  5. if ($_GET['u'] == NULL)
  6. {
  7. die("Couldn't Validate");
  8. }
  9. else if($_GET['p'] == NULL)
  10. {
  11. die("Couldn't Validate");
  12. }
  13. else if($_GET['k'] == NULL)
  14. {
  15. die("Couldn't Validate");
  16. }
  17. else
  18. {
  19.  
  20. mysql_connect("localhost", "gamemer1_removed", "removed") or die('Could not connect to Serv: ' . mysql_error());
  21. mysql_select_db ('gamemer1_removed') or die('Could not connect to DB: ' . mysql_error());
  22.  
  23. $MyKey = mysql_real_escape_string($_GET['k']);
  24. $User = mysql_real_escape_string($_GET['u']);
  25. $cmd_login1 = "SELECT `name`,`members_pass_salt`,`members_pass_hash`,`member_group_id`,`member_login_key` FROM `members` WHERE `members_l_username` = '$User'";
  26. $cmd_login2 = mysql_real_escape_string( $cmd_login1 );
  27. $erg = $mysqli->query( $cmd_login2 );
  28. $zei = $erg->fetch_object();
  29.  
  30. $password = md5(md5($zei->members_pass_salt).md5($pass));
  31. if($zei->members_pass_hash == $password)
  32. {
  33. echo "valid";
  34. }
  35. }
  36.  
  37.  
  38. ?>
  39.  
  40. </center>
  41. </body>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.