Beispiel #1
0
 public function Chop()
 {
     //Увеличеваем дерево на складе на 1
     $stock = Stock::FindByColumn('login', Auth::GetLogin());
     $stock->wood += 1;
     $stock->save();
     if ($this->height != 1) {
         $this->height -= 1;
         $this->state = 'chopping';
         $this->save();
     } else {
         $this->height = null;
         $this->state = 'find';
         $this->found = false;
         $this->save();
     }
 }
Beispiel #2
0
 public function ActionStock()
 {
     $stock = Stock::FindByColumn('login', Auth::GetLogin());
     $this->view->stock = $stock;
     $this->view->display('Game/stock');
 }
Beispiel #3
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;
     }
 }