本文整理汇总了PHP中helpers\Url::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::redirect方法的具体用法?PHP Url::redirect怎么用?PHP Url::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers\Url
的用法示例。
在下文中一共展示了Url::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleFirstStep
public function handleFirstStep($post)
{
/*
* @todo: xss security
* @todo: csrf security
* @todo: gump validation
*/
$name = $post['group_name'];
$descr = $post['group_descr'];
if (strlen($name) < 4) {
$error[] = 'Group name is too short.';
} else {
$check = $this->getGroupName($name);
if (strtolower($check[0]->nume) == strtolower($name)) {
$error[] = 'Group name already taken.';
}
}
$tokenString = hash('sha256', mt_rand());
$groupData = array('id_autor' => Session::get('id'), 'nume' => $name, 'descr' => $descr, 'completed' => $tokenString);
if (!isset($error)) {
$this->db->insert('grupuri', $groupData);
setcookie('unfinished_group', $tokenString, time() + COOKIE_RUNTIME);
Url::redirect(DIR . 'teacher/new-group-2', true);
}
return $error;
}
示例2: __construct
public function __construct()
{
parent::__construct();
if (!Session::get('loggedin')) {
Url::redirect('login');
}
}
示例3: register
public function register()
{
if (Session::get('logged')) {
Url::redirect();
}
$data['title'] = 'הרשמה';
if (isset($_POST['submit'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
if ($username == '') {
$error[] = 'שם משתמש הוא שדה נדרש';
}
if ($this->_model->get_user($username)) {
$error[] = 'שם המשתמש תפוס, בעסה';
}
if ($password == '') {
$error[] = 'צריך סיסמא כדי להירשם, אחרת כל אחד יוכל להיכנס במקומך...';
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error[] = 'כדי להירשם צריך מייל, למקרה ששכחת את הסיסמא';
}
if (!$error) {
$postdata = array('user_name' => $username, 'user_password' => Password::make($password), 'user_email' => $email);
$this->_model->add_user($postdata);
$this->login_user($username);
// Session::set('message','User Added');
Url::redirect();
}
}
View::renderTemplate('header', $data);
View::render('register', $data, $error);
View::renderTemplate('footer', $data);
}
示例4: logout
/**
* Logs the user out
*
*/
public function logout()
{
Session::destroy();
/* Clear all sessions set for this project */
Url::redirect("http://something.sellerstam.mebokund.com/", true);
/* Goes back to the home page */
}
示例5: edit
public function edit($id)
{
$data['title'] = 'Edit Member';
$data['row'] = $this->model->get_member($id);
if (isset($_POST['submit'])) {
if ($_POST['token'] != Session::get('token')) {
Url::redirect('admin/login');
}
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
if ($username == '') {
$error[] = 'Username is required';
}
if ($password == '') {
$error[] = 'Password is required';
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error[] = 'Email is not valid';
}
if (!$error) {
$postdata = array('member_username' => $username, 'member_password' => Password::make($password), 'member_email' => $email);
$where = array('member_id' => $id);
$this->model->update_member($postdata, $where);
Session::set('message', 'Member Updated');
Url::redirect('admin/members');
}
}
View::renderadmintemplate('header', $data);
View::render('admin/members/edit', $data, $error);
View::renderadmintemplate('footer', $data);
}
示例6: register
public function register()
{
if (Session::get('loggedin')) {
Url::redirect('');
}
$data['title'] = "Registrace";
$model = new \Models\Users();
if (isset($_POST['submit'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$repeatPassword = $_POST['repeatPassword'];
$email = $_POST['email'];
if ($password == $repeatPassword) {
if (!$model->exists($username)) {
// array of values for new user
$postdata = array('name' => $username, 'pass' => Password::make($password), 'email' => $email);
$model->add($postdata);
Url::redirect('login');
} else {
$error[] = 'Jméno je již zabráno. Zkuste prosím jiné';
}
} else {
$error[] = 'Heslo a ověření hesla se neshodují. Zkuste je prosím vyplnit znovu.';
}
}
View::renderTemplate('header', $data);
View::render('auth\\register', $data, $error);
View::renderTemplate('footer', $data);
}
示例7: index
public function index()
{
$data['title'] = "Sistema de Administración de Aerolíneas";
$data['page'] = "page2";
if (!is_null(filter_input(INPUT_POST, 'insertar'))) {
$nombre = $_POST['nombre'];
$responsable = $_POST['responsable'];
$numero = $_POST['numero'];
$email = $_POST['correo'];
$datos = array('NOMBRE' => $nombre, 'NOMBRE_RESPONSABLE' => $responsable, 'AVIONES' => $numero, 'EMAIL' => $email);
$this->_model->insertar_aerolinea($datos);
Url::redirect("aerolineas?aer=1");
} elseif (!is_null(filter_input(INPUT_POST, 'eliminar'))) {
$id_aerolinea = $_POST['id_aerolinea'];
$where = array('aerolinea_id' => $id_aerolinea);
$this->_model->eliminar_aerolinea($where);
} elseif (!is_null(filter_input(INPUT_POST, 'editar'))) {
$nombre = $_POST['nombre'];
$responsable = $_POST['responsable'];
$numero = $_POST['numero'];
$email = $_POST['correo'];
$id_aerolinea = $_POST['id_aerolinea'];
$data = array('NOMBRE' => $nombre, 'NOMBRE_RESPONSABLE' => $responsable, 'AVIONES' => $numero, 'EMAIL' => $email);
$where = array('aerolinea_id' => $id_aerolinea);
$this->_model->actualizar_aerolinea($data, $where);
}
$data['aerolineas'] = $this->_model->obtener_aerolineas();
$data['aviones'] = $this->_model->obtener_aviones();
View::renderTemplate('header', $data);
View::render('aerolineas/aerolineas', $data);
View::renderTemplate('footer', $data);
}
示例8: index
public function index()
{
if (!Session::get('loggedin')) {
Url::redirect('login');
}
if (isset($_POST['submit']) && $_FILES['fileToUpload']['size'] > 0) {
$name = !isset($_POST['productName']) || trim($_POST['productName']) == '' ? '' : $_POST['productName'];
$price = !isset($_POST['productPrice']) || trim($_POST['productPrice']) == '' ? 0 : floatval($_POST['productPrice']);
$description = !isset($_POST['productDescription']) || trim($_POST['productDescription']) == '' ? '' : $_POST['productDescription'];
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file, PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if (isset($_POST["submit"])) {
$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
if ($check !== false) {
//echo "File is an image - " . $check["mime"] . ".";
$uploadOk = 1;
} else {
//echo "File is not an image.";
$uploadOk = 0;
}
}
// Check if file already exists
if (file_exists($target_file)) {
$error = "Sorry, file already exists." . $error;
$uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
$error = "Sorry, your file is too large." . $error;
$uploadOk = 0;
}
// Allow certain file formats
if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
$error = "Sorry, only JPG, JPEG, PNG & GIF files are allowed." . $error;
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
$error = "Sorry, your file was not uploaded." . $error;
// if everything is ok, try to upload file
} else {
//if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], str_replace(' ','-',strtolower($target_file)))) {
//echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
$product['product'] = array('name' => $name, 'price' => $price, 'description' => $description, 'lastUpdate' => date('Y-m-d G:i:s'));
$product['image'] = array('image' => file_get_contents($_FILES['fileToUpload']['tmp_name']), 'size' => $_FILES["fileToUpload"]["size"], 'type' => $imageFileType);
$this->_model->insertProduct($product);
//unlink(str_replace(' ','-',strtolower($target_file)));
}
}
Hooks::addHook('js', 'Controllers\\menu@indexJS');
Hooks::addHook('css', 'Controllers\\menu@indexCss');
$data['title'] = 'index';
$data['username'] = Session::get('username');
View::rendertemplate('header', $data);
View::render('menu/index', $data, $error);
View::rendertemplate('footer', $data);
}
示例9: index
public function index()
{
$data['title'] = "Sistema de Administración de Aerolíneas";
$data['page'] = "page3";
if (!is_null(filter_input(INPUT_POST, 'insertar'))) {
$matricula = $_POST['matricula'];
$asientos = $_POST['asientos'];
$id_aerolinea = $_POST['id_aerolinea'];
$datos = array('ASIENTOS' => $matricula, 'MATRICULA' => $asientos, 'AEROLINEA_ID' => $id_aerolinea);
$this->_model->insertar_avion($datos);
Url::redirect("aviones?aer=1");
} elseif (!is_null(filter_input(INPUT_POST, 'eliminar'))) {
$id_aerolinea = $_POST['id_avion'];
$where = array('avion_id' => $id_aerolinea);
$this->_model->eliminar_avion($where);
} elseif (!is_null(filter_input(INPUT_POST, 'editar'))) {
$matricula = $_POST['matricula'];
$asientos = $_POST['asientos'];
$id_aerolinea = $_POST['id_aerolinea'];
$id_avion = $_POST['id_avion'];
$datos = array('ASIENTOS' => $matricula, 'MATRICULA' => $asientos, 'AEROLINEA_ID' => $id_aerolinea);
$where = array('avion_id' => $id_avion);
$this->_model->actualizar_avion($datos, $where);
}
$data['aerolineas'] = $this->_model->obtener_aerolineas();
$data['aviones'] = $this->_model->obtener_aviones();
View::renderTemplate('header', $data);
View::render('aviones/aviones', $data);
View::renderTemplate('footer', $data);
}
示例10: __construct
/**
* Call the parent construct
*/
public function __construct()
{
parent::__construct();
if (!Session::get('loggedin')) {
Url::redirect('login');
}
$this->language->load('Dashboard');
}
示例11: search_post
public function search_post()
{
if (isset($_REQUEST['q'])) {
$this->search($_REQUEST['q']);
} else {
Url::redirect();
}
}
示例12: __construct
/**
* Call the parent construct
*/
public function __construct()
{
parent::__construct();
if (!Auth::isLogged()) {
Url::redirect('login');
}
$this->language->load('phonebook');
$this->phonebook = new \Models\Phonebook();
}
示例13: loguit
public function loguit()
{
//Unset de sessions.
\Helpers\Session::destroy('username');
\Helpers\Session::destroy('id');
\Helpers\Session::destroy('rechten');
//Stuurt je door naar de homepagina.
\Helpers\Url::redirect('home');
}
示例14: __construct
/**
* Call the parent construct
*/
public function __construct()
{
parent::__construct();
if (!Auth::isLogged()) {
Url::redirect('login');
}
$this->language->load('organization');
$this->organization = new \Models\Organization();
}
示例15: logout
public function logout()
{
session_start();
$_SESSION = array();
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time() - 42000, '/');
}
session_destroy();
\Helpers\Url::redirect('');
}