当前位置: 首页>>代码示例>>PHP>>正文


PHP HTTP::redirect方法代码示例

本文整理汇总了PHP中HTTP::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTP::redirect方法的具体用法?PHP HTTP::redirect怎么用?PHP HTTP::redirect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTTP的用法示例。


在下文中一共展示了HTTP::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_result

 public function action_result()
 {
     $data = array();
     if ($_POST) {
         $id_brand = arr::get($_POST, 'id_brand');
         $id_model = arr::get($_POST, 'id_model');
         $id_series = arr::get($_POST, 'series');
         $year = arr::get($_POST, 'year');
         $to_number = arr::get($_POST, 'to_number');
         $millage_val = arr::get($_POST, 'millage_val');
         //$brands = ORM::factory('labor')->find_all();
         $brand = ORM::factory('brand', $id_brand)->name;
         $model = ORM::factory('model', $id_model)->name;
         $series = ORM::factory('series', $id_series)->as_array();
         $price = ORM::factory('price');
         $modification = new Model_Modification();
         $result = $modification->getModification($year, $id_series, $to_number);
         $labors = new Model_Labor();
         foreach ($result as $mod) {
             $labors_val[$mod['id']] = $labors->getLabors($mod['id'], $to_number)->as_array();
         }
         $calc_view = View::factory('forms/form.calculator')->set('id_brand', $id_brand)->set('id_model', $id_model)->set('id_series', $id_series)->set('year', $year)->set('millage_val', $millage_val)->set('modification', $result)->set('test', $modification)->set('to_number', $to_number);
         $this->template->content = View::factory('calculator.result')->set('brand', $brand)->set('model', $model)->set('year', $year)->set('series', $series)->set('millage_val', $millage_val)->set('modification', $result)->set('to_number', $to_number)->set('labors', $labors_val)->set('price', $price)->set('calculator_form', $calc_view->render());
     } else {
         HTTP::redirect('calculator');
     }
 }
开发者ID:redeggplant,项目名称:avtok,代码行数:27,代码来源:calculator.php

示例2: do_login

 protected function do_login()
 {
     if ($this->request->is_ajax() && $_POST) {
         $this->do_auth();
     }
     $this->template->set_layout('layout/admin/login');
     $this->template->email = '';
     $this->template->remember = false;
     $this->template->error = '';
     $this->template->return = arr::get($_GET, 'return', arr::get($_POST, 'return', FALSE));
     if (isset($_POST['login'])) {
         $email = $_POST['email'];
         $password = $_POST['password'];
         $remember = $_POST['remember'];
         $this->template->email = $email;
         $this->template->remember = $remember;
         if (Auth::instance()->login($email, $password, (bool) $remember)) {
             if ($this->template->return) {
                 HTTP::redirect($this->template->return);
             } else {
                 return TRUE;
             }
         }
         if (Auth::instance()->is_banned()) {
             $banned_to = Auth::instance()->get_banned_to();
             $this->template->error = 'Аккаунт заблокирован до ' . date('Y-m-d H:i', $banned_to) . ' (до разблокировки ' . ceil(($banned_to - time()) / 3600) . ' ч ' . date('i мин', $banned_to - time()) . ')';
         } else {
             $this->template->error = 'Неверные e-mail или пароль';
         }
         return FALSE;
     }
 }
开发者ID:ariol,项目名称:adminshop,代码行数:32,代码来源:Base.php

示例3: action_eliminar

 public function action_eliminar()
 {
     $contra = $_GET['contra'];
     $estadoprocesos = ORM::factory('estadoprocesos', $contra);
     $estadoprocesos->delete();
     HTTP::redirect('estadoprocesos');
 }
开发者ID:sysdevbol,项目名称:entidad,代码行数:7,代码来源:estadoprocesos.php

示例4: on_auth_error

 protected function on_auth_error()
 {
     if (!is_null($this->_login_route) and !Auth::instance()->logged_in()) {
         HTTP::redirect(Extasy_Url::url_to_route($this->_login_route) . '?return=' . $this->request->uri());
     }
     $this->forward_403();
 }
开发者ID:ariol,项目名称:adminshop,代码行数:7,代码来源:Auth.php

示例5: before

 public function before()
 {
     parent::before();
     if (!Auth::instance()->get_user()) {
         HTTP::redirect('Auth');
     }
 }
开发者ID:alex-bro,项目名称:olgabro.repo,代码行数:7,代码来源:Myadmincontroller.php

示例6: action_logout

 /**
  *
  */
 public function action_logout()
 {
     if (!\Registry::getCurrentUser()->isGuest()) {
         \Auth\Base::destroy();
     }
     \HTTP::redirect(\Route::get('SystemRoute')->uri(['controller' => 'Main', 'action' => 'Login']), 302);
 }
开发者ID:astar3086,项目名称:studio_logistic,代码行数:10,代码来源:Main.php

示例7: action_index

 public function action_index()
 {
     $category = new Model_Category('tree');
     $data['categories'] = $category->getTree();
     if (isset($_POST['btnsubmit'])) {
         $categoryName = Arr::get($_POST, 'categoryName', '');
         $parentId = Arr::get($_POST, 'parentId', '');
         $url = Arr::get($_POST, 'url', '');
         $categoryimage = Arr::get($_POST, 'categoryimage', '');
         $res = $category->catInsert($parentId, array('name' => $categoryName, 'url' => $url, 'icon_url' => $categoryimage));
         if ($res) {
             //Request::initial()->redirect('admin');
             HTTP::redirect('admin');
         } else {
             $data['errors'] = $category->getErrors();
         }
     }
     if (isset($_POST['materialsavebtn'])) {
         $categoryId = Arr::get($_POST, 'categoryId', '');
         $content = Arr::get($_POST, 'content', '');
         $name = Arr::get($_POST, 'name');
         $material_image = Arr::get($_POST, 'material_image');
         $material = ORM::factory('Material');
         $material->addMaterial($categoryId, $content, $name, $material_image);
         HTTP::redirect('admin');
     }
     $this->template->content = View::factory('adminview', $data);
 }
开发者ID:robotkos,项目名称:kohana-book-catalog,代码行数:28,代码来源:Main.php

示例8: action_create

 public function action_create()
 {
     // Enter a new user manually
     $user = ORM::factory('User');
     $user->username = $this->request->post('username');
     $user->password = $this->request->post('password');
     $user->email = $this->request->post('email');
     try {
         $user->save();
         $user->add('roles', ORM::factory('Role')->where('name', '=', $this->request->post('role'))->find());
     } catch (ORM_Validation_Exception $e) {
         $errors = $e->errors();
     }
     if (isset($errors)) {
         // $this->response->body(var_dump($errors));
         HTTP::redirect('/');
     } else {
         // Login with this user
         $success = Auth::instance()->login($this->request->post('username'), $this->request->post('password'));
         if ($success) {
             HTTP::redirect('/');
         } else {
             HTTP::redirect('/login');
         }
     }
 }
开发者ID:ametsuramet,项目名称:belajar_kohana,代码行数:26,代码来源:User.php

示例9: on_page_load

 public function on_page_load()
 {
     $email_ctx_id = $this->get('email_id_ctx', 'email');
     $email = $this->_ctx->get($email_ctx_id);
     $referrer_page = Request::current()->referrer();
     $next_page = $this->get('next_url', Request::current()->referrer());
     if (!Valid::email($email)) {
         Messages::errors(__('Use a valid e-mail address.'));
         HTTP::redirect($referrer_page);
     }
     $user = ORM::factory('user', array('email' => $email));
     if (!$user->loaded()) {
         Messages::errors(__('No user found!'));
         HTTP::redirect($referrer_page);
     }
     $reflink = ORM::factory('user_reflink')->generate($user, 'forgot', array('next_url' => URL::site($this->next_url, TRUE)));
     if (!$reflink) {
         Messages::errors(__('Reflink generate error'));
         HTTP::redirect($referrer_page);
     }
     Observer::notify('admin_login_forgot_before', $user);
     try {
         Email_Type::get('user_request_password')->send(array('username' => $user->username, 'email' => $user->email, 'reflink' => Route::url('reflink', array('code' => $reflink)), 'code' => $reflink));
         Messages::success(__('Email with reflink send to address set in your profile'));
     } catch (Exception $e) {
         Messages::error(__('Something went wrong'));
     }
     HTTP::redirect($next_page);
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:29,代码来源:forgot.php

示例10: bounceToLogin

 public static function bounceToLogin()
 {
     if ($_SERVER['REQUEST_METHOD'] != 'GET') {
         throw new \Exception('not logged in');
     }
     HTTP::redirect('login?return=' . urlencode(Env::get('request_url')));
 }
开发者ID:fierce,项目名称:fierce,代码行数:7,代码来源:Auth.php

示例11: action_edit

 /**
  * Edit
  */
 public function action_edit()
 {
     $this->title = __('home.page_edit');
     // Fields for save
     $for_extract = ['text', 'meta_t', 'meta_d', 'meta_k'];
     $config = Config::get('home');
     $data = Arr::extract($_POST, $for_extract);
     if ($this->request->is_post()) {
         $data = Validation::factory(array_map('trim', $data))->rule('meta_t', 'not_empty')->rule('meta_d', 'not_empty')->rule('meta_k', 'not_empty');
         if ($data->check()) {
             foreach ($for_extract as $field) {
                 $config[$field] = $data[$field];
             }
             $config->save();
             Message::success(__('settings.changes_saved'));
             HTTP::redirect(Route::url('b_home'));
         } else {
             Message::error(__('settings.error_saving'));
             $errors = $data->errors('validation');
         }
     } else {
         $data = $config;
     }
     $this->content = View::factory($this->view, ['data' => $data])->bind('errors', $errors);
 }
开发者ID:eok8177,项目名称:shopCMS,代码行数:28,代码来源:Page.php

示例12: action_update

 /**
  * Update new forum
  */
 public function action_update()
 {
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit Topic')));
     $topic = new Model_Topic($this->request->param('id'));
     $get_all = Model_Forum::get_all();
     //get all forums to build forum parents in select
     $forum_parents = array();
     foreach ($get_all[0] as $parent) {
         $forum_parents[$parent['id']] = $parent['name'];
     }
     $this->template->content = View::factory('oc-panel/pages/forum/topic', array('topic' => $topic, 'forum_parents' => $forum_parents));
     if ($_POST) {
         $topic->title = core::post('title');
         $topic->id_forum = core::post('id_forum');
         $topic->description = core::post('description');
         if (core::post('seotitle') != $topic->seotitle) {
             $topic->seotitle = $topic->gen_seotitle(core::post('seotitle'));
         }
         if (core::post('status') == 'on') {
             $topic->status = 1;
         } else {
             $topic->status = 0;
         }
         try {
             $topic->save();
             Alert::set(Alert::SUCCESS, __('Topic is updated.'));
         } catch (Exception $e) {
             Alert::set(Alert::ERROR, $e->getMessage());
         }
         HTTP::redirect(Route::url('oc-panel', array('controller' => 'topic', 'action' => 'index')));
     }
 }
开发者ID:JeffPedro,项目名称:project-garage-sale,代码行数:35,代码来源:topic.php

示例13: index_action

 public function index_action()
 {
     if (is_digits($_GET['id'])) {
         $feature_info = $this->model('feature')->get_feature_by_id($_GET['id']);
     } else {
         $feature_info = $this->model('feature')->get_feature_by_url_token($_GET['id']);
     }
     if (!$feature_info) {
         header('HTTP/1.1 404 Not Found');
         H::redirect_msg(AWS_APP::lang()->_t('专题不存在'), '/');
     }
     if (!$feature_info['enabled']) {
         H::redirect_msg(AWS_APP::lang()->_t('专题未启用'), '/');
     }
     if ($feature_info['url_token'] != $_GET['id'] and !$_GET['sort_type'] and !$_GET['is_recommend']) {
         HTTP::redirect('/feature/' . $feature_info['url_token']);
     }
     if (!($topic_list = $this->model('topic')->get_topics_by_ids($this->model('feature')->get_topics_by_feature_id($feature_info['id'])))) {
         H::redirect_msg(AWS_APP::lang()->_t('专题下必须包含一个以上话题'), '/');
     }
     if ($feature_info['seo_title']) {
         TPL::assign('page_title', $feature_info['seo_title']);
     } else {
         $this->crumb($feature_info['title'], '/feature/' . $feature_info['url_token']);
     }
     TPL::assign('sidebar_hot_topics', $topic_list);
     TPL::assign('feature_info', $feature_info);
     TPL::import_js('js/app/feature.js');
     TPL::output('feature/detail');
 }
开发者ID:Gradven,项目名称:what3.1.7,代码行数:30,代码来源:main.php

示例14: action_buy

 /**
  * [action_buy] Pay for ad, and set new order 
  *
  */
 public function action_buy()
 {
     if (Core::config('general.subscriptions') == FALSE) {
         throw HTTP_Exception::factory(404, __('Page not found'));
     }
     //getting the user that wants to buy now
     if (!Auth::instance()->logged_in()) {
         Alert::set(Alert::INFO, __('To buy this product you need to register first.'));
         $this->redirect(Route::url('oc-panel'));
     }
     //check plan exists
     $plan = new Model_Plan();
     $plan->where('seoname', '=', $this->request->param('id'))->where('status', '=', 1)->find();
     //loaded published and with stock if we control the stock.
     if ($plan->loaded() and $plan->status == 1) {
         //free plan can not be renewed
         if ($plan->price == 0 and $this->user->subscription()->id_plan == $plan->id_plan) {
             Alert::set(Alert::WARNING, __('Free plan can not be renewed, before expired'));
             HTTP::redirect(Route::url('pricing'));
         }
         $order = Model_Order::new_order(NULL, $this->user, $plan->id_plan, $plan->price, core::config('payment.paypal_currency'), __('Subscription to ') . $plan->name);
         //free plan no checkout
         if ($plan->price == 0) {
             $order->confirm_payment('cash');
             $this->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'orders')));
         } else {
             $this->redirect(Route::url('default', array('controller' => 'plan', 'action' => 'checkout', 'id' => $order->id_order)));
         }
     } else {
         throw HTTP_Exception::factory(404, __('Page not found'));
     }
 }
开发者ID:johnulist,项目名称:openclassifieds2,代码行数:36,代码来源:plan.php

示例15: action_edit

 /**
  * Basic
  */
 public function action_edit()
 {
     $this->title = __('settings.settings_general');
     // Fields for save
     $for_extract = ['per_page_frontend', 'per_page_backend', 'sitename', 'siteslogan', 'copyright', 'year_creation_site', 'type_backend_menu'];
     $config = Config::get('settings');
     $data = Arr::extract($_POST, $for_extract);
     if ($this->request->is_post()) {
         $data = Validation::factory(array_map('trim', $data))->rules('per_page_frontend', [['not_empty'], ['digit']])->rules('per_page_backend', [['not_empty'], ['digit']])->rules('year_creation_site', [['not_empty'], ['digit']])->rule('sitename', 'not_empty');
         if ($data->check()) {
             foreach ($for_extract as $field) {
                 $config[$field] = $data[$field];
             }
             $config->save();
             Message::success(__('settings.changes_saved'));
             HTTP::redirect(Route::url('b_settings'));
         } else {
             Message::error(__('settings.error_saving'));
             $errors = $data->errors('validation');
         }
     } else {
         $data = $config;
     }
     $this->content = View::factory($this->view, ['data' => $data])->bind('errors', $errors);
 }
开发者ID:eok8177,项目名称:shopCMS,代码行数:28,代码来源:Page.php


注:本文中的HTTP::redirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。