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


PHP Response::redirect_back方法代码示例

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


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

示例1: action_login

 public function action_login()
 {
     // Already logged in
     Auth::check() and Response::redirect('admin');
     $val = Validation::forge();
     if (Input::method() == 'POST') {
         $val->add('email', 'Email or Username')->add_rule('required');
         $val->add('password', 'Password')->add_rule('required');
         if ($val->run()) {
             if (!Auth::check()) {
                 if (Auth::login(Input::post('email'), Input::post('password'))) {
                     // assign the user id that lasted updated this record
                     foreach (\Auth::verified() as $driver) {
                         if (($id = $driver->get_user_id()) !== false) {
                             // credentials ok, go right in
                             $current_user = Model\Auth_User::find($id[1]);
                             Session::set_flash('success', e('Welcome, ' . $current_user->username));
                             Response::redirect_back('admin');
                         }
                     }
                 } else {
                     $this->template->set_global('login_error', 'Login failed!');
                 }
             } else {
                 $this->template->set_global('login_error', 'Already logged in!');
             }
         }
     }
     $this->template->title = 'ITNT Timesheets Login';
     $this->template->content = View::forge('admin/login', array('val' => $val), false);
 }
开发者ID:AfterCursor,项目名称:itnt-time-manager,代码行数:31,代码来源:admin.php

示例2: action_edit

 public function action_edit($id = null)
 {
     if ($customer = Model_Customer::find($id)) {
         $val = Model_Customer::validate('edit');
         if ($val->run()) {
             $customer->description = Input::post('description');
             $customer->contact_person = Input::post('contact_person');
             $customer->phone = Input::post('phone');
             $customer->email = Input::post('email');
             if ($customer->save()) {
                 Session::set_flash('success', e('Updated customer #' . $id));
                 Response::redirect('admin/customers/view/' . $customer->id);
             } else {
                 Session::set_flash('error', e('Could not update customer #' . $id));
             }
         } else {
             if (Input::method() == 'POST') {
                 $customer->description = $val->validated('description');
                 $customer->contact_person = $val->validated('contact_person');
                 $customer->phone = $val->validated('phone');
                 $customer->email = $val->validated('email');
                 Session::set_flash('error', $val->error());
             }
             $this->template->set_global('customer', $customer, false);
         }
         $this->template->title = "Customers » " . $customer->description . " » Edit";
         $this->template->content = View::forge('admin/customers/edit');
     } else {
         Session::set_flash('error', 'Cannot find the selected customer.');
         Response::redirect_back('admin/customers');
     }
 }
开发者ID:AfterCursor,项目名称:restaurant-pos-backend,代码行数:32,代码来源:customers.php

示例3: action_login

 public function action_login()
 {
     // already logged in?
     if (Auth::check()) {
         // yes, so go back to the page the user came from, or the
         // application dashboard if no previous page can be detected
         //Messages::info(__('login.already-logged-in'));
         Response::redirect_back('');
     }
     // was the login form posted?
     if (Input::method() == 'POST') {
         // check the credentials.
         print_r(Input::all());
         if (Auth::login(Input::param('email'), Input::param('password'))) {
             // did the user want to be remembered?
             if (Input::param('remember', false)) {
                 // create the remember-me cookie
                 Auth::remember_me();
             } else {
                 // delete the remember-me cookie if present
                 Auth::dont_remember_me();
             }
             // logged in, go back to the page the user came from, or the
             // application dashboard if no previous page can be detected
             Response::redirect_back('/home');
         } else {
             // login failed, show an error message
             $this->error = 'test';
         }
     }
     // display the login page
     return \View::forge('auth/login');
 }
开发者ID:Adriaan420,项目名称:Leertaak5,代码行数:33,代码来源:auth.php

示例4: action_index

 public function action_index()
 {
     $data = array();
     if (\Input::post()) {
         $username = \Input::post('username');
         $password = \Input::post('password');
         if (\Auth::login($username, $password)) {
             // does the user want to be remembered?
             if (\Input::post('remember_me')) {
                 // create the remember-me cookie
                 \Auth::remember_me();
             } else {
                 // delete the remember-me cookie if present
                 \Auth::dont_remember_me();
             }
             \Response::redirect_back('/');
         } else {
             // Oops, no soup for you. Try to login again. Set some values to
             // repopulate the username field and give some error text back to the view.
             $data['username'] = $username;
             \Session::set_flash('error', 'Wrong username/password combo. Try again');
         }
     }
     // Show the login form.
     $this->template->title = "Login";
     $this->template->content = \View::forge('auth/login.twig', $data);
 }
开发者ID:vano00,项目名称:jobs,代码行数:27,代码来源:auth.php

示例5: before

 public function before()
 {
     parent::before();
     // check for admin
     if (!Auth::member(5)) {
         \Response::redirect_back('home');
     }
 }
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:8,代码来源:admin.php

示例6: action_callback

 public function action_callback()
 {
     // Opauth can throw all kinds of nasty bits, so be prepared
     try {
         // get the Opauth object
         $opauth = \Auth_Opauth::forge(false);
         // and process the callback
         $status = $opauth->login_or_register();
         // fetch the provider name from the opauth response so we can display a message
         $provider = $opauth->get('auth.provider', '?');
         // deal with the result of the callback process
         switch ($status) {
             // a local user was logged-in, the provider has been linked to this user
             case 'linked':
                 // inform the user the link was succesfully made
                 \Messages::success(sprintf(__('login.provider-linked'), ucfirst($provider)));
                 // and set the redirect url for this status
                 $url = 'dashboard';
                 break;
                 // the provider was known and linked, the linked account as logged-in
             // the provider was known and linked, the linked account as logged-in
             case 'logged_in':
                 // inform the user the login using the provider was succesful
                 \Messages::success(sprintf(__('login.logged_in_using_provider'), ucfirst($provider)));
                 // and set the redirect url for this status
                 $url = 'dashboard';
                 break;
                 // we don't know this provider login, ask the user to create a local account first
             // we don't know this provider login, ask the user to create a local account first
             case 'register':
                 // inform the user the login using the provider was succesful, but we need a local account to continue
                 \Messages::info(sprintf(__('login.register-first'), ucfirst($provider)));
                 // and set the redirect url for this status
                 $url = 'user/register';
                 break;
                 // we didn't know this provider login, but enough info was returned to auto-register the user
             // we didn't know this provider login, but enough info was returned to auto-register the user
             case 'registered':
                 // inform the user the login using the provider was succesful, and we created a local account
                 \Messages::success(__('login.auto-registered'));
                 // and set the redirect url for this status
                 $url = 'dashboard';
                 break;
             default:
                 throw new \FuelException('Auth_Opauth::login_or_register() has come up with a result that we dont know how to handle.');
         }
         $url = str_replace('#_=_', '', $url);
         // redirect to the url set
         \Response::redirect($url);
     } catch (\OpauthException $e) {
         \Messages::error($e->getMessage());
         \Response::redirect_back();
     } catch (\OpauthCancelException $e) {
         // you should probably do something a bit more clean here...
         exit('It looks like you canceled your authorisation.' . \Html::anchor('users/oath/' . $provider, 'Click here') . ' to try again.');
     }
 }
开发者ID:ksakuntanak,项目名称:buffohero_cms,代码行数:57,代码来源:auth.php

示例7: action_remove

 public function action_remove($user_id)
 {
     // check for admin
     if (!Auth::member(5)) {
         \Response::redirect_back('home');
     }
     $user = Model_User::query()->where('id', $user_id)->get_one();
     $user->delete();
     Response::Redirect('users');
 }
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:10,代码来源:users.php

示例8: action_delete

 /**
  * Удаление записи
  * 
  * @param int $id
  */
 public function action_delete($id = null)
 {
     is_null($id) and \Response::redirect_back('admin/videos');
     if ($video = \Model_Video::find($id)) {
         $video->delete();
         \Session::set_flash('success', 'Видео удалено.');
     } else {
         \Session::set_flash('error', 'Could not delete video #' . $id);
     }
     \Response::redirect_back('admin/videos');
 }
开发者ID:alexmon1989,项目名称:fcssadon.ru,代码行数:16,代码来源:videos.php

示例9: action_delete

 public function action_delete($id = null)
 {
     $category = Model_Category::find($id);
     if ($category->delete()) {
         // Delete cache
         \Cache::delete('sidebar');
         \Messages::success(__('backend.category.deleted'));
     } else {
         \Messages::error(__('error'));
     }
     \Response::redirect_back(\Router::get('admin_category'));
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:12,代码来源:category.php

示例10: action_delete

 public function action_delete($id = null)
 {
     $post = \Model_Post::find($id);
     if ($post->delete()) {
         // Delete cache
         \Cache::delete('sidebar');
         \Messages::success(__('backend.post.deleted'));
     } else {
         \Messages::error(__('error'));
     }
     \Response::redirect_back(\Router::get('admin_post'));
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:12,代码来源:_post.php

示例11: action_logout

 public function action_logout()
 {
     // remove the remember-me cookie, we logged-out on purpose
     \Auth::dont_remember_me();
     // logout
     \Auth::logout();
     // inform the user the logout was successful
     \Messages::success(__('user.login.logged-out'));
     // and go back to where you came from (or the application
     // homepage if no previous page can be determined)
     \Response::redirect_back();
 }
开发者ID:wesleysaraujo,项目名称:fuelphp-blogMVC,代码行数:12,代码来源:user.php

示例12: action_edit

 /**
  * Редактирование пользователя
  * 
  * @param integer $id id пользователя
  */
 public function action_edit($id = null)
 {
     is_null($id) and \Response::redirect('admin/users');
     $user = \Model_User::find($id);
     if (!empty($user)) {
         if (\Input::method() == 'POST') {
             $val = \Model_User::validate('edit');
             // Если ихменили E-Mail
             if (\Input::post('email') != $user->email) {
                 $val->add_callable(new \MyRules());
                 $val->add_field('email', 'E-Mail', 'required|max_length[255]|unique[users.email]');
                 $val->set_message('unique', 'E-Mail существует.');
             }
             if ($val->run()) {
                 try {
                     // Сбрасіваем пароль
                     $new_password = \Auth::reset_password($user->username);
                     $arr = array('email' => \Input::post('email'));
                     if (trim(\Input::post('password') != '')) {
                         $arr['old_password'] = $new_password;
                         $arr['password'] = \Input::post('password');
                     }
                     $updated = \Auth::update_user($arr, $user->username);
                     if ($updated) {
                         \Session::set_flash('success', e('Пользователь отредактирован'));
                         \Response::redirect_back('admin/users');
                     } else {
                         // oops, creating a new user failed?
                         \Session::set_flash('error', e('Не удалось отредактировать данные пользователя'));
                     }
                 } catch (\SimpleUserUpdateException $e) {
                     // Повтор е-мэил
                     if ($e->getCode() == 2) {
                         \Session::set_flash('error', e('E-Mail существует'));
                     } else {
                         \Session::set_flash('error', $e->getMessage());
                     }
                 }
             } else {
                 \Session::set_flash('error', $val->error());
             }
         }
         \View::set_global('user', $user, FALSE);
         $this->template->title = 'Пользователи';
         $this->template->content = \View::forge('users/edit');
     } else {
         \Session::set_flash('error', e('Пользователь отсутствует'));
         \Response::redirect('admin/users');
     }
 }
开发者ID:alexmon1989,项目名称:fcssadon.ru,代码行数:55,代码来源:users.php

示例13: action_show_by_author

 /**
  * Get all categorys from author
  * @param  string $author username
  */
 public function action_show_by_author($author = false)
 {
     $author = $this->data['author'] = \Model_User::query()->where('username', $author)->get_one();
     if (!$author) {
         \Messages::error(__('frontend.author.not-found'));
         \Response::redirect_back(\Router::get('homepage'));
     } else {
         // Pagination
         $config = array('pagination_url' => \Uri::current(), 'total_items' => count($author->posts), 'per_page' => \Config::get('application.pagination.per_page'), 'uri_segment' => 'page');
         $this->data['pagination'] = $pagination = \Pagination::forge('category_pagination', $config);
         // Get categorys
         $this->data['categories'] = Model_Category::query()->where('user_id', $author->id)->order_by('created_at', 'DESC')->offset($pagination->offset)->limit($pagination->per_page)->get();
         return \Response::forge(\View::forge('frontend/category/author')->set($this->data, null, false));
     }
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:19,代码来源:category.php

示例14: action_index

 /**
  * Действие для управления настройками
  */
 public function action_index()
 {
     $settings = \Model_Striker::find('first');
     $seasons = \Model_Season::get_seasons_for_select();
     if (\Input::method() == 'POST') {
         $settings->show = \Input::post('show', 0);
         $settings->season_id = \Input::post('season_id');
         $settings->save();
         \Session::set_flash('success', 'Настройки обновлены.');
         \Response::redirect_back('admin/competitions/strikers');
     }
     \View::set_global('seasons', $seasons);
     \View::set_global('settings', $settings);
     $this->template->content = \View::forge('competitions/strikers/index', array('settings' => $settings));
 }
开发者ID:alexmon1989,项目名称:fcssadon.ru,代码行数:18,代码来源:strikers.php

示例15: action_url

 public function action_url($table_name)
 {
     // Find class name and metadata etc
     $class_name = \Admin::getClassForTable($table_name);
     if ($class_name === false) {
         return $this->show404(null, "type");
     }
     // Import the data
     $this->import_result = \CMF\Utils\Importer::importUrl($class_name, \Input::post('import_url'));
     // If success, redirect back with message
     if (isset($this->import_result['success']) && $this->import_result['success']) {
         \Session::set_flash('main_alert', array('attributes' => array('class' => 'alert-success'), 'msg' => isset($this->import_result['message']) ? $this->import_result['message'] : \Lang::get('admin.messages.import_success')));
         \Response::redirect("/admin/{$table_name}", 'location');
     }
     // No success, damn!
     \Session::set_flash('main_alert', array('attributes' => array('class' => 'alert-danger'), 'msg' => isset($this->import_result['message']) ? $this->import_result['message'] : \Lang::get('admin.errors.actions.import')));
     \Response::redirect_back("/admin/{$table_name}");
 }
开发者ID:soundintheory,项目名称:fuel-cmf,代码行数:18,代码来源:import.php


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