EVOLUTION-MANAGER
Edit File: host-registration.php
<?php /* UserCake Version: 2.0.2 http://usercake.com */ require_once("models/config.php"); if (!securePage($_SERVER['PHP_SELF'])){die();} if(isUserLoggedIn()) { header("Location: account.php"); die(); } require_once('models/recaptchalib.php'); $publickey = "6LcWrOwSAAAAAAzNIh6nMt1R6BmjvQOg1_9Vm9cT"; $privatekey = "6LcWrOwSAAAAAMapAsaq8f1p6EmHveKO3Om59DiN"; $resp = null; $error = null; //Forms posted if(!empty($_POST)) { $errors = array(); $email = trim($_POST["email"]); $username = trim($_POST["username"]); $displayname = trim($_POST["username"]);//trim($_POST["displayname"]); $password = trim($_POST["password"]); $confirm_pass = trim($_POST["passwordc"]); $phone = trim($_POST["ccode"].$_POST["phone"]); // check for recaptcha $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { //$errors[] = "Invalid captcha entered. Please enter the text in the picture properly."; //$resp->error; } if(minMaxRange(3,25,$username)) { $errors[] = lang("ACCOUNT_USER_CHAR_LIMIT",array(3,25)); } if(!ctype_alnum($username)){ $errors[] = lang("ACCOUNT_USER_INVALID_CHARACTERS"); } /*if(minMaxRange(5,25,$displayname)){ $errors[] = lang("ACCOUNT_DISPLAY_CHAR_LIMIT",array(5,25)); } if(!ctype_alnum($displayname)){ $errors[] = lang("ACCOUNT_DISPLAY_INVALID_CHARACTERS"); }*/ if(minMaxRange(3,50,$password) && minMaxRange(3,50,$confirm_pass)) { $errors[] = lang("ACCOUNT_PASS_CHAR_LIMIT",array(3,50)); } else if($password != $confirm_pass) { $errors[] = lang("ACCOUNT_PASS_MISMATCH"); } if(!isValidEmail($email)) { $errors[] = lang("ACCOUNT_INVALID_EMAIL"); } /*if(minMaxRange(8,15,$phone) && !ctype_digit($phone)) { $errors[] = lang("INVALID_PHONE_NUMBER"); }*/ //End data validation if(count($errors) == 0) { //create the proper phone number $phone="+".$phone; //Construct a user object $user = new User($username,$displayname,$password,$email,$phone,1); //1 for host //Checking this flag tells us whether there were any errors such as possible data duplication occured if(!$user->status) { if($user->username_taken) $errors[] = lang("ACCOUNT_USERNAME_IN_USE",array($username)); //if($user->displayname_taken) $errors[] = lang("ACCOUNT_DISPLAYNAME_IN_USE",array($displayname)); if($user->email_taken) $errors[] = lang("ACCOUNT_EMAIL_IN_USE",array($email)); } else { //Attempt to add the user to the database, carry out finishing tasks like emailing the user (if required) if(!$user->userCakeAddUser()) { if($user->mail_failure) $errors[] = lang("MAIL_ERROR"); if($user->sql_failure) $errors[] = lang("SQL_ERROR"); } } } if(count($errors) == 0) { $successes[] = $user->success; //added by me to auto login the user after register $userdetails = fetchUserDetails($username); $loggedInUser = new loggedInUser(); $loggedInUser->email = $userdetails["email"]; $loggedInUser->user_id = $userdetails["id"]; $loggedInUser->hash_pw = $userdetails["password"]; $loggedInUser->title = $userdetails["title"]; $loggedInUser->displayname = $userdetails["display_name"]; $loggedInUser->username = $userdetails["user_name"]; $loggedInUser->credit = $userdetails["credit"]; $loggedInUser->usertype = 4; $loggedInUser->lastactivity = time(); //Update last sign in $loggedInUser->updateLastSignIn(); $loggedInUser->updateOnlineStatus(); $_SESSION["userCakeUser"] = $loggedInUser; //Redirect to user account page header("Location: index.php"); die(); } } require_once('header.php'); require_once('home-nav.php');?> <div class="container-fluid"> <div class="row-fluid"> <h2>Host Registration - Earn Money</h2> <p class="alert alert-yellow">If you already have a Host Account you can <a href="login.php" class="label label-success">login here.</a></p> </div> <?php require_once('views/register.php'); ?> </div> <?php require_once("footer.php"); ?>