Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 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. if($insbnet = $conn->prepare("INSERT INTO battlenet_accounts (email, sha_pass_hash) VALUES (?, ?);")) {
  20. $insbnet->bind_param("ss", $email, $bnetpassword);
  21. $insbnet->execute();
  22.  
  23. $getid = $conn->prepare("SELECT id FROM battlenet_accounts WHERE email = ?");
  24. $getid->bind_param("s", $email);
  25. $getid->execute();
  26. $getid->bind_result($id);
  27. $getid->store_result();
  28. if($getid->num_rows > 0) {
  29. while($getid->fetch()) {
  30. $bnetacc = $id;
  31. $username = $id."#".$bnetindex;
  32. $accpassword = encryptpw($username, $_POST['pass']);
  33. }
  34. echo "1";
  35. }
  36.  
  37. if($insacc = $conn->prepare("INSERT INTO account (username, sha_pass_hash, email, reg_mail, expansion, battlenet_account, battlenet_index) VALUES (?, ?, ?, ?, ?, ?);")) {
  38. $insacc->bind_param("ssssiii", $username, $accpassword, $email, $expansion, $bnetacc, $bnetindex);
  39. $insacc->execute();
  40. }else{
  41. echo $insacc->error;
  42. }
  43. echo "registered";
  44. }else{
  45. echo $insbnet->error;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement