Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.60 KB | None | 0 0
  1. $errors = '';
  2.         if($_POST){
  3.             include_once(SP.'src/core/lib/captcha/3DCaptcha.php');
  4.             if(captcha3D::check($_POST['captcha'])){
  5.                 $ops = array(
  6.                     'string' => array(
  7.                         'login' => array(
  8.                             'min' => 6,
  9.                             'max' => 20
  10.                         ),
  11.                         'password' => array(
  12.                             'min' => 6,
  13.                             'max' => 20
  14.                         ),
  15.                         'question' => array(
  16.                             'min' => 3,
  17.                             'max' => 20
  18.                         ),
  19.                         'answer' => array(
  20.                             'min' => 3,
  21.                             'max' => 20
  22.                          )
  23.                      ),
  24.                     'mail' => array(
  25.                         'mail'
  26.                     ),
  27.                     'overlap' => array(
  28.                         'password' => 'password2',
  29.                         'mail'     => 'mail2'
  30.                     ),
  31.                     'binding' => array(
  32.                         'login'    => 'Логин не заполнен',
  33.                         'password' => 'Пароль не заполнен',
  34.                         'mail'     => 'E-mail не заполнен',
  35.                         'question' => 'Вопрос не заполнен',
  36.                         'answer'   => 'Ответ не заполнен'
  37.                     ),
  38.                     'db' => array(
  39.                         'login'    => array('User', 'login'),
  40.                          'mail' => array('User', 'mail')
  41.                     )
  42.                 );
  43.                 $validate = new Validate($ops, $_POST, $this->r['map']);
  44.                 if($validate->isValid()){
  45.                     $date = date('d.m.Y');
  46.                     $user = new User();
  47.                     $user->login    = $_POST['login'];
  48.                     $user->password = md5("thiIs".$_POST['password']."salt");
  49.                     $user->mail     = $_POST['mail'];
  50.                     $user->answer   = $_POST['answer'];
  51.                     $user->question = $_POST['question'];
  52.                     $user->date     = $date;
  53.                     $user->purse    = 0;
  54.                     $user->access   = 0;
  55.                     $id = $this->r['map']->add($user);
  56.                     $accString = md5($_POST['login']."salt".$_POST['mail'].$date);
  57.                     mail($_POST['mail'],
  58.                          "Подтверждение регистрации",
  59.                          "Перейдите по ссылке \n ".DN."/auth/accept/&id=$id&s=$accString");
  60.                     $text = "На вашу почту выслано письмо с подтверждением регистрации";
  61.                     $this->r['tpl']->setOps(array('text' => $text),'accept/accept');
  62.                     $this->buildPage($this->r['tpl']->compile());
  63.                     exit;
  64.                 } else {
  65.                     foreach ($validate->getErrors() as $field => $error) {
  66.                         $errors .= $error.'<br/>';
  67.                     }
  68.                 }
  69.             } else {
  70.                 $errors = 'Не верный код с картинки';
  71.             }
  72.             $this->r['tpl']->setOps(array('error' => $errors),'error/user_error');
  73.             $errors = $this->r['tpl']->compile();
  74.         }
  75.         $this->r['tpl']->setOps(array('error' => $errors),'auth/register_panel');
  76.         $this->buildPage($this->r['tpl']->compile());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement