Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- get_header();
- registerNow();
- get_sidebar();
- echo "</div>";
- get_footer();
- // -- Begin changes (1 of 3) for the Are You A Human PlayThru CAPTCHA alternative.
- // IMPORTANT:
- // In order for the PlayThru code to work correctly...
- // - all the files from the ayah_php_bundle zipe file must be in the same folder as
- // this script file.
- // - the ayah_config.php file must contain your correct publisher_key and scoring key.
- require_once("ayah.php");
- $ayah = new AYAH();
- function registerNow()
- {
- global $wpdb,$table_prefix,$wp_version,$userdata,$current_user, $user_ID,$post,$wp_rewrite,$g_content, $ayah;
- get_currentuserinfo();
- ob_start();
- require_once(ABSPATH."/wp-includes/registration.php");
- echo "<div id='left'>";
- $errors = array();
- nocache_headers();
- $user_login = '';
- $user_pass = '';
- $confirm_pass = '';
- $using_cookie = FALSE;
- $m_siteurl = get_option('home');
- $m_errorHead = '<div>';
- $m_errorHead .= '<h2>Error</h2><br />';
- $m_errorHead .= "<hr><br />";
- $m_errorTail = '</div>';
- $m_srReadSuccessHead = '<div>';
- $m_srReadSuccessHead .= '<h2>Signup For Your Account:</h2><br />';
- $m_srReadSuccessTail = '</div>';
- //$m_registerURL1 = get_option('land_signup');
- $m_registerURL = get_option('home')."/?s=Register";
- $m_stReadErrorString = "<BR /> <BR />Please click <a href='".$m_registerURL."'> Here </a> to retry,thanks.<br /><br />";
- if (isset($_POST['landRegisterUser']))
- {
- $user_login = $wpdb->escape($_POST['landRegisterUser']);
- if (empty($user_login))
- {
- die($m_errorHead."Please enter a username".$m_stReadErrorString.$m_errorTail);
- }
- $user_login = sanitize_user( $user_login );
- $user_email = $wpdb->escape($_POST['landRegisterEmail']);
- if (empty($user_email))
- {
- die($m_errorHead."Please enter your email".$m_stReadErrorString.$m_errorTail);
- }
- $user_pass = $wpdb->escape($_POST['landFirstPass']);
- if (empty($user_pass))
- {
- die($m_errorHead."Please enter a password".$m_stReadErrorString.$m_errorTail);
- }
- $confirm_pass = $wpdb->escape($_POST['landAgainPass']);
- if (empty($user_pass))
- {
- die($m_errorHead."You must input postcode!".$m_stReadErrorString.$m_errorTail);
- }
- if (isset($user_login))
- {
- $table_name = $table_prefix . "users";
- $m_stSearchUserSql = "SELECT `ID`,`user_email`,`user_login` FROM `" .$table_name."` WHERE `user_login` = '".$user_login."' OR `user_email` = '".$user_email."' LIMIT 1";
- $m_stSearchUserResult = $wpdb->get_results($m_stSearchUserSql,ARRAY_A);
- if ((!(empty($m_stSearchUserResult[0]['ID']))) || (!(empty($m_stSearchUserResult[0]['user_email']))))
- {
- if ($m_stSearchUserResult[0]['user_email'] == $user_email)
- {
- die($m_errorHead."This user email had been registered!".$m_stReadErrorString.$m_errorTail);
- }
- if (!(empty($m_stSearchUserResult[0]['ID'])))
- {
- die($m_errorHead."This user name had been registered!".$m_stReadErrorString.$m_errorTail);
- }
- }
- else
- {
- // -- Begin changes (2 of 3) for the Are You A Human PlayThru CAPTCHA alternative.
- // -- End changes (1 of 3) -- //
- // Use the AYAH object to get the score.
- $score = $ayah->scoreResult();
- // Only do the rest if the score is ok.
- if ($score)
- {
- $end_pass = md5($user_pass);
- $user_id = wp_create_user( $user_login, $end_pass, $user_email );
- if ( !$user_id )
- {
- die($m_errorHead."Sorry, We can not create new user now, please contact support!".$m_stReadErrorString.$m_errorTail);
- }
- else
- {
- $m_table = $table_prefix."users";
- $m_sql = "update `".$m_table."` set `user_pass` = '".$end_pass."' where `ID` = '".$user_id."'";
- $m_result = $wpdb->query($m_sql);
- $m_stSiteURL = get_option('home');
- $m_stSiteURL = str_replace("http://","",$m_stSiteURL);
- $m_stSiteLink = get_option('home');
- $m_stTitle = "Congratulations, New user account created in ".$m_stSiteURL."!";
- $m_nowFormat = get_option('answeremailformat');
- if (!(empty($m_nowFormat)))
- {
- $m_nowFormat = stripcslashes($m_nowFormat);
- $m_nowFormat = stripcslashes($m_nowFormat);
- $m_nowFormat = str_replace("{%username%}",$user_login,$m_nowFormat);
- $m_nowFormat = str_replace("{%sitename%}",$m_stSiteURL,$m_nowFormat);
- $m_nowFormat = str_replace("{%sitelink%}",$m_stSiteLink,$m_nowFormat);
- $m_nowFormat = str_replace("{%password%}",$user_pass,$m_nowFormat);
- $m_stMessage = "<pre>".$m_nowFormat."</pre>";
- }
- else
- {
- $m_stMessage = "<pre>
- $user_login:
- Welcome to <a href='$m_stSiteLink'>$m_stSiteURL</a>
- Your username is $user_login and your password is:$user_pass,
- Regards, $m_stSiteURL
- </pre>
- ";
- /*
- $m_stMessage = "<pre>
- Congratulations:
- Welcome to <a href='$m_stSiteLink'>$m_stSiteURL</a>
- Your account: <b><i>$user_login</i></b> had been created
- Your password is:$user_pass
- thanks!
- </pre>
- ";
- */
- }
- echo "<div><h2>Thank you</h2>".$m_stMessage;
- echo "<div style='float:right;'>";
- echo "You can click <a href='".get_option('home')."'> HERE </a> to continue .";
- echo "<br />";
- echo "<br />";
- echo $m_srReadSuccessTail."</div>";
- echo "<div style='clear:both;'></div>";
- $nowUserInfo = get_userdata(1);
- $fromAdminMail = $nowUserInfo->user_email;
- //$headers = "From: ". "Money Digger" ." <" . $fromAdminMail . ">\r\n";
- $headers = "From: ". get_option("blogname") ." <" . $fromAdminMail . ">\r\n";
- $m_checkURL = get_option('home')."/?page_id=".get_option('land_email_confirm');
- $me_title = "Thank you for your registration";
- mail($user_email,$me_title,$m_stMessage,$headers);
- }
- }
- }
- }
- }
- else
- {
- echo '<form id="registerFirstForm" action="" method="POST">';
- //echo '<div style="width:350px;border:1px solid #ccc;background:#eee;margin:3px 0px 50px 0px;padding:20px 18px;font-size:12px;font-family: Arial,Verdana,Sans-Serif;">';
- echo "<div>";
- echo '<h2>Signup here for your new account</h2>';
- echo '<br />';
- if ( FALSE == get_option('users_can_register') )
- {
- echo "<p>";
- echo "Sorry,At this time user registration is disabled. We will open registration soon!";
- echo "</p>";
- exit;
- }
- else
- {
- echo '<label class="formlabel">Email:</label><br />';
- echo '<input type="text" id="landRegisterEmail" name="landRegisterEmail" class="input">';
- echo '<label class="formlabel">Username:</label><br />';
- echo '<input type="text" id="landRegisterUser" name="landRegisterUser" class="input">';
- echo '<label class="formlabel">Password :</label><br />';
- echo '<input type="password" id="landFirstPass" name="landFirstPass" class="input">';
- echo '<br />';
- echo '<br />';
- echo '<input type="hidden" id="userHidden" name="userHidden" value="should not see this">';
- // -- Begin changes (3 of 3) for the Are You A Human PlayThru CAPTCHA alternative.
- // Use the AYAH object to get the HTML code needed to
- // load and run the PlayThru™.
- echo $ayah->getPublisherHTML();
- echo '<button type="submit" id="usersubmit" name="usersubmit" value="Register" style="background:#4682b4;color:#fff;padding:3px 6px;margin-left:10px;"><span class="btn">Register</span></span></button>';
- }
- echo "</div>";
- echo '</form>';
- }
- echo "</div>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement