Advertisement
Guest User

Untitled

a guest
Aug 7th, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.88 KB | None | 0 0
  1. <?php
  2.  
  3. if(!$IS_INDEX) exit;
  4.  
  5. // Check if captcha is enabled
  6. if($use_captcha['register']) {
  7. if(isset($_SESSION['captcha'])) {
  8. $real_captcha = safe($_SESSION['captcha']);
  9. } else {
  10. $real_captcha = $passed_captcha;
  11. }
  12. require_once 'captcha.php';
  13. $_SESSION['captcha'] = $passed_captcha;
  14. }
  15.  
  16. // Check if user has posted yet
  17. if (isset($_POST['action']) && htmlspecialchars($_POST['action']) == $actions[1]) {
  18. /* -------------------------------------------------------------------------- */
  19.  
  20. // Clean user INPUT to avoid SQL Injection
  21. $user = safe($_POST['account']);
  22. $email = safe($_POST['email']);
  23. $email2 = safe($_POST['email2']);
  24. $pass = safe($_POST['pass']);
  25. $pass2 = safe($_POST['pass2']);
  26. $captcha = safe($_POST['captcha']);
  27. $checkbox = safe($_POST['checkbox']);
  28.  
  29. /* -------------------------------------------------------------------------- */
  30.  
  31. // Check for errors in user input
  32. $error .= check_username($user);
  33. $error .= check_password($pass);
  34. $error .= check_email($email);
  35.  
  36. /* -------------------------------------------------------------------------- */
  37.  
  38. // If no errors occured -> proceed
  39. if(!$error) {
  40.  
  41. // Check for matches
  42. $error .= check_password_match($pass,$pass2);
  43. $error .= check_email_match($email,$email2);
  44. // If captcha is enabled check match
  45. if($use_captcha['register']) $error .= check_captcha_match($real_captcha,$captcha);
  46.  
  47. // Check if user agreed with the rules
  48. if(!$checkbox) {
  49. $error .= $txt[16];
  50. }
  51.  
  52. /* -------------------------------------------------------------------------- */
  53.  
  54. // If there are no errors so far, let's proceed
  55. // Check if username already exists
  56. if (!$error) {
  57. // Connect to MS SQL and select database
  58. mssql($mssql_host,$mssql_db,$mssql_user,$mssql_pass);
  59.  
  60. // If user exceeded maximum attempts give error
  61. $error = is_banned();
  62.  
  63. if(!$error) {
  64. // Check if account exists
  65. $query = mssql_query(sprintf(CHECK_ACCOUNT,$user));
  66.  
  67. // If there are results -> error
  68. if(mssql_num_rows($query) > 0)
  69. $error .= $txt[14];
  70.  
  71. /* -------------------------------------------------------------------------- */
  72.  
  73. // If there are no errors -> CREATE ACCOUNT
  74. if (!$error) {
  75.  
  76. $ssn1 = mt_rand(1000000,9999999);
  77. $ssn2 = mt_rand(100000,999999);
  78. $ssn = $ssn1.$ssn2;
  79.  
  80. $recovery_key = genRandomString(50);
  81.  
  82. $ref = (isset($_COOKIE['referrer']) && !empty($_COOKIE['referrer'])) ? safe($_COOKIE['referrer']) : null;
  83.  
  84. // SEND EMAIL WITH LINK
  85. mail($email,$email_title[3],sprintf(ACCOUNT_REGISTERED,$user,create_activation_link($domain,$user,$recovery_key)),mail_headers());
  86. // CREATE ACCOUNT
  87. mssql_query(sprintf(CREATE_AUTH,$user,encrypt($pass),$email,$IP,$pass,$recovery_key,$ref));
  88. mssql_query(sprintf(CREATE_ACCOUNT, $user));
  89. mssql_query(sprintf(INSERT_SSN, $ssn, $user, $email));
  90. mssql_query(sprintf(INSERT_USER_INFO, $user, $ssn));
  91.  
  92. if(isset($_COOKIE['referrer'])) setcookie("referrer","", time()-3600);
  93. unset($_SESSION['captcha']);
  94.  
  95. $msg = $txt[21];
  96. }
  97. add_apm();
  98. }
  99. }
  100. }
  101. }
  102.  
  103. $array[0]['id'] = "account";
  104. $array[0]['label'] = $lang[2];
  105. $array[0]['value'] = $user;
  106.  
  107. $array[1]['id'] = "pass";
  108. $array[1]['label'] = $lang[1];
  109.  
  110. $array[2]['id'] = "pass2";
  111. $array[2]['label'] = $lang[3];
  112.  
  113. $array[3]['id'] = "email";
  114. $array[3]['label'] = $lang[4];
  115. $array[3]['value'] = $email;
  116.  
  117. $array[4]['id'] = "email2";
  118. $array[4]['label'] = $lang[5];
  119. $array[4]['value'] = $email2;
  120.  
  121. display_header($action,$language,$header_lang);
  122.  
  123. display_menu($menu_lang);
  124.  
  125.  
  126. display_error($error);
  127. display_msg($msg);
  128. if(!$msg && !$error) display_referrer();
  129.  
  130. if(!$msg)
  131. display_body($array,$actions[1],"register",$use_captcha['register'], null,$form_title[1],"<a href=\"#\">I agree with the rules of agreement.</a>");
  132.  
  133. footer();
  134.  
  135. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement