Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(!$IS_INDEX) exit;
- // Check if captcha is enabled
- if($use_captcha['register']) {
- if(isset($_SESSION['captcha'])) {
- $real_captcha = safe($_SESSION['captcha']);
- } else {
- $real_captcha = $passed_captcha;
- }
- require_once 'captcha.php';
- $_SESSION['captcha'] = $passed_captcha;
- }
- // Check if user has posted yet
- if (isset($_POST['action']) && htmlspecialchars($_POST['action']) == $actions[1]) {
- /* -------------------------------------------------------------------------- */
- // Clean user INPUT to avoid SQL Injection
- $user = safe($_POST['account']);
- $email = safe($_POST['email']);
- $email2 = safe($_POST['email2']);
- $pass = safe($_POST['pass']);
- $pass2 = safe($_POST['pass2']);
- $captcha = safe($_POST['captcha']);
- $checkbox = safe($_POST['checkbox']);
- /* -------------------------------------------------------------------------- */
- // Check for errors in user input
- $error .= check_username($user);
- $error .= check_password($pass);
- $error .= check_email($email);
- /* -------------------------------------------------------------------------- */
- // If no errors occured -> proceed
- if(!$error) {
- // Check for matches
- $error .= check_password_match($pass,$pass2);
- $error .= check_email_match($email,$email2);
- // If captcha is enabled check match
- if($use_captcha['register']) $error .= check_captcha_match($real_captcha,$captcha);
- // Check if user agreed with the rules
- if(!$checkbox) {
- $error .= $txt[16];
- }
- /* -------------------------------------------------------------------------- */
- // If there are no errors so far, let's proceed
- // Check if username already exists
- if (!$error) {
- // Connect to MS SQL and select database
- mssql($mssql_host,$mssql_db,$mssql_user,$mssql_pass);
- // If user exceeded maximum attempts give error
- $error = is_banned();
- if(!$error) {
- // Check if account exists
- $query = mssql_query(sprintf(CHECK_ACCOUNT,$user));
- // If there are results -> error
- if(mssql_num_rows($query) > 0)
- $error .= $txt[14];
- /* -------------------------------------------------------------------------- */
- // If there are no errors -> CREATE ACCOUNT
- if (!$error) {
- $ssn1 = mt_rand(1000000,9999999);
- $ssn2 = mt_rand(100000,999999);
- $ssn = $ssn1.$ssn2;
- $recovery_key = genRandomString(50);
- $ref = (isset($_COOKIE['referrer']) && !empty($_COOKIE['referrer'])) ? safe($_COOKIE['referrer']) : null;
- // SEND EMAIL WITH LINK
- mail($email,$email_title[3],sprintf(ACCOUNT_REGISTERED,$user,create_activation_link($domain,$user,$recovery_key)),mail_headers());
- // CREATE ACCOUNT
- mssql_query(sprintf(CREATE_AUTH,$user,encrypt($pass),$email,$IP,$pass,$recovery_key,$ref));
- mssql_query(sprintf(CREATE_ACCOUNT, $user));
- mssql_query(sprintf(INSERT_SSN, $ssn, $user, $email));
- mssql_query(sprintf(INSERT_USER_INFO, $user, $ssn));
- if(isset($_COOKIE['referrer'])) setcookie("referrer","", time()-3600);
- unset($_SESSION['captcha']);
- $msg = $txt[21];
- }
- add_apm();
- }
- }
- }
- }
- $array[0]['id'] = "account";
- $array[0]['label'] = $lang[2];
- $array[0]['value'] = $user;
- $array[1]['id'] = "pass";
- $array[1]['label'] = $lang[1];
- $array[2]['id'] = "pass2";
- $array[2]['label'] = $lang[3];
- $array[3]['id'] = "email";
- $array[3]['label'] = $lang[4];
- $array[3]['value'] = $email;
- $array[4]['id'] = "email2";
- $array[4]['label'] = $lang[5];
- $array[4]['value'] = $email2;
- display_header($action,$language,$header_lang);
- display_menu($menu_lang);
- display_error($error);
- display_msg($msg);
- if(!$msg && !$error) display_referrer();
- if(!$msg)
- display_body($array,$actions[1],"register",$use_captcha['register'], null,$form_title[1],"<a href=\"#\">I agree with the rules of agreement.</a>");
- footer();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement