/** * Login * * @param array $gpc - contains $gpc['username'] and $gpc['password'] * */ public function process_mode_login($gpc) { # validation on controller if (empty($gpc['username'])) { throw new e_user_input("Blank username"); } if (empty($gpc['password'])) { throw new e_user_input("Blank password"); } # login the session user class if (member::login($gpc['username'], $gpc['password']) instanceof member) { add::redirect(add::config()->path); } }
/** * void redirect_query(array $new_query,bool $merge_current=true) * redirects to the new query string, die()s in the process * @param array $new_query * @param boolean $merge_current true to include current $_GET with $new_query * @todo support string on $new_query * @uses redirect() */ function redirect_query($new_query, $merge_current = true) { if ($merge_current) { $get = $_GET; unset($get['add_mvc_path']); $query = array_merge($get, $new_query); } else { $query = $new_query; } return add::redirect("?" . http_build_query($query)); }
/** * Redirect * * @since ADD MVC 0.5 */ public function redirect() { add::redirect(add::config()->path . self::path()); }
/** * Redirect * * @since ADD MVC 0.5 */ public function redirect() { add::redirect(self::path()); }
/** * login_redirect() * extend to change * @since ADD MVC 0.0 */ static function login_redirect() { add::redirect(add::config()->path . static::LOGIN_PAGE . "?redirect=" . urlencode($_SERVER['REQUEST_URI'])); }
/** * login_redirect() * * @since ADD MVC 0.0 */ static function login_redirect() { add::redirect(add::config()->path . 'login?redirect=' . urlencode($_SERVER['REQUEST_URI'])); }
static function login_redirect() { return add::redirect(static::login_href()); }
/** * Redirect function * die() included * @param string $url the href to redirect into * todo do not die when failed to rediredct * * @deprecated see add::redirect() */ function redirect($url) { trigger_error("Deprecated redirect function", E_USER_DEPRECATED); add::redirect($url); }