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


PHP Transfer::cancelSessions方法代码示例

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


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

示例1: display

 public function display()
 {
     // Cancel the transfer if a request is submitted.
     if (isset($_POST['cancel'])) {
         $transfer = new Transfer();
         $transfer->cancelSessions();
         unset($_POST['cancel']);
         $pos = strrpos($_SERVER['HTTP_REFERER'], '/');
         $pos = strlen($_SERVER['HTTP_REFERER']) - $pos;
         header("Location: " . substr($_SERVER['HTTP_REFERER'], 0, -$pos + 1) . "New-Funds-Transfer");
         // Otherwise process the transfer.
     } elseif (isset($_POST['submit'])) {
         unset($_POST['submit']);
         // To negate any back button issues.
         if (!isset($_SESSION['transferDate']) || !isset($_SESSION['transferDescription']) || !isset($_SESSION['transferRemitter']) || !isset($_SESSION['transferAmount'])) {
             header('Location: New-Funds-Transfer');
         }
         if (isset($_POST['password'])) {
             $validate = new Validation();
             // Validate the password.
             try {
                 $validate->password($_POST['password']);
             } catch (ValidationException $e) {
                 $_SESSION['error'] = $e->getError();
             }
             if (isset($_SESSION['error'])) {
                 unset($_POST['password']);
                 header('Location: New-Funds-Transfer');
             } else {
                 $user = new Users();
                 $user->userID = $_SESSION['userID'];
                 $user->password = $_POST['password'];
                 unset($_POST['password']);
                 // Confirm the password is corredt.
                 try {
                     $user->confirmPassword();
                 } catch (ValidationException $e) {
                     $_SESSION['error'] = $e->getError();
                 }
                 if (isset($_SESSION['error'])) {
                     header('Location: New-Funds-Transfer');
                 } else {
                     // If everything is ok, process the transfer and display
                     // the Transfer Acknowledgement Page
                     $account = new Account();
                     $account->accountID = $_SESSION['transferAccountID'];
                     if ($account->processTransfer()) {
                         include 'view/layout/transferack.php';
                     } else {
                         // Otherwise return to the Check Transfer page.
                         $checkTransfer = new CheckTransfer();
                         $checkTransfer->init();
                         include 'view/layout/checktransfer.php';
                     }
                 }
             }
         }
     }
 }
开发者ID:s3444261,项目名称:assignment2,代码行数:59,代码来源:TransferackController.php

示例2: display

 public function display()
 {
     // Cancels the transfer.
     if (isset($_POST['cancel'])) {
         $transfer = new Transfer();
         $transfer->cancelSessions();
         unset($_POST['cancel']);
         $pos = strrpos($_SERVER['HTTP_REFERER'], '/');
         $pos = strlen($_SERVER['HTTP_REFERER']) - $pos;
         header("Location: " . substr($_SERVER['HTTP_REFERER'], 0, -$pos + 1) . "New-Funds-Transfer");
         // Proceeds with the transfer.
     } elseif (isset($_POST['next'])) {
         $checktransfer = new CheckTransfer();
         if (isset($_POST['account']) && isset($_POST['accountPayee'])) {
             $checktransfer->unsetLast();
             $_SESSION['transferAccountID'] = $_POST['account'];
             unset($_POST['account']);
             $_SESSION['transferAccountPayeeID'] = $_POST['accountPayee'];
             unset($_POST['accountPayee']);
         }
         $validate = new Validation();
         if (isset($_POST['transferAmount'])) {
             // Validates the amount.
             try {
                 $transferAmount = $_POST['transferAmount'];
                 unset($_POST['transferAmount']);
                 $validate->transferAmount($transferAmount);
             } catch (ValidationException $e) {
                 $_SESSION['error'] = $e->getError();
             }
             if (isset($_SESSION['error'])) {
                 $transferAmount = null;
                 unset($_POST['next']);
                 header('Location: New-Funds-Transfer');
             } else {
                 $_SESSION['transferAmount'] = $transferAmount;
                 // Validates the description.
                 try {
                     $transferDescription = $_POST['transferDescription'];
                     unset($_POST['transferDescription']);
                     $validate->transferDescription($transferDescription);
                 } catch (ValidationException $e) {
                     $_SESSION['error'] = $e->getError();
                 }
                 if (isset($_SESSION['error'])) {
                     $transferDescription = null;
                     unset($_POST['next']);
                     header('Location: New-Funds-Transfer');
                 } else {
                     $_SESSION['transferDescription'] = $transferDescription;
                     // Validates the remitter.
                     try {
                         $transferRemitter = $_POST['transferRemitter'];
                         unset($_POST['transferRemitter']);
                         $validate->transferRemitter($transferRemitter);
                     } catch (ValidationException $e) {
                         $_SESSION['error'] = $e->getError();
                     }
                     if (isset($_SESSION['error'])) {
                         $transferRemitter = null;
                         unset($_POST['next']);
                         header('Location: New-Funds-Transfer');
                     } else {
                         $_SESSION['transferRemitter'] = $transferRemitter;
                         // Validates the date.
                         try {
                             $transferDate = $_POST['transferDate'];
                             unset($_POST['transferDate']);
                             $validate->transferDate($transferDate);
                         } catch (ValidationException $e) {
                             $_SESSION['error'] = $e->getError();
                         }
                         if (isset($_SESSION['error'])) {
                             $transferDate = null;
                             unset($_POST['next']);
                             header('Location: New-Funds-Transfer');
                         } else {
                             $_SESSION['transferDate'] = $transferDate;
                             // Displays the Check Transfer Page.
                             $checktransfer->init();
                             include 'view/layout/checktransfer.php';
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:s3444261,项目名称:assignment2,代码行数:88,代码来源:ChecktransferController.php


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