Esempio n. 1
0
 public function postProfile()
 {
     if (isset($_POST['style'])) {
         setcookie('style', $_POST['style'], 0, '/');
     }
     Lib\redirect(SITE_URL . '?action=profile');
 }
Esempio n. 2
0
 public function postLogin()
 {
     $login = empty($_POST['login']) ? null : $_POST['login'];
     $password = empty($_POST['password']) ? null : $_POST['password'];
     if (!empty($_POST['token']) && Lib\valid_token($_POST['token'])) {
         Lib\user(Lib\connection(), $login, $password);
     }
     if (!empty(Lib\user())) {
         Lib\redirect(SITE_URL);
     }
     Lib\redirect(SITE_URL . '?action=login');
 }
Esempio n. 3
0
 public function postHome($params = [])
 {
     if (empty(Lib\user())) {
         Lib\redirect(SITE_URL . '?action=login');
     }
     $message_id = empty($_POST['message_id']) ? null : (int) $_POST['message_id'];
     $message = empty($_POST['message']) ? null : $_POST['message'];
     if (!empty($message) && Lib\valid_token($_POST['token'])) {
         isset($message_id) ? Lib\update_message(Lib\connection(), $message, $message_id) : Lib\insert_message(Lib\connection(), $message, 0);
     }
     Lib\redirect(SITE_URL . "?message_id={$message_id}");
 }