Advertisement
fghfghfhghfgf

Untitled

Jan 3rd, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. <?php
  2. include("../config/dbconf.php");
  3.  
  4. function encryptpw($user, $pass) {
  5. $user = strtoupper($user);
  6. $pass = strtoupper($user);
  7. return sha1($user.':'.$pass);
  8. }
  9.  
  10. $email = strtoupper($_POST['email']);
  11. $expansion = $_POST['exp'];
  12. $bnetindex = "1";
  13.  
  14.  
  15. // Battlenet Password
  16. $bnetpassword = strtoupper(bin2hex(strrev(hex2bin(strtoupper(hash("sha256",strtoupper(hash("sha256", strtoupper($email)).":".strtoupper($_POST['pass']))))))));
  17.  
  18. // Queries
  19. $query = $conn->prepare("SELECT id FROM battlenet_accounts WHERE email = ?");
  20. $query->bind_param("s", $email);
  21. $query->execute();
  22. //$query->bind_result($id);
  23. $query->store_result();
  24. if($query->num_rows > 0) {
  25. echo "1";
  26. return;
  27. } else {
  28. if($insbnet = $conn->prepare("INSERT INTO battlenet_accounts (email, sha_pass_hash) VALUES (?, ?);")) {
  29. $insbnet->bind_param("ss", $email, $bnetpassword);
  30. $insbnet->execute();
  31.  
  32. $getid = $conn->prepare("SELECT id FROM battlenet_accounts WHERE email = ?");
  33. $getid->bind_param("s", $email);
  34. $getid->execute();
  35. $getid->bind_result($id);
  36. $getid->store_result();
  37. if($getid->num_rows > 0) {
  38. while($getid->fetch()) {
  39. $bnetacc = $id;
  40. $username = $id."#".$bnetindex;
  41. $accpassword = encryptpw($username, $_POST['pass']);
  42. }
  43. }
  44.  
  45. if($insacc = $conn->prepare("INSERT INTO account (username, sha_pass_hash, email, reg_mail, expansion, battlenet_account, battlenet_index) VALUES (?, ?, ?, ?, ?, ?, ?);")) {
  46. $insacc->bind_param("ssssiii", $username, $accpassword, $email, $email, $expansion, $bnetacc, $bnetindex);
  47. $insacc->execute();
  48. }else{
  49. echo $insacc->error;
  50. }
  51. echo "registered";
  52. }else{
  53. echo $insbnet->error;
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement