Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
898
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.25 KB | None | 0 0
  1. <?php
  2. function adler32($data)
  3. {
  4.         $mod_adler = 65521;
  5.         $a = 1;
  6.         $b = 0;
  7.         $len = strlen($data);
  8.         for($index = 0; $index < $len; $index++)
  9.         {
  10.                 $a = ($a + ord($data[$index])) % $mod_adler;
  11.                 $b = ($b + $a) % $mod_adler;
  12.         }
  13.  
  14.         return ($b << 16) | $a;
  15. }
  16.  
  17. function game_hash_password($authname, $password)
  18. {
  19.         $authname = strtolower($authname);
  20.         $a32 = adler32($authname);
  21.         $a32hex = sprintf('%08s', dechex($a32));
  22.         $a32hex = substr($a32hex, 6, 2) . substr($a32hex, 4, 2) . substr($a32hex, 2, 2) . substr($a32hex, 0, 2);
  23.         $digest = hash('sha512', $password . $a32hex, TRUE);
  24.         return $digest;
  25. }
  26.  
  27. $authname = "test";
  28. $password = "password";
  29. $id = "1";
  30. if (isset($_POST['authname']) && isset($_POST['password']))
  31. {
  32. $authname = trim($_POST['authname']);
  33. $password = trim($_POST['password']);
  34. $id = trim($_POST['id']);
  35.  
  36. $hash = bin2hex(game_hash_password($authname, $password));
  37.  
  38. $sql1 = "INSERT INTO cohauth.dbo.user_account (account, uid, forum_id, pay_stat) VALUES ('$authname', $id, $id, 1014);";
  39. $sql2 = "INSERT INTO cohauth.dbo.user_auth (account, password, salt, hash_type) VALUES ('$authname', CONVERT(BINARY(128),'$hash'), 0, 1);";
  40. $sql3 = "INSERT INTO cohauth.dbo.user_data (uid, user_data) VALUES ($id, 0x0080C2E000D00B0C000000000CB40058);";
  41. $sql4 = "INSERT INTO cohauth.dbo.user_server_group (uid, server_group_id) VALUES ($id, 1)";
  42.  
  43. print ($sql1."<br>");
  44. print ($sql2."<br>");
  45. print ($sql3."<br>");
  46. print ($sql4."<br>");
  47. echo '<br>';
  48. }
  49.  
  50. echo '<form method="post" autocomplete="off">';
  51. echo '<span style="display: inline-block; width: 80px;">ID: </span><input name="id" value="'.$id.'"><br>';
  52. echo '<span style="display: inline-block; width: 80px;">Login: </span><input type="text" value="'.$authname.'" name="authname" maxlength=14> <small>(maximum 14 characters; only letters and numbers)</small><br>';
  53. echo '<span style="display: inline-block; width: 80px;">Password: </span><input type="text" value="'.$password.'" name="password" maxlength=16> <small>(between 8 and 16 characters)</small><br>';
  54. echo '<br>';
  55. echo '<input style="display: inline-block; width: 160px;" type="submit" value="Create SQL"></form>';
  56.  
  57. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement