Ejemplo n.º 1
0
 public function ActionForest()
 {
     $forest = Forest::FindByColumn('login', Auth::GetLogin());
     if (isset($_GET['act'])) {
         if ($_GET['act'] == 'find') {
             $forest->Search();
         } elseif ($_GET['act'] == 'chop') {
             $forest->Chop();
         }
         header('location: /game/forest');
     }
     $this->view->forest = $forest;
     $this->view->display('Game/forest');
 }
Ejemplo n.º 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;
     }
 }