Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function createuseraccount($username, $password, $name, $surname, $email, $sex) {
- $pass = $password;
- $username = strip_tags($username);
- $password = strip_tags($password);
- $name = strip_tags($name);
- $surname = strip_tags($surname);
- $email = strip_tags($email);
- if(!empty($username) && !empty($password) && !empty($name) && !empty($email) && preg_match("/^[a-zA-Z0-9]+$/", $username)==1) {
- $password = engine::crypts(engine::crypts(engine::crypts($password, "MD5", 0), 2, 0), "SHA1", 0);
- $rank = 0;
- $website = 'http://'.SITE_DOMAIN.'/'.$username.'';
- $location = getlanguage(78);
- $about_me = getlanguage(79);
- $what_ask = getlanguage(80);
- $photo = "photo_default.png";
- if(SIGNUP_CONFIRMATION==1) {
- $status = 10;
- }
- else {
- $status = 1;
- }
- $ip = USER_IP;
- if($sex!=1 && $sex!=2) $sex=0;
- $sex = $sex;
- $protection = 1;
- $reg_date = time();
- if(!empty($username) && strlen($username)>3) {
- if(engine::usernameexists($username)=="Username Exists") {
- $_SESSION['msg']=2;
- engine::headerin("account/signup");
- exit;
- }
- }
- if(!empty($email) && strlen($email)>5) {
- if(engine::emailalreadyexists($email)=="Email Exists") {
- $_SESSION['msg']=1;
- engine::headerin("account/signup");
- exit;
- }
- }
- if(!empty($password) && strlen($password)<4) {
- $_SESSION['msg']=1;
- engine::headerin("account/signup");
- exit;
- }
- $mysqlmessage["user"] = "INSERT INTO users ";
- $mysqlmessage["user"] .= "(username, password, real_name, real_surname, points, rank, verified, email, website, localization, bio, sex, what_ask, photo, cover, status, ip, anonymous_view, reg_date) ";
- $mysqlmessage["user"] .= "VALUES ";
- $mysqlmessage["user"] .= "(?, ?, ?, ?, '1', '0', '0', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
- $stmt = $this->conn->prepare($mysqlmessage["user"]);
- $stmt->execute(array($username,$password,$name,$surname,$email,$website,$location,$about_me,$sex,$what_ask,$photo,'',$status,$ip,$protection,$reg_date));
- if($stmt->rowCount()!=0) {
- if(SESSION_STATUS!=true) {
- if(SIGNUP_CONFIRMATION==1) {
- engine::send_confirmation($username);
- engine::headerin("site/signup");
- exit;
- }
- else {
- engine::checkcookies($username, $pass);
- }
- }
- }
- }
- }
- public function createuseraccountsocial($username, $email, $network, $id, $name, $surname, $photo, $country, $city, $sex) {
- $username = strip_tags($username);
- $email = strip_tags($email);
- if(!empty($username) && preg_match("/^[a-zA-Z0-9]+$/", $username)==1) {
- $rank = 0;
- $website = 'http://'.SITE_DOMAIN.'/'.$username;
- $location = $country.' '.$city;
- $about_me = getlanguage(79);
- $what_ask = getlanguage(80);
- $status = 1;
- $ip = USER_IP;
- if($sex!=1 && $sex!=2) $sex=0;
- $sex = $sex;
- $protection = 1;
- $reg_date = time();
- if(!empty($username) && strlen($username)>3) {
- if(engine::usernameexists($username)=="Username Exists") {
- $_SESSION['msg'] = 2;
- engine::headerin("account/signup");
- exit;
- }
- }
- if(!empty($email) && strlen($email)>5) {
- if(engine::emailalreadyexists($email)=="Email Exists") {
- $_SESSION['msg'] = 1;
- engine::headerin("account/signup");
- exit;
- }
- }
- if($photo!="") {
- if(substr($photo,0,8)=='https://') {
- $photo = substr($photo,8);
- $photo = "http://".$photo;
- }
- $photo_crypt_name = engine::crypts($username.time(), 1, 0).".jpg";
- $root = realpath($_SERVER["DOCUMENT_ROOT"]);
- $directory = IMG_PATH.$photo_crypt_name;
- $image = file_get_contents($photo);
- file_put_contents($directory, $image);
- $photo = $photo_crypt_name;
- }
- else $photo = "photo_default.png";
- $mysqlmessage["user"] = "INSERT INTO users ";
- $mysqlmessage["user"] .= "(username, password, real_name, real_surname, points, rank, verified, email, website, localization, bio, sex, what_ask, photo, cover, status, ip, anonymous_view, reg_date, social) ";
- $mysqlmessage["user"] .= "VALUES ";
- $mysqlmessage["user"] .= "(?, '', ?, ?, '1', '0', '0', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
- $stmt = $this->conn->prepare($mysqlmessage["user"]);
- $stmt->execute(array($username,$name,$surname,$email,$website,$location,$about_me,$sex,$what_ask,$photo,'',$status,$ip,$protection,$reg_date,$id));
- if($stmt->rowCount()!=0) {
- if(SESSION_STATUS!=true) {
- engine::checkcookies("", "", $network, $id);
- unset($_SESSION['regnetwork']);
- unset($_SESSION['regid']);
- unset($_SESSION['regfirst_name']);
- unset($_SESSION['reglast_name']);
- unset($_SESSION['regbdate']);
- unset($_SESSION['regphoto_big']);
- unset($_SESSION['regcountry']);
- unset($_SESSION['regcity']);
- exit;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement