Пример #1
0
 public static function Set($message, $type = 'Message')
 {
     Session::start();
     $arr['message'] = $message;
     $arr['type'] = $type;
     $_SESSION['notification'] = $arr;
 }
Пример #2
0
 public function Register()
 {
     $login = $_POST['login'];
     $password = $_POST['password'];
     Session::start();
     //$captcha = $_SESSION['rand_code'];
     $captcha = $_POST['captcha'];
     unset($_SESSION['rand_code']);
     $err = User::Validate($login, $password, $_POST['password_to'], $captcha);
     if (empty($err)) {
         $user = new User($login, $password);
         $user->login = $login;
         $user->password = sha1($password);
         $user->save();
         $stats = new Stats();
         $stats->login = $user->login;
         $stats->Save();
         $state = new State();
         $state->login = $user->login;
         $state->save();
         $forest = new Forest();
         $forest->login = $user->login;
         $forest->save();
         $stock = new Stock();
         $stock->login = $user->login;
         $stock->save();
         Notification::Set($login . ', Вы зарегистрировались, можете войти на сайт', 'Accept');
         header('location: /visitor/login');
         die;
     } else {
         Notification::Set($err, 'Error');
         header('location: /visitor/register');
         die;
     }
 }