本文整理汇总了PHP中redirect_to函数的典型用法代码示例。如果您正苦于以下问题:PHP redirect_to函数的具体用法?PHP redirect_to怎么用?PHP redirect_to使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了redirect_to函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: goToStep
/**
* Go to specific step
*
* @access public
* @param integer $step Step instance or step number
* @return boolean
*/
function goToStep($step) {
if(!($step instanceof ScriptInstallerStep)) $step = $this->getStep($step);
if(!($step instanceof ScriptInstallerStep)) {
die("Step '$step_number' does not exist in the installation process");
} // if
redirect_to($step->getStepUrl());
} // goToStep
示例2: clear_log
public function clear_log()
{
file_put_contents($this->file_name, "");
$this->new = true;
$this->add_entry($_SESSION['user_id'], 'Log Cleared', 'log cleared');
redirect_to('logs.php?type=' . $this->type);
}
示例3: confirm_login
function confirm_login()
{
if (isset($_SESSION['staff_id']) || isset($_SESSION['user_id'])) {
} else {
redirect_to("index.php");
}
}
示例4: index
public function index($mid = 1)
{
$ticketlist = "";
if (empty($mid)) {
redirect_to($this->uri->link("error/index"));
exit;
}
$this->loadModel("Support");
$datum = $this->model->getList("", "Support");
$this->view->mytickets = $datum['Supportticket'];
$uri = new Url("");
$ticketlist .= "<table class='pure-table' width='100%'>\n\t\t\t<thead><tr>\n\t\t\t\t<th width='10%'>Date</th><th width='5%'>ticketID</th><th width='50%'>Subject</th><th width='10%'>Status </th><th width='10%'>Department </th><th width='12%'>Date Modified </th><th width='5%'></th>\n\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>";
if ($this->view->mytickets) {
$x = 1;
foreach ($this->view->mytickets as $ticket) {
$ticketlist .= "<tr>\n\t\t\t\t\t<td>" . date_format(new DateTime($ticket->datecreated), "M d Y H:i:s") . "</td><td>{$ticket->id}</td><td>{$ticket->subject} </td><td>{$ticket->status}</td><td>{$ticket->department}</td><td>{$ticket->datemodified}</td><td><a href='" . $uri->link("support/detail/" . $ticket->id . "") . "'>View Ticket</a></td>\n\t\t\t\t</tr>";
$x++;
}
} else {
$ticketlist .= "<tr><td colspan='7'>No record to display</td></tr>";
}
$ticketlist .= "</tbody>\n\t\t\t</table>";
$this->view->myvends = $ticketlist;
$this->view->render("support/index");
}
示例5: validateUser
public function validateUser($username, $password)
{
global $db;
if ($this->validateUsername($username) && $this->validatePassword($password)) {
// success
if ($db->has_rows($result = $db->user_name_exists($this->username))) {
$result = $db->fetch_array($result);
//print_r($result);
if (password_verify($this->password, $result['user_password'])) {
$_SESSION['user_id'] = $result['user_id'];
$_SESSION['username'] = $result['user_name'];
$_SESSION['permission'] = $result['permission'];
// the following checks to see if the response is an Ajax response.
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
// ajax message
echo false;
} else {
redirect_to('../public/workshop.php');
}
} else {
echo $this->errors[] = "Incorrect password";
}
} else {
$this->password = "";
echo $this->errors[] = "No such username exists";
}
}
}
示例6: welcome
function welcome()
{
$name = params('name');
if(empty($name)) halt(NOT_FOUND, "Undefined name.");
switch($name)
{
case "bill":
trigger_error('No bill please', E_USER_WARNING);
break;
case "leland":
halt('Fire walk with me', E_USER_ERROR);
break;
case "bob":
halt(HTTP_UNAUTHORIZED, "no, go away!", array(1,2,3));
break;
case "david":
redirect_to('/');
break;
default:
trigger_error("Not sure $name lives in Twin Peaks", E_USER_NOTICE);
# E_USER_NOTICE doesn't stop app execution
break;
}
return html("Welcome $name");
}
示例7: create_user
public function create_user($first_name, $last_name, $username, $password, $confirm_password)
{
global $database;
$errors = array();
// $dfirst_name = "";
// $dlast_name = "";
// $dusername = "";
// $dpassword = "";
// $dconfirm_password = "";
// $demail = "";
if (empty($first_name)) {
$errors[] = "You forgot to enter your first name.";
} else {
$first_name = $database->escape_value($first_name);
}
if (empty($last_name)) {
$errors[] = "You forgot to enter your last name.";
} else {
$last_name = $database->escape_value($last_name);
}
if (empty($username)) {
$errors[] = "You forgot to enter your username.";
} else {
$username = $database->escape_value($username);
}
if (empty($password)) {
$errors[] = "You forget to enter your password.";
} else {
$password = $database->escape_value($password);
}
if (empty($confirm_password)) {
$errors[] = "You forgot to enter your confirm password.";
} else {
$confirm_password = $database->escape_value($confirm_password);
}
if ($password !== $confirm_password) {
$errors[] = "You password and confirm password do not match.";
} else {
$confirm_password = $database->escape_value($confirm_password);
}
if (empty($errors)) {
$sql = " INSERT INTO users ( username , password, first_name, last_name ) VALUES ( '{$username}', '{$password}', '{$first_name}', '{$last_name}' ) ";
if ($database->query($sql)) {
//will return a true or false as this is an insert query...
// get the last id inserted into the DB
$this->id = $database->insert_id();
$_SESSION['registered'] = "You have been successfully registered.";
redirect_to('registration.php');
return true;
} else {
return false;
}
} else {
echo "<br><br><br><br><br><h4 class='text-center'>There were some errors!</h4>\n\n\t\t\t\t<p class='text-center'>The following error(s) occurred: ><br>";
foreach ($errors as $error) {
echo " - {$error}<br>\n";
}
echo "</p>";
}
}
示例8: index
public function index($mid = 1)
{
$productlist = "";
if (empty($mid)) {
redirect_to($this->uri->link("error/index"));
exit;
}
$this->loadModel("Clientproduct");
$datum = $this->model->getList("", "Clientproduct");
$this->view->myclientsproducts = $datum['clientproduct'];
$uri = new Url("");
$productlist .= "<table width='100%'>\n <thead><tr>\n \t<th>S/N</th><th>Product </th><th>Client</th><th>Location</th><th>City </th><th></th><th></th>\n </tr>\n </thead>\n <tbody>";
if ($this->view->myclientsproducts) {
$x = 1;
foreach ($this->view->myclientsproducts as $products) {
$productlist .= "<tr>\n \t<td>{$x}</td><td><a href='" . $uri->link("clientproduct/detail/" . $products->id) . "'>{$products->prod_name}</a> </td><td>{$products->client_name}</td><td>{$products->install_address}</td><td>{$products->install_city}</td><td><a href='" . $uri->link("clientproduct/edit/" . $products->id . "") . "'>Edit</a></td><td><a href='" . $uri->link("clientproduct/doDelete/" . $products->id . "") . "'>Delete</a></td>\n </tr>";
$x++;
}
} else {
$productlist .= "<tr><td colspan='7'>No record to display</td></tr>";
}
$productlist .= "</tbody>\n </table>";
$this->view->myprods = $productlist;
$this->view->render("clientproduct/index");
}
示例9: do_form_submission
/**
* Execution of the form submission
*/
function do_form_submission()
{
// make sure some data was send via appropriate request method
if (!empty($_POST)) {
// ensure that our data array has expected keys
$data = normalize_submission_data($_POST);
// clean up data by removing potential malicious code
$data = array_map('sanitize_text', $data);
// determine if our remaining data meets our minimum standards
$valid = validate_submission_data($data);
// step 1: test to see if the submitted data is valid
if ($valid) {
// step 2: attempt to send the email.
// $success will be true if the email sent, and false if it did not
$success = send_submission_email($data);
// handle the result of our attempt
if ($success) {
// result was true, go to thankyou page
redirect_to('thankyou.html');
} else {
// result was false, go to error page
redirect_to('error.html');
}
} else {
// to submitted data is not valid, go to error page
redirect_to('error.html');
}
} else {
// no request information, go to home
redirect_to('index.html');
}
}
示例10: delete
function delete(&$vars)
{
extract($vars);
$resource->delete_from_post($request);
header_status('200 OK');
redirect_to($request->resource);
}
示例11: index
public function index()
{
if (isset($_SESSION['user_id']) && !empty($_SESSION['user_id'])) {
$data['title'] = 'Elixir Industrial Equipment Inc. Cebu-Branch';
$data['companyName'] = 'Elixir Industrial Equipment Inc.';
$data['clients'] = $this->model->show_client();
$user = $this->load_model('user');
$data['current_user'] = $user->show_current_users_info($_SESSION['user_id']);
$product = $this->load_model('product');
$data['category'] = $product->show_category();
$data['itemUnit'] = $product->show_item_unit();
$notification = $this->load_model('product');
$data['notification'] = $notification->product_lowItems();
if ($data['current_user']['user_type'] == 2) {
$this->load_template('home', $data, 'client');
} else {
if ($data['current_user']['user_type'] != 0) {
redirect_to(home_url());
} else {
$this->load_template('home', $data, 'client');
}
}
} else {
redirect_to(home_url());
}
}
示例12: postIndex
public function postIndex()
{
#set post ke params variable, agar bisa dikirim ke tampilan login
$this->params = $_POST;
if (!in_array($_POST['type'], $this->user_types)) {
#error tipe login salah
$this->params['error_message'] = 'Tipe login salah';
#buka lagi halaman login
$this->getIndex();
} else {
// $this->pdo->enable_debug();
$row = $this->pdo->select("SELECT * FROM {$_POST['type']} WHERE username = ? AND password = ?", [$_POST['username'], hashpassword($_POST['password'])], false);
#error ID atau password salah
if (!$row || count($row) == 0) {
$this->params['error_message'] = 'ID atau password Anda salah';
$this->getIndex();
} else {
#berhasil login
#set session login
switch ($_POST['type']) {
case 'siswa':
$this->user_logged->set_user_logged(['level' => 'siswa', 'hak' => 'siswa', 'admin' => $_POST['username'], 'user' => $row['id_siswa'], 'id' => $row['id_siswa'], 'agent' => $_SERVER['HTTP_USER_AGENT'], 'username' => $_POST['username'], 'status' => $row['status']]);
break;
case 'guru':
$this->user_logged->set_user_logged(['level' => 'guru', 'hak' => 'guru', 'admin' => $_POST['username'], 'user' => $row['id_guru'], 'id' => $row['id_guru'], 'agent' => $_SERVER['HTTP_USER_AGENT'], 'username' => $_POST['username'], 'status' => 'active']);
break;
case 'admin':
$this->user_logged->set_user_logged(['level' => 'admin', 'hak' => 'admin', 'admin' => $_POST['username'], 'user' => $row['id_admin'], 'id' => $row['id_admin'], 'agent' => $_SERVER['HTTP_USER_AGENT'], 'username' => $_POST['username'], 'status' => 'active']);
break;
}
#redirect ke halaman index
redirect_to("{$_POST['type']}/profile");
}
}
}
示例13: logout
public function logout()
{
unset($_SESSION['uid']);
unset($this->uid);
$this->isLoggedIn = false;
redirect_to('login.php');
}
示例14: delete
function delete(&$vars)
{
extract($vars);
$resource->delete_from_post($request);
header_status('200 OK');
redirect_to($request->url_for(array('resource' => 'identities', 'id' => $profile->id, 'action' => 'edit')));
}
示例15: view_modify
public function view_modify()
{
$this->smarty->assign('title', '修改运输方式名预警');
$id = isset($_GET['id']) ? intval(trim($_GET['id'])) : 0;
if (empty($id) || !is_numeric($id)) {
redirect_to("index.php?mod=trackWarnCarrier&act=index");
exit;
}
$trackWarnCarrier = new TrackWarnCarrierAct();
$res = $trackWarnCarrier->actModify($id);
$erpCarrierList = TransOpenApiAct::act_getErpCarrierList();
$this->smarty->assign('shipErp', $erpCarrierList);
//ERP运输方式列表
$carrierList = TransOpenApiModel::getCarrier(2);
$this->smarty->assign('lists', $carrierList);
//运输方式列表
$trackCarrierList = TransOpenApiModel::getTrackCarrierList();
$this->smarty->assign('shipTrack', $trackCarrierList);
//跟踪号系统运输方式列表
$this->smarty->assign('carrier_name', $res['trackName']);
$this->smarty->assign('ship_erp', $res['erpName']);
$this->smarty->assign('ship_id', $res['carrierId']);
$this->smarty->assign('id', $res['id']);
$this->smarty->display('trackWarnCarrierModify.htm');
}