本文整理汇总了PHP中redirect类的典型用法代码示例。如果您正苦于以下问题:PHP redirect类的具体用法?PHP redirect怎么用?PHP redirect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了redirect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($c)
{
if (isset($_SESSION["tradewithgeorgia_company_type"]) && $_SESSION["tradewithgeorgia_company_type"] != "manufacturer") {
$redirect = new redirect();
$redirect->go(WEBSITE);
die;
} else {
$this->template($c);
}
}
示例2: __construct
function __construct($c)
{
if (isset($_SESSION["expired_sessioned_time"]) && !empty($_SESSION["expired_sessioned_time"])) {
$time = time();
$new_expire = $time + $c['session.expire.time'];
if ($_SESSION["expired_sessioned_time"] < $time) {
unset($_SESSION["expired_sessioned_time"]);
session_destroy();
$redirect = new redirect();
$redirect->go();
} else {
$_SESSION["expired_sessioned_time"] = $new_expire;
}
}
}
示例3: login
/**
* @return Redirect
*/
public function login()
{
$rules = array('email' => 'required', 'password' => 'required');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return redirect('/')->withErrors($validator);
} else {
$user = array('email' => Input::get('email'), 'password' => Input::get('password'));
if (Auth::validate($user)) {
if (Auth::attempt($user)) {
// Grab Authenticated User's Data Once
$user_data = Auth::user();
Session::put('user_id', $user_data->id);
Session::put('name', $user_data->name);
Session::put('email_id', $user_data->email);
return redirect::to('settings');
}
} else {
/*Session::flash('message','Login Failed');
return redirect('auth/login');*/
return Redirect::back()->withInput()->withErrors('That Email/password does not exist.');
}
}
/* $email = Input::get('email');
$password = Input::get('password');
if (Auth::attempt(['email' => $email, 'password' => $password]))
{
return Redirect::intended('/settings/index');
}
return Redirect::back()
->withInput()
->withErrors('That Email/password combo does not exist.');*/
}
示例4: transaksiSubmit
function transaksiSubmit()
{
$data = Input::all();
$flag = $data['flag'];
print_r($data);
$schedule = Travelschedule::findschedule($data['TRAVEL_SCHEDULE_ID'])->first();
unset($data['_token']);
$schedule_id = $data['TRAVEL_SCHEDULE_ID'];
unset($data['_token'], $data['flag']);
$costumer = $data;
unset($data['COSTUMER_EMAIL'], $data['COSTUMER_NAME'], $data['COSTUMER_TELP']);
if (!is_null(Session::get('id')) and Session::get('hak') == 'COSTUMER') {
$data['MEMBER_ID'] = Session::get('id');
} else {
unset($costumer['TRAVEL_SCHEDULE_ID'], $costumer['TRAVEL_TRANSACTION_PASSENGER'], $costumer['TRAVEL_TRANSACTION_PRICE']);
Costumer::insert($costumer);
$id = DB::getPdo()->lastInsertId();
$data['COSTUMER_ID'] = $id;
}
$data['TRAVEL_TRANSACTION_STATUS_ID'] = 1;
Traveltransaction::insert($data);
$idtransaksi = DB::getPdo()->lastInsertId();
$code = DB::select('select travel_code() as code');
$code = $code[0]->code;
$code_transaksi = ['TRAVEL_TRANSACTION_CODE' => $code];
$transaksi = Traveltransaction::where('TRAVEL_TRANSACTION_ID', '=', $idtransaksi);
$transaksi->update($code_transaksi);
if ($flag == 1) {
return redirect::back();
} else {
return redirect::to('/');
}
}
示例5: action_index
public function action_index()
{
$this->needUser();
$this->ut = new \Kofradia\Game\Utpressing($this->user->player);
\ess::$b->page->add_title("Utpressing");
\kf_menu::$data['utpressing'] = true;
// kontroller fengsel, bomberom og energi
$this->user->player->fengsel_require_no();
$this->user->player->bomberom_require_no();
$this->user->player->energy_require(\Kofradia\Game\Utpressing::ENERGY * 1.3);
// legg til 30 % for krav
// kontroller anti-bot
$this->antibot = \antibot::get("utpressing", static::ANTIBOT_SPAN);
$this->antibot->check_required();
// skjema
$this->form = \Kofradia\Form::getByDomain("utpressing", $this->user);
// sett opp hvilke ranker som kan angripes
$this->rank_min = max(1, $this->user->player->rank['number'] - 1);
$this->rank_max = min($this->rank_min + 3, count(\game::$ranks['items']));
if ($this->rank_max - $this->rank_min < 3) {
$this->rank_min = max(1, $this->rank_max - 3);
}
// sørg for at man har 4 alternativer uavhengig av rank
// utføre utpressing?
if (isset($_POST['utpressing'])) {
$ret = $this->utpress();
if (!$ret) {
return \redirect::handle();
}
return $ret;
}
return $this->showForm();
}
示例6: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(Request $request)
{
$data = array();
$settings = Sitesetting::find(1);
if ($request->isMethod('post')) {
$validator = Validator::make($request->all(), ['site_name' => 'required', 'default_page_title' => 'required', 'default_meta_keywords' => 'required', 'default_meta_description' => 'required', 'contact_email' => 'required']);
if ($validator->fails()) {
return redirect::route('site_settings')->withErrors($validator);
} else {
$site_name = $request->site_name;
$default_page_title = $request->default_page_title;
$default_meta_keywords = $request->default_meta_keywords;
$default_meta_description = $request->default_meta_description;
$contact_email = $request->contact_email;
$settings->site_name = $site_name;
$settings->default_page_title = $default_page_title;
$settings->default_meta_keywords = $default_meta_keywords;
$settings->default_meta_description = $default_meta_description;
$settings->contact_email = $contact_email;
$settings->save();
return redirect::route('site_settings')->with('success', 'Settings updated successfully.');
}
}
$settings = Sitesetting::all()->first();
$data['settings'] = $settings;
return view('admin/sitesettings', $data);
}
示例7: template
public function template($c, $page)
{
$conn = $this->conn($c);
$cache = new cache();
$text_general = $cache->index($c, "text_general");
$data["text_general"] = json_decode($text_general, true);
$welcomepage_categories = $cache->index($c, "welcomepage_categories");
$data["welcomepage_categories"] = json_decode($welcomepage_categories, true);
/* language variables */
$language_data = $cache->index($c, "language_data");
$language_data = json_decode($language_data);
$model_template_makevars = new model_template_makevars();
$data["language_data"] = $model_template_makevars->vars($language_data);
/* Upload Users profile picture */
if (isset($_FILES["profileimage"]["name"])) {
$model_template_upload_user_logo = new model_template_upload_user_logo();
$upload = $model_template_upload_user_logo->upload($c);
}
$sql = 'SELECT `username`,`user_type`,`namelname`,`dob`,`email`,`mobile`,`address`,`picture` FROM `studio404_users` WHERE `id`=:id';
$prepare = $conn->prepare($sql);
$prepare->execute(array(":id" => $_SESSION["batumi_id"]));
if ($prepare->rowCount() > 0) {
$fetch = $prepare->fetch(PDO::FETCH_ASSOC);
$data["userdata"] = $fetch;
} else {
redirect::url(WEBSITE);
}
$include = WEB_DIR . "/profilisredaqtireba.php";
if (file_exists($include)) {
@(include $include);
} else {
$controller = new error_page();
}
}
示例8: link
public function link(Request $request)
{
// validation
$this->validate($request, ['tag' => 'required|string|max:16']);
// retrieve item for tagging
$item = myCloset\Item::find($request->item_id);
// Error checking for if the item already has this tag.
$newTag = strtolower($request->tag);
$tags = $item->tags;
foreach ($tags as $tag) {
if (strcmp($tag->name, $newTag) == 0) {
\Session::flash('flash_message', 'This item already has this tag.');
return redirect::to('/items/' . $request->item_id);
}
}
// So as to actually reuse already created tags and save database space.
$needle = strtolower($request->tag);
$allTags = myCloset\Tag::lists('name')->toArray();
if (in_array($needle, $allTags)) {
// tag exists in the database, get it and save the relationship
$tag = myCloset\Tag::where('name', $needle)->first();
} else {
// tag doesn't yet exist in the database.
$tag = new myCloset\Tag();
$tag->name = strtolower($request->tag);
$tag->save();
}
// create the pivot table relationship
$item->tags()->attach($tag);
return redirect::to('/items/' . $request->item_id);
}
示例9: register
public function register(Request $request)
{
$validate = validateuser::validate(Request::all());
if ($validate->passes()) {
$user = new Member();
$user->email = $request::input('email');
$user->password = \Hash::make($request::input('password'));
$user->name = $request::input('name');
$user->surname = $request::input('surname');
$user->nickname = $request::input('nickname');
$user->phone = $request::input('phone');
$user->id_card = $request::input('id_card');
$user->bank = $request::input('bank');
$user->account_no = $request::input('account');
$user->education = $request::input('education');
$user->institute = $request::input('institute');
$user->reference = $request::input('reference');
$link = '';
if ($user->save()) {
$userinfo = $request::only('email', 'password');
if (Auth::attempt($userinfo)) {
$link = '/';
}
//ส่ง email
//จบส่ง email
} else {
$link = 'register';
}
return Redirect::to($link);
} else {
return redirect::to('register')->withInput(Request::except('password'))->withErrors($validate->messages());
}
}
示例10: handle
public function handle($request, Clousure $next)
{
if (userAuth::check()) {
return redirect::route('wap.home');
}
return $next($request);
}
示例11: set_page_info
protected function set_page_info()
{
// sett opp side informasjon
$this->pagei = new pagei(pagei::TOTAL, $this->num_messages, pagei::ACTIVE_GET, "side", pagei::PER_PAGE, $this->per_page);
$this->limit = $this->pagei->per_page;
// har vi nye meldinger?
if ($this->thread->data_rel && $this->thread->data_rel['ir_unread'] > 0) {
$this->pagei->__construct(pagei::ACTIVE, 1);
$this->limit = max($this->limit, $this->thread->data_rel['ir_unread']);
} elseif (isset($_GET['goto'])) {
$im_id = intval(getval("goto"));
// forsøk å finn meldingen
$ant = $this->thread->message_locate($im_id);
if (!$ant) {
ess::$b->page->add_message("Fant ingen melding med ID {$im_id}.", "error");
redirect::handle();
}
// finn ut hvilken side vi skal til
$side = ceil($ant / $this->per_page);
// gå til korrekt side
if ($this->pagei->active != $side) {
redirect::handle("innboks_les?id={$this->thread->id}&goto={$im_id}&side={$side}");
}
$this->highlight_im_id = $im_id;
}
}
示例12: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(CreateBookRequest $request)
{
$user = \Auth::User();
if (!$user) {
return view('auth.login')->withErrors('You are not loged in, please loged in !');
}
$book = $request->bookFillData();
$book['user_id'] = $user->id;
$book['published_at'] = Carbon::parse($request->get('published_at'))->format('Y-m-d');
$fileSizeValidation = \Config::get('library.image_file_size');
$newBook = Book::create($book);
$newBook->syncAuthors($request->get('authors'));
$this->manager->createDirectory($newBook->id);
$file = $_FILES['image'];
if ($file['size'] > 0) {
// Additional image validation
if (!starts_with($file['type'], 'image/')) {
return Redirect::action('BookController@create')->withErrors('Invalid file format, please use image !');
}
$fileSize = $file['size'] / 1024;
if ($fileSize > $fileSizeValidation) {
return Redirect::action('BookController@create')->withErrors('The image may not be greater than ' . $fileSizeValidation . ' kilobytes. ');
}
$img = Image::make($_FILES['image']['tmp_name']);
$img->resize(140, 140);
$img->save('.' . \Config::get('library.uploads.webpath') . DIRECTORY_SEPARATOR . $newBook->id . '/cover.jpg');
}
return redirect::action('BookController@index')->withSuccess("The book with title '{$newBook->title}' was created.");
}
示例13: template
public function template($c, $page)
{
$conn = $this->conn($c);
$idx = Input::method("GET", "id");
if (!isset($_SESSION["greek_id"])) {
redirect::url(WEBSITE . LANG . "/userspage?docid=" . $idx);
}
$sql = 'SELECT `document` FROM `studio404_components_inside` WHERE `idx`=:idx AND `lang`=:lang';
$prepare = $conn->prepare($sql);
$prepare->execute(array(":idx" => $idx, ":lang" => LANG_ID));
if ($prepare->rowCount() > 0) {
$fetch = $prepare->fetch(PDO::FETCH_ASSOC);
$file = $fetch["document"];
if (file_exists($file)) {
$content = file_get_contents($file);
$name = time() . ".pdf";
header('Content-Type: application/pdf');
header('Content-Length: ' . strlen($content));
header('Content-disposition: inline; filename="' . $name . '"');
header('Cache-Control: public, must-revalidate, max-age=0');
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
// output content
echo $content;
} else {
redirect::url(WEBSITE . LANG . "/page404");
}
} else {
redirect::url(WEBSITE . LANG . "/page404");
}
}
示例14: transaksiSubmit
function transaksiSubmit()
{
$data = Input::all();
$schedule = Rentschedule::findRentschedule($data['RENT_SCHEDULE_ID'])->first();
unset($data['_token']);
$schedule_id = $data['RENT_SCHEDULE_ID'];
unset($data['RENT_SCHEDULE_ID']);
$costumer = $data;
$data['RENT_TRANSACTION_PRICE'] = $schedule['RENT_SCHEDULE_PRICE'];
unset($data['_token']);
$data['RENT_TRANSACTION_DATE'] = date('y-m-d');
$data['RENT_TRANSACTION_CREATEBY'] = Session::get('id');
unset($data['COSTUMER_EMAIL'], $data['COSTUMER_NAME'], $data['COSTUMER_TELP']);
$data['RENT_TRANSACTION_PRICE'] = Session::get('duration');
if (!is_null(Session::get('id')) and Session::get('hak') == 'COSTUMER') {
$data['MEMBER_ID'] = Session::get('id');
} else {
Costumer::insert($costumer);
$id = DB::getPdo()->lastInsertId();
$data['COSTUMER_ID'] = $id;
}
Renttransaction::insert($data);
$detail_transaksi = ['RENT_TRANSACTION_ID' => DB::getPdo()->lastInsertId(), 'RENT_SCHEDULE_ID' => $schedule_id];
Renttransactiondetail::insert($detail_transaksi);
return redirect::to('/');
}
示例15: main
public static function main()
{
$root_url = dirname($_SERVER['PHP_SELF']);
$method = Request::input('submit');
if (isset($method) && !empty($method)) {
$call_id = Request::input('id');
$comment = Request::input('comment');
$hashtag = Request::input('hashtag');
$input_customer_id = Request::input('customer_id');
$input_assigned_id = Request::input('assigned_id');
$id_all = Manage_callreport::getdata_id($input_customer_id, $input_assigned_id);
if (!empty($id_all["customer_id"]) && $id_all["customer_id"] != 0) {
$data = ["comment" => $comment, "hashtag" => $hashtag, "customer_id" => $id_all["customer_id"], "assigned_id" => $id_all["assigned_id"], "call_id" => $call_id];
if ($method == "add_call") {
if (Manage_callreport::add($data)) {
return redirect::to(".." . $root_url . '/call_report')->with('status', "บันทึกสำเร็จ");
} else {
return redirect::to(".." . $root_url . '/add_call_report')->withInput(Request::all())->withErrors("เกิดข้อผิดพลาด - ไม่สามารถบันทึกได้");
}
} else {
if ($method == "edit_call") {
if (Manage_callreport::edit($data)) {
return redirect::to(".." . $root_url . '/call_report')->with('status', "บันทึกสำเร็จ");
} else {
return redirect::to(".." . $root_url . '/edit_call_report')->withInput(Request::all())->withErrors("เกิดข้อผิดพลาด - ไม่สามารถบันทึกได้");
}
}
}
} else {
return redirect::to(".." . $root_url . '/add_call_report')->withInput(Request::all())->withErrors("เกิดข้อผิดพลาด - ไม่สามารถบันทึกได้");
}
} else {
return redirect::to(".." . $root_url . '/add_call_report')->withInput(Request::all())->withErrors("เกิดข้อผิดพลาด - ไม่สามารถบันทึกได้");
}
}