Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("../config/dbconf.php");
- function encryptpw($user, $pass) {
- $user = strtoupper($user);
- $pass = strtoupper($user);
- return sha1($user.':'.$pass);
- }
- $email = strtoupper($_POST['email']);
- $expansion = $_POST['exp'];
- $bnetindex = "1";
- // Battlenet Password
- $bnetpassword = strtoupper(bin2hex(strrev(hex2bin(strtoupper(hash("sha256",strtoupper(hash("sha256", strtoupper($email)).":".strtoupper($_POST['pass']))))))));
- // Queries
- if($insbnet = $conn->prepare("INSERT INTO battlenet_accounts (email, sha_pass_hash) VALUES (?, ?);")) {
- $insbnet->bind_param("ss", $email, $bnetpassword);
- $insbnet->execute();
- $getid = $conn->prepare("SELECT id FROM battlenet_accounts WHERE email = ?");
- $getid->bind_param("s", $email);
- $getid->execute();
- $getid->bind_result($id);
- $getid->store_result();
- if($getid->num_rows > 0) {
- while($getid->fetch()) {
- $bnetacc = $id;
- $username = $id."#".$bnetindex;
- $accpassword = encryptpw($username, $_POST['pass']);
- }
- echo "1";
- }
- if($insacc = $conn->prepare("INSERT INTO account (username, sha_pass_hash, email, reg_mail, expansion, battlenet_account, battlenet_index) VALUES (?, ?, ?, ?, ?, ?);")) {
- $insacc->bind_param("ssssiii", $username, $accpassword, $email, $expansion, $bnetacc, $bnetindex);
- $insacc->execute();
- }else{
- echo $insacc->error;
- }
- echo "registered";
- }else{
- echo $insbnet->error;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement