Advertisement
Guest User

testscript

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