Esempio n. 1
0
 /**
  * Добавляем пользователя с текущими данными
  * @global type $sqlcn
  */
 function Add()
 {
     global $sqlcn;
     // хешируем пароль
     $this->salt = generateSalt();
     $this->password = sha1(sha1($this->pass) . $this->salt);
     $sql = "INSERT INTO users (id, randomid, orgid, login, pass, `password`, salt,\n\t\t\temail, mode, lastdt, active) VALUES (NULL, '{$this->randomid}'," . " '{$this->orgid}', '{$this->login}', '{$this->pass}'," . " '{$this->password}', '{$this->salt}', " . " '{$this->email}', '{$this->mode}', NOW(), 1)";
     $sqlcn->ExecuteSQL($sql) or die('Неверный запрос Tusers.Add (1): ' . mysqli_error($sqlcn->idsqlconnection));
     $fio = $this->fio;
     $code = $this->tab_num;
     $telephonenumber = $this->telephonenumber;
     $homephone = $this->homephone;
     $jpegphoto = $this->jpegphoto;
     $rid = $this->randomid;
     $post = $this->post;
     $zx = new Tusers();
     if ($zx->GetByRandomIdNoProfile($rid)) {
         // добавляю профиль
         $sql = "INSERT INTO users_profile (id, usersid, fio, code,\n\t\t\t\ttelephonenumber, homephone, jpegphoto, post, faza, enddate,\n\t\t\t\tres1) VALUES (NULL, '{$zx->id}', '{$fio}', '{$code}'," . " '{$telephonenumber}', '{$homephone}', '{$jpegphoto}'," . " '{$post}', '', NOW(), '')";
         $sqlcn->ExecuteSQL($sql) or die('Неверный запрос Tusers.Add(2): ' . mysqli_error($sqlcn->idsqlconnection));
     } else {
         die('Не найден пользователь по randomid Tusers.Add');
     }
 }
Esempio n. 2
0
 function Add()
 {
     // добавляем пользователя с текущими данными
     global $sqlcn;
     $sql = "INSERT INTO users (id,randomid,orgid,login,pass,email,mode,lastdt,active) VALUES\n                                      (NULL,'{$this->randomid}','{$this->orgid}','{$this->login}','{$this->pass}',\n                                      '{$this->email}','{$this->mode}',now(),1)";
     $result = $sqlcn->ExecuteSQL($sql);
     if ($result == '') {
         die('Неверный запрос Tusers.Add (1): ' . mysqli_error($sqlcn->idsqlconnection));
     }
     $fio = $this->fio;
     $code = $this->tab_num;
     $telephonenumber = $this->telephonenumber;
     $homephone = $this->homephone;
     $jpegphoto = $this->jpegphoto;
     $rid = $this->randomid;
     $post = $this->post;
     $zx = new Tusers();
     if ($zx->GetByRandomIdNoProfile($rid) == true) {
         // добавляю профиль
         $sql = "INSERT INTO users_profile (id,usersid,fio,code,telephonenumber,homephone,jpegphoto,post,faza,enddate,res1) VALUES\n                                      (NULL,'{$zx->id}','{$fio}','{$code}','{$telephonenumber}',\n                                      '{$homephone}','{$jpegphoto}','{$post}','',now(),'')";
         $result = $sqlcn->ExecuteSQL($sql);
     } else {
         die('Не найден пользователь по randomid Tusers.Add');
     }
     if ($result == '') {
         die('Неверный запрос Tusers.Add(2): ' . mysqli_error($sqlcn->idsqlconnection));
     }
 }