本文整理汇总了PHP中Redirect类的典型用法代码示例。如果您正苦于以下问题:PHP Redirect类的具体用法?PHP Redirect怎么用?PHP Redirect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Redirect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logout
function logout()
{
session_start();
session_destroy();
require 'Conn/Redirect.php';
$redirect = new Redirect();
$redirect->go('index.php?page=login');
}
示例2: actionLunacinema
public function actionLunacinema($clientId = null, $goto = null)
{
$redirect = new Redirect();
$redirect->clientId = $clientId ?: 0;
$redirect->redirected = $goto ?: 'index';
$redirect->url = Yii::app()->getRequest()->getRequestUri();
$redirect->comment = 'redirect for luna cinema';
$redirect->save();
$this->redirect($goto ?: $this->createUrl('site/index'));
}
示例3: actionAdd
public function actionAdd()
{
$region = $_POST['region'];
$out = $_POST['date_out'];
$there = $_POST['date_there'];
$back = $_POST['date_back'];
$courier = $_POST['courier'];
$table = new Timetable();
$table->add_trip($region, $courier, $out, $there, $back);
$redirect = new Redirect();
$redirect->redir("", '');
}
示例4: action_show
/**
* get_show takes in a username, finds the user's id from the username, gets the information about the user from the
* followers and critts table and outputs it into the others.profile view
*/
public function action_show($username)
{
// we get the user's id that matches the username
$user_id = User::where('username', '=', $username)->only('id');
// declare some default values for variables
$following = null;
$followers = 0;
// if the username is not found, display an error
if ($user_id == null) {
echo "This username does not exist.";
} else {
if (Auth::user()) {
// if the user tries to go to his/her own profile, redirect to user's profile action.
if ($user_id == Auth::user()->id) {
return Redirect::to_action('user@index');
}
// check if the current user is already following $username
$following = Follower::where('user_id', '=', Auth::user()->id)->where('following_id', '=', $user_id)->get() ? true : false;
}
// eager load the critts with user data
$allcritts = Critt::with('user')->where('user_id', '=', $user_id);
// order the critts and split them in chunks of 10 per page
$critts = $allcritts->order_by('created_at', 'desc')->paginate(10);
// count the critts
$critts_count = $allcritts->count();
// count the followers
$followers = Follower::where('following_id', '=', $user_id)->count();
// bind data to the view
return View::make('others.profile')->with('username', $username)->with('user_id', $user_id)->with('following', $following)->with('followers', $followers)->with('count', $critts_count)->with('critts', $critts);
}
}
示例5: faqSend
public function faqSend()
{
$question = new Question();
$input = Input::all();
$captcha_string = Input::get('g-recaptcha-response');
$captcha_response = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=6LcCwgATAAAAAKaXhPJOGPTBwX-n2-PPLZ7iupKj&response=' . $captcha_string);
$captcha_json = json_decode($captcha_response);
if ($captcha_json->success) {
$rules = ["sujetQuestion" => "required", "mail" => "required|email", "contenuQuestion" => "required"];
$messages = ["required" => ":attribute est requis pour l'envoi d'une question", "email" => "L'adresse email précisée n'est pas valide"];
$validator = Validator::make(Input::all(), $rules, $messages);
if ($validator->fails()) {
$messages = $validator->messages();
Session::flash('flash_msg', "Certains champs spécifiés sont incorrects.");
Session::flash('flash_type', "fail");
return Redirect::to(URL::previous())->withErrors($validator);
} else {
$question->fill($input)->save();
Session::flash('flash_msg', "Votre question nous est bien parvenue. Nous vous répondrons sous peu.");
Session::flash('flash_type', "success");
return Redirect::to(URL::previous());
}
} else {
Session::flash('flash_msg', "Champ de vérification incorrect ou non coché.");
Session::flash('flash_type', "fail");
return Redirect::to(URL::previous());
}
}
示例6: store
/**
* Upload the file and store
* the file path in the DB.
*/
public function store()
{
// Rules
$rules = array('name' => 'required', 'file' => 'required|max:20000');
$messages = array('max' => 'Please make sure the file size is not larger then 20MB');
// Create validation
$validator = Validator::make(Input::all(), $rules, $messages);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$directory = "uploads/files/";
// Before anything let's make sure a file was uploaded
if (Input::hasFile('file') && Request::file('file')->isValid()) {
$current_file = Input::file('file');
$filename = Auth::id() . '_' . $current_file->getClientOriginalName();
$current_file->move($directory, $filename);
$file = new Upload();
$file->user_id = Auth::id();
$file->project_id = Input::get('project_id');
$file->name = Input::get('name');
$file->path = $directory . $filename;
$file->save();
return Redirect::back();
}
$upload = new Upload();
$upload->user_id = Auth::id();
$upload->project_id = Input::get('project_id');
$upload->name = Input::get('name');
$upload->path = $directory . $filename;
$upload->save();
return Redirect::back();
}
示例7: process_login
function process_login()
{
$username = addslashes($_POST["admin_email"]);
$password = addslashes($_POST["admin_password"]);
$rememberme = isset($_POST["rememberme"]) ? 1 : 0;
if ($password == "") {
$password = "emptynoGakMkgAda yang pakai718";
}
$row = array("admin_email" => $username, "admin_password" => $password, "rememberme" => $rememberme);
/*if ($this->ldapLogin($username, $password)) {
$row["admin_ldap"] = 1;
}*/
//login pakai row credential
Auth::login($row);
//kalau sukses
if (Auth::isLogged()) {
//load school setting
// $ss = new Schoolsetting();
// $ss->loadToSession();
//redirect
//Account::setRedirection ();
Hook::processHook($this->login_hook);
Redirect::firstPage();
} else {
Redirect::loginFailed();
}
}
示例8: save
public function save () {
$param = Input::all();
$validator = Validator::make($param, [
'site_title' => 'required',
'meta_description' => 'required',
'meta_keywords' => 'required',
'email_support' => 'required|email',
'count_pagination' => 'required'
]);
if ( $validator->fails() ) {
$output = '';
$errors = $validator->messages()->toArray();
foreach ($errors as $error) {
$output .= $error[0] . '<br>';
}
return View::make('admin.elements.error')->with('errors', $output);
}
AppSettings::set('site_title', $param['site_title']);
AppSettings::set('meta_description', $param['meta_description']);
AppSettings::set('meta_keywords', $param['meta_keywords']);
AppSettings::set('email_support', $param['email_support']);
AppSettings::set('count_pagination', $param['count_pagination']);
return Redirect::to(URL::previous());
}
示例9: doLogin
public function doLogin()
{
// validate the info, create rules for the inputs
$rules = array('email' => 'required|email', 'password' => 'required|alphaNum|min:3');
// run the validation rules on the inputs from the form
$validator = Validator::make(Input::all(), $rules);
// if the validator fails, redirect back to the form
if ($validator->fails()) {
return Redirect::to('login')->withErrors($validator)->withInput(Input::except('password'));
// send back the input (not the password) so that we can repopulate the form
} else {
// create our user data for the authentication
$userdata = array('email' => Input::get('email'), 'password' => Input::get('password'));
// attempt to do the login
if (Auth::attempt($userdata)) {
// validation successful!
// redirect them to the secure section or whatever
// return Redirect::to('secure');
// for now we'll just echo success (even though echoing in a controller is bad)
echo 'SUCCESS!';
} else {
// validation not successful, send back to form
return Redirect::to('login');
}
}
}
示例10: postRequest
/**
* Saves user submissions for Independent Sponsor requests.
*/
public function postRequest()
{
//Grab input
$address1 = Input::get('address1');
$address2 = Input::get('address2');
$city = Input::get('city');
$state = Input::get('state');
$postal = Input::get('postal');
$phone = Input::get('phone');
$all_input = Input::all();
//Validate input
$rules = array('address1' => 'required', 'city' => 'required', 'state' => 'required', 'postal' => 'required', 'phone' => 'required');
$validation = Validator::make($all_input, $rules);
if ($validation->fails()) {
return Redirect::to('/documents/sponsor/request')->withInput()->withErrors($validation);
}
//Add new user information to their record
$user = Auth::user();
$user->address1 = $address1;
$user->address2 = $address2;
$user->city = $city;
$user->state = $state;
$user->postal_code = $postal;
$user->phone = $phone;
$user->save();
//Add UserMeta request
$request = new UserMeta();
$request->meta_key = UserMeta::TYPE_INDEPENDENT_SPONSOR;
$request->meta_value = 0;
$request->user_id = $user->id;
$request->save();
return Redirect::to('/user/edit/' . $user->id)->with('message', 'Your request has been received.');
}
示例11: poista
public static function poista($om_id)
{
self::check_logged_in();
$omistaja = new Omistaja(array('om_id' => $om_id));
$omistaja->destroy();
Redirect::to('/omistaja', array('message' => 'Omistaja on nyt poistettu onnistuneesti!'));
}
示例12: destroy
/**
* Unfollow a user
*
* @param $userIdToUnfollow
* @return Response
*/
public function destroy($userIdToUnfollow)
{
$input = array_add(Input::all(), 'userId', Auth::id());
$this->execute(UnfollowUserCommand::class, $input);
Flash::success("You have now unfollowed this user.");
return Redirect::back();
}
示例13: destroy
public function destroy($id)
{
$user = User::findOrFail($id);
$user->delete();
Flash::success('User ' . $user->name . ' deleted!');
return \Redirect::back();
}
示例14: show
public function show($name)
{
if (\Auth::check() && \Auth::user()->permission->name == 'admin') {
if (is_numeric($name)) {
$dl = Downloads::where('id', '=', $name)->where('trash', '=', '0')->first();
if (is_null($dl)) {
return \Redirect::to('404');
}
return \View::make('downloads.show')->with('entry', $dl);
} else {
$dl = Downloads::where('name', '=', $name)->where('trash', '=', '0')->first();
if (is_null($dl)) {
return \Redirect::to('404');
}
return \View::make('downloads.show')->with('entry', $dl);
}
} else {
if (is_numeric($name)) {
$dl = Downloads::where('id', '=', $name)->where('trash', '=', '0')->where('state', '=', '1')->first();
if (is_null($dl)) {
return \Redirect::to('404');
}
return \View::make('downloads.show')->with('entry', $dl);
} else {
$dl = Downloads::where('name', '=', $name)->where('trash', '=', '0')->where('state', '=', '1')->first();
if (is_null($dl)) {
return \Redirect::to('404');
}
return \View::make('downloads.show')->with('entry', $dl);
}
}
}
示例15: dologin
public function dologin()
{
$rules = array('username' => 'required', 'password' => 'required');
$message = array('required' => 'Data :attribute harus diisi', 'min' => 'Data :attribute minimal diisi :min karakter');
$validator = Validator::make(Input::all(), $rules, $message);
if ($validator->fails()) {
return Redirect::to('/')->withErrors($validator)->withInput(Input::except('password'));
} else {
$data = array('username' => Input::get('username'), 'password' => Input::get('password'));
if (Auth::attempt($data)) {
$data = DB::table('user')->select('user_id', 'level_user', 'username')->where('username', '=', Input::get('username'))->first();
//print_r($data);
//echo $data->id_users;
Session::put('user_id', $data->user_id);
Session::put('level', $data->level_user);
Session::put('username', $data->username);
//print_r(Session::all());
return Redirect::to("/admin/beranda");
} else {
Session::flash('messages', '
<div class="alert alert-danger alert-dismissable" >
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<strong>Peringatan...</strong><br>
Username dan password belum terdaftar pada sistem !
</div>
');
return Redirect::to('/')->withInput(Input::except('password'));
}
}
}