Advertisement
Guest User

Untitled

a guest
Feb 27th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. <?php
  2. //include the database information
  3. include 'ipbdbauth.php';
  4.  
  5. $username = $_GET['u'];
  6. $password = $_GET['p'];
  7. function userLoginIpb($username, $password) { //select the password information froms elected user
  8. global $___mysqli_ston;
  9. $s = mysqli_real_escape_string($___mysqli_ston, $password);
  10. $query = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT `members_pass_salt`, `members_pass_hash` FROM `members` WHERE `name` = '$s'");
  11. $results = mysqli_fetch_assoc($query);
  12. $password = md5(md5($results['members_pass_salt']).md5($password));
  13. if($password == $results['members_pass_hash']) {
  14. return true;
  15. }
  16. else {
  17. return false;
  18. }
  19. } //check if user is logged in
  20. Usage:
  21. if(userLoginIpb($username, $password))
  22. {
  23.  
  24. $nameresult = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT * FROM members WHERE name='$username'");
  25.  
  26. //fetch tha data from the database
  27. while ($row = mysqli_fetch_array($nameresult)) {
  28. echo $row{'member_group_id'};
  29. }
  30. }
  31. else
  32. {
  33. echo 'Login Incorrect';
  34. }
  35. mysqli_close($dbhandle);
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement