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


PHP Http::redirectTo方法代码示例

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


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

示例1: httpPostMethod

 public function httpPostMethod(Http $http, array $formFields)
 {
     /*
      * Méthode appelée en cas de requête HTTP POST
      *
      * L'argument $http est un objet permettant de faire des redirections etc.
      * L'argument $formFields contient l'équivalent de $_POST en PHP natif.
      */
     $userSession = new UserSession();
     if ($userSession->isAdminAuthenticated() == false) {
         $http->redirectTo('/');
     }
     //var_dump($formFields);
     //var_dump($_FILES);
     if (array_key_exists('Modification', $formFields)) {
         if ($http->hasUploadedFile('Photo')) {
             $pathinfo = $http->moveUploadedFile('Photo', '/images/meals');
             var_dump($pathinfo);
             $mealModel = new MealModel();
             $mealModel->modifyPicture($pathinfo, $formFields['Id']);
         }
         $mealModel = new MealModel();
         $result = $mealModel->modifyMeal($formFields['Name'], $formFields['Description'], $formFields['QuantityInStock'], $formFields['BuyPrice'], $formFields['SalePrice'], $formFields['Id']);
         $http->redirectTo('/Admin/List');
     } elseif (ctype_digit($formFields['meal_Id'])) {
         $mealModel = new MealModel();
         $meal = $mealModel->find($formFields['meal_Id']);
         return ['meal' => $meal];
     }
 }
开发者ID:paolocl,项目名称:ChezPaolo,代码行数:30,代码来源:ModificationController.class.php

示例2: httpPostMethod

 public function httpPostMethod(Http $http, array $formFields)
 {
     /*
      * Méthode appelée en cas de requête HTTP POST
      *
      * L'argument $http est un objet permettant de faire des redirections etc.
      * L'argument $formFields contient l'équivalent de $_POST en PHP natif.
      */
     try {
         $Customer = new CustomerModel();
         $verifEmail = $Customer->sameMail($formFields['Email']);
         if ($verifEmail && ctype_digit($formFields['Year']) && ctype_digit($formFields['Month']) && ctype_digit($formFields['Day']) && ctype_digit($formFields['Phone']) && strlen($formFields['Phone']) === 10 && ctype_digit($formFields['ZipCode']) && strlen($formFields['ZipCode']) === 5 && isset($formFields['password']) && $formFields['password2'] == $formFields['password'] && isset($formFields['Email']) && filter_var($formFields['Email'], FILTER_VALIDATE_EMAIL) != false) {
             $Birthdate = $formFields['Year'] . '-' . $formFields['Month'] . '-' . $formFields['Day'];
             //var_dump($Birthdate);
             $Customer_id = $Customer->registerCustomer($formFields['FirstName'], $formFields['LastName'], $Birthdate, $formFields['Phone'], $formFields['Address'], $formFields['Address2'], $formFields['City'], $formFields['ZipCode'], $formFields['Email'], $formFields['password']);
             //var_dump($Customer_id);
             $user = $Customer->findCustomer($Customer_id);
             $UserSession = new UserSession();
             $UserSession->create($user);
             $http->redirectTo('');
         } else {
             $http->redirectTo('Exception?Error=3');
         }
     } catch (DomainException $event) {
         $form = new RegisterForm();
         $form->bind($formFields);
         $form->setErrorMessage($event->getMessage());
         return ['_form' => $form];
     }
 }
开发者ID:paolocl,项目名称:ChezPaolo,代码行数:30,代码来源:UserController.class.php

示例3: httpPostMethod

 public function httpPostMethod(Http $http, array $formFields)
 {
     /*
      * Méthode appelée en cas de requête HTTP POST
      *
      * L'argument $http est un objet permettant de faire des redirections etc.
      * L'argument $formFields contient l'équivalent de $_POST en PHP natif.
      */
     /*var_dump($formFields['bookingDate']);
     		var_dump($date);
     		var_dump($date > $formFields['bookingDate']);
     		
     		die();*/
     $date = new DateTime();
     $userSession = new UserSession();
     $bookingModel = new BookingModel();
     $customerId = intval($userSession->getId());
     if ($userSession->isAuthenticated()) {
         $customerId = intval($userSession->getId());
         $checkBookingById = $bookingModel->checkBookingById($customerId, intval($formFields['bookingId']), $formFields['bookingDate']);
         if (ctype_digit($formFields['bookingId']) && $date < new DateTime($formFields['bookingDate']) && $checkBookingById) {
             $bookingModel->DeletBooking($formFields['bookingId']);
             $flashBag = new FlashBag();
             $flashBag->add('Réservation ' . $formFields["bookingId"] . ' bien supprimée');
             $http->redirectTo('/');
         }
         $flashBag = new FlashBag();
         $flashBag->add('Problème lors de la suppression de la réservation (Vous ne pouvez supprimer des réservations posterieur à aujourd\'hui)');
         $http->redirectTo('/Booking');
     }
 }
开发者ID:paolocl,项目名称:ChezPaolo,代码行数:31,代码来源:SupbookingController.class.php

示例4: httpPostMethod

 public function httpPostMethod(Http $http, array $formFields)
 {
     /*
      * Méthode appelée en cas de requête HTTP POST
      *
      * L'argument $http est un objet permettant de faire des redirections etc.
      * L'argument $formFields contient l'équivalent de $_POST en PHP natif.
      */
     $Customer = new CustomerModel();
     $verifEmail = $Customer->sameMail($formFields['Email']);
     //var_dump(strlen($_POST['Phone']));
     //var_dump(strlen($_POST['ZipCode']));
     if ($verifEmail['result'] === '0' && ctype_digit($formFields['Year']) && ctype_digit($formFields['Month']) && ctype_digit($formFields['Day']) && ctype_digit($formFields['Phone']) && strlen($formFields['Phone']) === 10 && ctype_digit($formFields['ZipCode']) && strlen($formFields['ZipCode']) === 5 && isset($formFields['password']) && isset($formFields['Email']) && filter_var($formFields['Email'], FILTER_VALIDATE_EMAIL) != false) {
         $password = password_hash($formFields['password'], PASSWORD_DEFAULT);
         //var_dump($password);
         $Birthdate = $formFields['Year'] . '-' . $formFields['Month'] . '-' . $formFields['Day'];
         //var_dump($Birthdate);
         $Customer_id = $Customer->registerCustomer($formFields['FirstName'], $formFields['LastName'], $Birthdate, $formFields['Phone'], $formFields['Address'], $formFields['Address2'], $formFields['City'], $formFields['ZipCode'], $formFields['Email'], $formFields['password']);
         //var_dump($Customer_id);
         $user = $Customer->findCustomer($Customer_id);
         $UserSession = new UserSession();
         $UserSession->create($user);
         $http->redirectTo('');
     } elseif ($verifEmail != '0') {
         $http->redirectTo('Exception?Error=3');
     }
 }
开发者ID:annacrea,项目名称:ChezPaolo,代码行数:27,代码来源:UserController.class.php

示例5: httpGetMethod

 public function httpGetMethod(Http $http, array $queryFields)
 {
     /*
      * Méthode appelée en cas de requête HTTP GET
      *
      * L'argument $http est un objet permettant de faire des redirections etc.
      * L'argument $queryFields contient l'équivalent de $_GET en PHP natif.
      */
     //var_dump(intval($queryFields['produit_id']));
     if (array_key_exists('produit_id', $queryFields)) {
         if (ctype_digit($queryFields['produit_id'])) {
             $meal = new MealModel();
             $listMeal = $meal->find(intval($queryFields['produit_id']));
             if ($listMeal) {
                 return ['listMeal' => $listMeal];
             } else {
                 $http->redirectTo('Exception?Error=1');
             }
         } else {
             $http->redirectTo('Exception?Error=2');
         }
     } else {
         $http->redirectTo('Exception?Error=2');
         //'On ne hack pas mon site !!!!!!!!!!!!!!!!', 'Image' => 'http://iletaitungeek.com/wp-content/uploads/2015/08/dark-vador-aura-sa-ps4-collector-une.jpg'];
     }
 }
开发者ID:paolocl,项目名称:ChezPaolo,代码行数:26,代码来源:MealController.class.php

示例6: httpPostMethod

 public function httpPostMethod(Http $http, array $formFields)
 {
     /*
      * Méthode appelée en cas de requête HTTP POST
      *
      * L'argument $http est un objet permettant de faire des redirections etc.
      * L'argument $formFields contient l'équivalent de $_POST en PHP natif.
      */
     $userSession = new UserSession();
     if ($userSession->isAuthenticated() == false) {
         $http->redirectTo('/User/Login');
     }
     //TODO : API BANCAIRE
     $http->redirectTo('/Order/Payment/Success');
 }
开发者ID:paolocl,项目名称:ChezPaolo,代码行数:15,代码来源:PaymentController.class.php

示例7: httpPostMethod

 public function httpPostMethod(Http $http, array $formFields)
 {
     /*
      * Méthode appelée en cas de requête HTTP POST
      *
      * L'argument $http est un objet permettant de faire des redirections etc.
      * L'argument $formFields contient l'équivalent de $_POST en PHP natif.
      */
     /*$date = new DateModel();
     		var_dump($date->testDate($formFields['dateResa'])); //0 FAUX - 1 VRAI REJEX */
     $userSession = new UserSession();
     if ($userSession->isAuthenticated()) {
         $dateTime = date_create($formFields['dateResa'] . ' ' . $formFields['timeResa']);
         $now = new DateTime("now");
         $resaDate = date_format($dateTime, 'Y-m-d');
         $resaTime = date_format($dateTime, 'H:i:s');
         //var_dump($formFields);
         if (!empty($formFields['dateResa']) && !empty($formFields['timeResa']) && !empty($formFields['NumberOfSeats']) && $dateTime > $now && ctype_digit($formFields['NumberOfSeats'])) {
             $userId = $userSession->getId();
             $Booking = new BookingModel();
             $resultat = $Booking->register($userId, $resaDate, $resaTime, $formFields['NumberOfSeats']);
             return ['resultat' => $resultat];
         } elseif ($dateTime < $now) {
             return ['Error' => 'Nous ne pouvons vous réserver une table pour une date antérieur à aujourd\'hui'];
         } else {
             return ['Error' => 'Un champ n\'a pas était remplie correctement'];
         }
     } else {
         echo 'lu';
         die;
         $http->redirectTo('/');
     }
 }
开发者ID:annacrea,项目名称:ChezPaolo,代码行数:33,代码来源:BookingController.class.php

示例8: httpGetMethod

 public function httpGetMethod(Http $http, array $queryFields)
 {
     if (isset($_GET['logout']) && $_GET['logout'] == 'out') {
         $userSession = new UserSession();
         $userSession->destroy();
         $http->redirectTo('/');
     }
 }
开发者ID:paolocl,项目名称:ChezPaolo,代码行数:8,代码来源:LogoutController.class.php

示例9: httpPostMethod

 public function httpPostMethod(Http $http, array $formFields)
 {
     if (filter_var($formFields['Login'], FILTER_VALIDATE_EMAIL) != false) {
         $CustomerModel = new CustomerModel();
         $user_id = $CustomerModel->findWithCredentials($formFields['Login'], $formFields['Password']);
         //var_dump($user_id);
         if (ctype_digit($user_id)) {
             $user = $CustomerModel->findCustomer($user_id);
             $UserSession = new UserSession();
             $UserSession->create($user);
             $http->redirectTo('/');
         } else {
             $http->redirectTo('Exception?' . $user_id);
         }
     } else {
         $http->redirectTo('Exception?Error=4');
     }
 }
开发者ID:annacrea,项目名称:ChezPaolo,代码行数:18,代码来源:LoginController.class.php

示例10: httpPostMethod

 public function httpPostMethod(Http $http, array $formFields)
 {
     /*
      * Méthode appelée en cas de requête HTTP POST
      *
      * L'argument $http est un objet permettant de faire des redirections etc.
      * L'argument $formFields contient l'équivalent de $_POST en PHP natif.
      */
     /*$date = new DateModel();
     		var_dump($date->testDate($formFields['dateResa'])); //0 FAUX - 1 VRAI REJEX */
     try {
         $userSession = new UserSession();
         if ($userSession->isAuthenticated()) {
             $dateTime = date_create($formFields['dateResa'] . ' ' . $formFields['timeResa']);
             if ($dateTime == false) {
                 throw new InvalidArgumentException(BookingModel::$dateException);
             }
             $now = new DateTime("now");
             $resaDate = date_format($dateTime, 'Y-m-d');
             $resaTime = date_format($dateTime, 'H:i:s');
             //var_dump($formFields);
             if (!empty($formFields['dateResa']) && !empty($formFields['timeResa']) && !empty($formFields['NumberOfSeats']) && $dateTime > $now && ctype_digit($formFields['NumberOfSeats'])) {
                 $userId = $userSession->getId();
                 $booking = new BookingModel();
                 $resultat = $booking->register($userId, $resaDate, $resaTime, $formFields['NumberOfSeats']);
                 $flashBag = new FlashBag();
                 $flashBag->add("Votre réservation numero {$resultat} du {$resaDate} à {$resaTime} pour " . $formFields['NumberOfSeats'] . " est bien pris en compte");
                 $http->redirectTo('/');
             } elseif ($dateTime < $now) {
                 throw new InvalidArgumentException(BookingModel::$PasseDateException);
             } else {
                 throw new InvalidArgumentException(BookingModel::$FieldsException);
             }
         } else {
             $http->redirectTo('/');
         }
     } catch (InvalidArgumentException $event) {
         //var_dump($event);
         $form = new BookingForm();
         $form->bind($formFields);
         $form->setErrorMessage($event->getMessage());
         return ['_form' => $form];
     }
 }
