Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function register($user,$pass,$email,$country,$dob,$sex,$code,$captcha,$ip) {
- $mip = md5($this->conf['md5_key'] . $ip);
- else {
- //Required function fields cannot be blank..
- if ( ($user == '') || ($pass == '') || ($email == '') || ($sex == '') || ($dob == '') || ($captcha == '') || ($code == '') ) echo 'One of the required values are blank.';
- //Check Username for any abnormalness
- else if ($this->check_string($user) != 'passed') echo 'Username is invalid';
- else if (strlen($user) < $this->conf['uclow']) echo 'Username too short, Lowest: ' . $this->conf['uclow'] . ' You used: ' . strlen($user);
- else if (strlen($user) > $this->conf['uchigh']) echo 'Username too long, Maximum: ' . $this->conf['uchigh'] . ' You used: ' . strlen($user);
- //Check Password for anything out of the norm
- else if ($this->check_string($pass) != 'passed') echo 'Password is invalid';
- else if (strlen($pass) > $this->conf['pclimit') echo 'Password too long.. Max: ' . $this->conf['pclimit'] . ' You used: ' . strlen($pass);
- else if (strlen($pass) < $this->conf['pclow') echo 'Password too short.. Lowest: ' . $this->conf['pclow'] . ' You used: ' . strlen($pass);
- //Check for valid email
- else if (!filter_var($email, FILTER_VALIDATE_EMAIL)) echo 'Email is invalid';
- //Check Captcha
- else if ($this->captcha_check($code,$captcha,$ip) == false) echo 'Incorrect Captcha. Please try again.';
- //Nothing abormal? Alright lets do some final checks then register..
- else {
- $userF = htmlspecialchars($user, ENT_QUOTES);
- $passF = htmlspecialchars($user, ENT_QUOTES);
- $sex = htmlspecialchars($sex, ENT_QUOTES);
- $dob = htmlspecialchars($dob, ENT_QUOTES);
- $country = htmlspecialchars($country, ENT_QUOTES);
- //Does the username exist?
- $check = "select username from " . $this->conf['sql_prefix'] . "users where username = '" . $userF . "'";
- $cres = mysql_query($check);
- $cuser = mysql_num_rows($cres);
- if ($cuser > 0) echo 'Username exists.';
- else {
- //Have we got this email used in prior registrations more than the configured limit?
- $check2 = "select email from " . $this->conf['sql_prefix'] . "users where email = '" . $email . "'";
- $cres2 = mysql_query($check2);
- $cemail = mysql_num_rows($cres2);
- if ($cemail => $this->conf['emaillimit']) echo 'Too many accounts from that email address';
- else {
- //Finally the holy grail, everything passed, lets add them to the DB..
- $insert = "insert into " . $this->conf['sql_prefix'] . "users (username,password,email,registered,country,dob,sex) values('" . $userF . "','" . $passF . "','" . $email . "','" . time() . "','" . $country . "','" . $dob . "','" . $sex . "')";
- mysql_query($insert);
- $activekey = $this->video_keygen() . rand(1,999) . $this->video_keygen();
- $activation = "insert into " . $this->conf['sql_prefix'] . "activate (key,ip,username,life,email) values('" . $activekey . "','" . $mip . "','" . $userF . "','" . time() . "','" . $email . "')";
- mysql_query($activation);
- echo 'Registration Success! Check your email for the activation URL, May take a few minutes.';
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment