本文整理汇总了PHP中redirect函数的典型用法代码示例。如果您正苦于以下问题:PHP redirect函数的具体用法?PHP redirect怎么用?PHP redirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了redirect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: intlDomain
public function intlDomain(Request $request)
{
$data = $request->all();
$contacts = (object) $data['contacts'];
//Registrant Contact Array
$registrant = ['Firstname' => $contacts->Registrant_FirstName, 'Lastname' => $contacts->Registrant_LastName, 'Organization' => 'My Company', 'CountryCode' => $contacts->Registrant_CountryCode, 'City' => $contacts->Registrant_City, 'Email' => $contacts->Registrant_Email, 'Street' => $contacts->Registrant_Street, 'PostalCode' => $contacts->Registrant_PostalCode, 'PhoneNumber' => $this->intlphoneNumber($contacts->Registrant_PhoneNumber, $contacts->Registrant_CountryCode)];
// Admin Contact Array
$admin = ['Firstname' => $contacts->Admin_FirstName, 'Lastname' => $contacts->Admin_LastName, 'Organization' => 'My Company', 'CountryCode' => $contacts->Admin_CountryCode, 'City' => $contacts->Admin_City, 'Email' => $contacts->Admin_Email, 'Street' => $contacts->Admin_Street, 'PostalCode' => $contacts->Admin_PostalCode, 'PhoneNumber' => $this->intlphoneNumber($contacts->Registrant_PhoneNumber, $contacts->Registrant_CountryCode)];
$c = array('Registrant' => $registrant, 'Admin' => $admin, 'Technical' => $admin, 'Billing' => $admin);
$nameservers = ['Ns_list' => implode(',', $data['name_servers'])];
try {
InternetBS::init('X1A7S0D7X8N0U0U0I6S2', 'Toto197500cxz');
if (Domain::find($data['domain_id'])->domain_status == 0) {
$response = (object) json_decode(InternetBS::api()->domainCreate($data['domain_name'], $c, 1, $nameservers));
if ($response->product[0]->status == 'SUCCESS') {
$domain = Domain::find($data->domain_id);
$domain->domain_status = 1;
$domain->save();
// Send an email of confirmation and do a redirection automatically
return redirect('admin/dashboard');
} else {
// Redict to error page
return redirect('admin/errors');
}
} else {
// Update Domain Name //
InternetBS::api()->domainAssignNS($data['domain_name'], $data['name_servers']);
$updates = InternetBS::api()->domainUpdate($data['domain_name'], $c);
return ['response' => $updates];
}
} catch (Exception $e) {
return ['response' => 'error detected', 'error_msg' => $e->getMessage()];
}
}
示例2: view
/**
* Display a page with this order of priority (based on the provided page name) :
* 1. Does the page exist into local/pages/{lang}/ (this allows you to overwrite default pages)?
* 2. Does the page exist into the views available in views/pages/ folder?
* Pages are not public and we take into account the language of the connected user.
* If the page name contains the keyword export, then we don't output the default template.
* @param string $page Name of the view (and of the corresponding PHP file)
* @author Benjamin BALET <benjamin.balet@gmail.com>
*/
public function view($page = 'home')
{
$data = getUserContext($this);
$trans = array("-" => " ", "_" => " ", "." => " ");
$data['title'] = ucfirst(strtr($page, $trans));
// Capitalize the first letter
//The page containing export in their name are returning another MIMETYPE
if (strpos($page, 'export') === FALSE) {
//Don't include header and menu
$this->load->view('templates/header', $data);
$this->load->view('menu/index', $data);
}
$view = 'pages/' . $this->language_code . '/' . $page . '.php';
$pathCI = APPPATH . 'views/';
$pathLocal = FCPATH . 'local/';
//Check if we have a user-defined view
if (file_exists($pathLocal . $view)) {
$this->load->customView($pathLocal, $view, $data);
} else {
//Load the page from the default location (CI views folder)
if (!file_exists($pathCI . $view)) {
redirect('notfound');
}
$this->load->view($view, $data);
}
if (strpos($page, 'export') === FALSE) {
$this->load->view('templates/footer', $data);
}
}
示例3: islogged
function islogged()
{
if (session_status() === PHP_SESSION_ACTIVE) {
return;
}
redirect("login.php");
}
示例4: index
public function index()
{
if (!$this->ion_auth->logged_in()) {
// redirect them to the login page
redirect('camapaignmanager/login', 'refresh');
}
}
示例5: incluir
public function incluir()
{
// Coloca os valores em variáveis
$dados['descricao'] = $this->input->post("descricao");
$dados['telefone'] = $this->input->post("telefone");
$dados['email'] = $this->input->post("email");
$dados['nome'] = $this->input->post("nome");
$dados['data_nascimento'] = preg_replace('/^(\\d+)\\/(\\d+)\\/(\\d+)$/', '${3}-${2}-${1}', $this->input->post("data_nascimento"));
$dados['prontuario'] = $this->input->post("prontuario");
$dados['cpf'] = $this->input->post("cpf");
$dados['tipo'] = $this->input->post("tipo");
$dados['id_anuncio'] = $this->anuncios_model->inserir($dados);
if ($_FILES['image']['name'] != '') {
$path = 'maso/uploads/anuncios/';
// Configura o upload
$config = array('upload_path' => $path, 'allowed_types' => 'gif|jpg|png', 'file_name' => "anuncio_" . $dados['id_anuncio'], 'maintain_ratio' => true, 'max_size' => 0, 'max_filename' => 0);
$this->load->library('upload');
$this->upload->initialize($config);
if ($this->upload->do_upload('image')) {
// Informações do arquivo apos upload
$infoDoc = $this->upload->data();
// Salvando as informações da imagem
$dadosDoc = array('id_anuncio' => $dados['id_anuncio'], 'imagem' => $infoDoc['file_name']);
$this->anuncios_model->update($dadosDoc);
} else {
$this->session->set_flashdata("error", $this->upload->display_errors('<div class="alert alert-error">', '</div>'));
}
}
$this->session->set_flashdata("messege", "Anúncio enviado com sucesso !");
redirect('page/anuncios');
}
示例6: index
public function index($error = '')
{
$data['error'] = $error;
$this->load->model('information/search_minute_model', '', TRUE);
//title for the page
//$header['title']='Search Removed Minutes';
//$this->load->view('templates/header',$header);
if ($this->input->post('go') == FALSE) {
//$header['title']='Search Removed Minutes';
$this->drawHeader("Search Removed Minutes");
$data['id'] = $this->search_minute_model->get_minute_ids();
//var_dump($data);
if ($data['id'] == NULL) {
$this->session->set_flashdata('flashError', 'There is no any removed minutes.');
redirect('information/search');
}
$this->load->view('information/search_minute', $data);
} else {
//$header['title'] = 'View Minutes';
$this->drawHeader("View Minutes");
$data['id'] = $this->search_minute_model->get_minute_ids();
$data['selected'] = $this->input->post('minute_id');
$this->load->view('information/search_minute', $data);
$data['minute_row'] = $this->search_minute_model->get_minute_row($data['selected']);
//var_dump($data);
$this->load->view('information/view_minuteR', $data);
}
$this->drawFooter();
}
示例7: logout
public function logout()
{
$this->delete_remember_me();
$this->session->unset_userdata('user');
$this->session->sess_destroy();
redirect('/', 'refresh');
}
示例8: logAppDevice
public function logAppDevice($type, $token)
{
$forever = time() + 10 * 365 * 24 * 60 * 60;
setcookie('device_type', $type, $forever, '/');
setcookie('device_token', $token, $forever, '/');
return redirect('auth/login');
}
示例9: invitetogroup_submit
function invitetogroup_submit(Pieform $form, $values)
{
global $SESSION, $USER, $group, $user;
group_invite_user($group, $user->id, $USER, isset($values['role']) ? $values['role'] : null);
$SESSION->add_ok_msg(get_string('userinvited', 'group'));
redirect(profile_url($user));
}
示例10: slots
public function slots()
{
$user = Auth::user();
$location = $user->location;
$slot = Slot::where('location', '=', $location)->first();
$input = Input::get('wager');
$owner = User::where('name', '=', $slot->owner)->first();
$num1 = rand(1, 10);
$num2 = rand(5, 7);
$num3 = rand(5, 7);
if ($user->name != $owner->name) {
if ($num1 & $num2 & $num3 == 6) {
$money = rand(250, 300);
$payment = $money += $input * 1.75;
$user->money += $payment;
$user->save();
session()->flash('flash_message', 'You rolled three sixes!!');
return redirect('/home');
} else {
$user->money -= $input;
$user->save();
$owner->money += $input;
$owner->save();
session()->flash('flash_message_important', 'You failed to roll three sixes!!');
return redirect(action('SlotsController@show', [$slot->location]));
}
} else {
session()->flash('flash_message_important', 'You own this slot!!');
return redirect(action('SlotsController@show', [$slot->location]));
}
}
示例11: unauthenticated
/**
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
* @return \Illuminate\Http\Response
*/
protected function unauthenticated($request, AuthenticationException $exception)
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
}
return redirect()->guest('login');
}
示例12: not_loggedin
public function not_loggedin()
{
$CI =& get_instance();
if (!$CI->session->is_loggedin) {
redirect('/index');
}
}
示例13: action
function action()
{
if (isset($_POST['action']['save'])) {
$fields = $_POST['fields'];
$permissions = $fields['permissions'];
$name = trim($fields['name']);
$page_access = $fields['page_access'];
if (strlen($name) == 0) {
$this->_errors['name'] = 'This is a required field';
return;
} elseif ($this->_driver->roleExists($name)) {
$this->_errors['name'] = 'A role with the name <code>' . $name . '</code> already exists.';
return;
}
$sql = "INSERT INTO `tbl_members_roles` VALUES (NULL, \n\t\t\t\t\t\t\t\t\t\t\t\t'{$name}', \n\t\t\t\t\t\t\t\t\t\t\t\t" . (strlen(trim($fields['email_subject'])) > 0 ? "'" . addslashes($fields['email_subject']) . "'" : 'NULL') . ", \n\t\t\t\t\t\t\t\t\t\t\t\t" . (strlen(trim($fields['email_body'])) > 0 ? "'" . addslashes($fields['email_body']) . "'" : 'NULL') . ")";
$this->_Parent->Database->query($sql);
$role_id = $this->_Parent->Database->getInsertID();
if (is_array($page_access) && !empty($page_access)) {
foreach ($page_access as $page_id) {
$this->_Parent->Database->query("INSERT INTO `tbl_members_roles_page_permissions` VALUES (NULL, {$role_id}, {$page_id}, 'yes')");
}
}
if (is_array($permissions) && !empty($permissions)) {
$sql = "INSERT INTO `tbl_members_roles_event_permissions` VALUES ";
foreach ($permissions as $event_handle => $p) {
foreach ($p as $action => $allow) {
$sql .= "(NULL, {$role_id}, '{$event_handle}', '{$action}', '{$allow}'),";
}
}
$this->_Parent->Database->query(trim($sql, ','));
}
redirect(extension_members::baseURL() . 'edit/' . $role_id . '/created/');
}
}
示例14: destroy
/**
* Remove the specified resource from storage.
*
* @param string $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$social_media = $this->social_medias->find($id);
$social_media->delete();
flash()->info('Deleted', 'Social Media has been deleted');
return redirect()->route('admin.social_media.index');
}
示例15: autenticar
public function autenticar()
{
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="alert alert-warning">', '</div>');
$this->establecer_reglas();
if ($this->form_validation->run() === FALSE) {
$this->load->view('templates/login');
} else {
$datos = array('email' => $this->input->post('email'), 'clave' => $this->input->post('clave'));
$this->load->model('login_model');
if ($this->login_model->autenticar_usuario($datos)) {
#iniciar sesión, guardar datos necesarios
$this->load->model('usuario_model');
$usuario = $this->usuario_model->obtener_usuario_por_email($datos['email']);
$_SESSION['usuario_id'] = $usuario->id_usuario;
$_SESSION['usuario_email'] = $usuario->email;
$_SESSION['usuario_autenticado'] = TRUE;
$this->load->helper('url');
redirect('principal');
} else {
#mostrar error
$data['mostrar_error'] = TRUE;
$this->load->view('templates/login', $data);
}
}
}