public function Stripe()
 {
     $token = Helper::getParam('stripeToken');
     if ($this->model->stripe($token)) {
         header("Location: ../booking/View/payment.php");
         return "<h1 style='color: lightgreen;'>Thank you, you will be redirected to homepage shortly</h1>";
     }
 }
Example #2
0
 public function getToken()
 {
     $code = Helper::getParam('code', INPUT_GET);
     $data = array('client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'code' => $code);
     $response = Curl::post($this->token_url, $data, Curl::HEADER_OAUTH);
     if (!$response) {
         return false;
     }
     $this->access_token = json_decode($response, true)['access_token'];
     return true;
 }
Example #3
0
 public function adminLogin()
 {
     $output = ['success' => false, 'error' => []];
     $loginResult = $this->model->adminLogin(Helper::getParam('username'), Helper::getParam('password'));
     if ($loginResult) {
         $output['success'] = true;
     } else {
         $output['error'][] = 'username or password is not correct';
     }
     return $this->view->json($output);
 }
 public function registerUser()
 {
     // Validate user inputs
     $v = new Validator($_POST);
     $v->validate('username', ['notEmpty']);
     $v->email()->validate('email', ['notEmpty', 'EmailValidator']);
     if ($v->isValid()) {
         $result = $this->model->newUser(Helper::getParam('username'), Helper::getParam('password'), Helper::getParam('email'));
         return $this->view->json($this->resultArray($result['success'], $result['error']));
     } else {
         return $this->view->json($this->resultArray(false, $v->getErrors()));
     }
 }
Example #5
0
 public static function getUser($key = 'username')
 {
     Helper::startSession();
     return isset($_SESSION['user']) ? $_SESSION['user'][$key] : false;
 }
Example #6
0
<?php

/**
 * Created by PhpStorm.
 * User: yi
 * Date: 22/03/16
 * Time: 1:14 AM
 */
include '../autoloader.php';
use Project\Payment\Payment;
// Start a session, there is no need to add this line if session is active.
\Project\Classes\Helper::startSession();
// Create a pay with stripe button on page.
// Pass in the amount needs to be paid.
Payment::stripeButton(20);