开发者ID:paolocl,项目名称:ChezPaolo,代码行数:44,代码来源:BookingController.class.php

示例11: httpPostMethod

 public function httpPostMethod(Http $http, array $formFields)
 {
     /*
      * Méthode appelée en cas de requête HTTP POST
      *
      * L'argument $http est un objet permettant de faire des redirections etc.
      * L'argument $formFields contient l'équivalent de $_POST en PHP natif.
      */
     $userSession = new UserSession();
     if ($userSession->isAuthenticated() == false) {
         $http->redirectTo('/User/Login');
     }
     $orderModel = new OrderModel();
     $order_Id = $orderModel->validation($formFields['order'], $userSession->getId());
     //$order = $orderModel->getOrderById($order_Id);
     //return ['order', $order];
     $http->redirectTo('/Order/Payment?order_Id=' . $order_Id);
     // TODO : PAGE DE VALIDATION DU PANIER ET BOUTON PAYMENT
 }
开发者ID:paolocl,项目名称:ChezPaolo,代码行数:19,代码来源:ValidationController.class.php

示例12: httpGetMethod

 public function httpGetMethod(Http $http, array $queryFields)
 {
     /*
      * Méthode appelée en cas de requête HTTP GET
      *
      * L'argument $http est un objet permettant de faire des redirections etc.
      * L'argument $queryFields contient l'équivalent de $_GET en PHP natif.
      */
     $userSession = new UserSession();
     if ($userSession->isAdminAuthenticated() == false) {
         $http->redirectTo('/');
     }
 }
开发者ID:paolocl,项目名称:ChezPaolo,代码行数:13,代码来源:AddController.class.php

示例13: httpPostMethod

 public function httpPostMethod(Http $http, array $formFields)
 {
     if (filter_var($formFields['Login'], FILTER_VALIDATE_EMAIL) != false) {
         try {
             $userSession = new UserSession();
             $CustomerModel = new CustomerModel();
             $user_id = $CustomerModel->findWithCredentials($formFields['Login'], $formFields['Password'], $_SERVER['REMOTE_ADDR']);
             if (ctype_digit($user_id)) {
                 $user = $CustomerModel->findCustomer($user_id);
                 $userSession->create($user);
                 $http->redirectTo('/');
             }
         } catch (DomainException $event) {
             //var_dump($event);
             $form = new LoginForm();
             $form->bind($formFields);
             $form->setErrorMessage($event->getMessage());
             return ['_form' => $form];
             //AVEC CONTROLEUR EXECPTION --- $http->redirectTo('Exception?'.$user_id);
         }
     } else {
         $http->redirectTo('Exception?Error=4');
     }
 }
开发者ID:paolocl,项目名称:ChezPaolo,代码行数:24,代码来源:LoginController.class.php

示例14: httpPostMethod

 public function httpPostMethod(Http $http, array $formFields)
 {
     /*
      * Méthode appelée en cas de requête HTTP POST
      *
      * L'argument $http est un objet permettant de faire des redirections etc.
      * L'argument $formFields contient l'équivalent de $_POST en PHP natif.
      */
     //var_dump($formFields);
     if (ctype_alpha($formFields['Name']) && ctype_alpha($formFields['Password'])) {
         $adminModel = new AdminModel();
         $login = $adminModel->findWithCredentials($formFields['Name'], $formFields['Password']);
         //var_dump($login);
         if ($login != 'Error') {
             $userSession = new UserSession();
             $_SESSION['admin'] = 'on';
             $http->redirectTo('/Admin/List');
         }
     }
 }
开发者ID:paolocl,项目名称:ChezPaolo,代码行数:20,代码来源:AdminController.class.php


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