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


PHP BaseController::redirect方法代码示例

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


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

示例1: loginAction

 /**
  * user login
  */
 public function loginAction()
 {
     parent::render('signin');
     if (isset($_POST['login'])) {
         $_SESSION['user'] = $_POST['user_id'];
         $user = new UserModel();
         if ($user->checkUser() === true) {
             parent::redirect("user", "userPage");
         } else {
             return $user->afterUnsuccessfulLogin();
         }
     }
 }
开发者ID:kapsi44,项目名称:Gangouts,代码行数:16,代码来源:UserController.php

示例2: control_alterar_senha

 public function control_alterar_senha()
 {
     $user = $this->getUsuario();
     if ($this->app->isPostRequest) {
         try {
             if (false == UserHelper::password_verify($_POST['senha'], $user->getSenha())) {
                 $this->app->adicionarMensagemErro('A senha informada é inválida');
                 return $this->app->redirect('projetos/alterar-senha');
             }
             if ($_POST['senha_nova'] != $_POST['senha_confirmacao']) {
                 $this->app->adicionarMensagemErro('A senha e a confirmação da senha são diferentes');
                 return $this->app->redirect('projetos/alterar-senha');
             }
             $user->setSenha($_POST['senha_nova']);
             $this->app->em->persist($user);
             $this->app->em->flush();
             $this->app->adicionarMensagemSucesso('Sua senha foi atualizada com sucesso');
         } catch (Exception $e) {
             $this->app->adicionarMensagemErro('Ocorreu um erro e sua senha não foi alterada');
         }
     }
     return $this->app->renderizar('projetos/alterar-senha');
 }
开发者ID:umbernardo,项目名称:banco_projetos,代码行数:23,代码来源:ProjetosController.php

示例3: loginAction

 /**
  *@return void 
  *Admin Login 
  */
 public function loginAction()
 {
     parent::render('admin');
     if (isset($_POST['submit'])) {
         session_start();
         $_SESSION['admin'] = $_POST['adminId'];
         echo $_SESSION['admin'];
         $adm = new AdminModel();
         if ($adm->checkAdmin() === true) {
             parent::redirect("Admin", "access");
         } else {
             echo "<h2 style='color:red'>Wrong Credentials</h2>";
         }
     }
 }
开发者ID:kapsi44,项目名称:Gangouts,代码行数:19,代码来源:AdminController.php

示例4: searchAction

 /**
  * Execute the "search" based on the criteria sent from the "index"
  * Returning a paginator for the results
  */
 public function searchAction($id)
 {
     if (!parent::isValidId($id)) {
         parent::redirect('ping');
     }
     $builder = $this->createSearchBuilder();
     $builder->where('ping.id = ' . $id);
     $ping = $builder->getQuery()->getSingleResult();
     if ($ping) {
         $this->view->ping = $ping;
     } else {
         $this->flash->error('Identifier not found.');
         return parent::redirect('ping');
     }
     #$this->view->disable();
 }
开发者ID:sweetdevel,项目名称:pingaroo,代码行数:20,代码来源:PingController.php

示例5: deleteAction

 /**
  * Deletes an existing product
  */
 public function deleteAction($id)
 {
     if (!parent::isValidId($id)) {
         return parent::redirect('country');
     }
     $manager = new TransactionManager();
     $transaction = $manager->get();
     try {
         $proxy = Proxy::findFirst($id);
         if ($proxy) {
             $proxy->setTransaction($transaction);
             $pings = $proxy->getPing();
             foreach ($pings as $ping) {
                 $ping->setTransaction($transaction);
                 $ping->delete();
             }
             $proxy->delete();
             $this->flash->success('Proxy deleted succesfully.');
             $transaction->commit();
         } else {
             $this->flash->notice('Proxy not found, operation aborted.');
         }
     } catch (\Exception $ex) {
         $this->flash->error('Error deleting proxy.');
         $transaction->rollback();
     }
     return $this->redirect('proxy');
 }
开发者ID:sweetdevel,项目名称:pingaroo,代码行数:31,代码来源:ProxyController.php

示例6: deleteAction

 /**
  * Deletes an existing product
  */
 public function deleteAction($id)
 {
     if (!parent::isValidId($id)) {
         return parent::redirect('url');
     }
     $manager = new TransactionManager();
     $transaction = $manager->get();
     try {
         $url = Url::findFirst($id);
         if ($url) {
             $url->setTransaction($transaction);
             $batches = $url->getBatch();
             foreach ($batches as $batch) {
                 $batch->setTransaction($transaction);
                 $pings = $batch->getPing();
                 foreach ($pings as $ping) {
                     $ping->setTransaction($transaction);
                     $ping->delete();
                 }
                 $batch->delete();
             }
             $url->delete();
             $this->flash->success('Url deleted succesfully.');
             $transaction->commit();
         } else {
             $this->flash->notice('Url not found, operation aborted.');
         }
     } catch (\Exception $ex) {
         $this->flash->error('Error deleting url.');
         $transaction->rollback($ex->getMessage());
     }
     return $this->redirect('url');
 }
开发者ID:sweetdevel,项目名称:pingaroo,代码行数:36,代码来源:UrlController.php

示例7: reloadAction

 public function reloadAction($id)
 {
     if (!parent::isValidId($id)) {
         $returnArg = '';
     } else {
         $batch = Batch::findFirst($id);
         if (!$batch) {
             $this->flash->error('Batch not found');
             $returnArg = '';
         } else {
             BatchHelper::reload($this->config, $batch);
             $returnArg = '?batchId=' . $id;
             $this->flash->success('Reloading pings...');
         }
     }
     return parent::redirect('batch' . $returnArg);
 }
开发者ID:sweetdevel,项目名称:pingaroo,代码行数:17,代码来源:BatchController.php


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