public function checkoutAction() { $id = $this->session->get('user_id'); $orderList = TempOrder::find("user_id = '{$this->session->get('user_id')}'"); foreach ($orderList as $key => $value) { $order = new Orders(); $order->id = UUID::v4(); $order->stadium = $value->stadium; $order->start_hour = $value->start_hour; $order->end_hour = $value->end_hour; $order->user_id = $value->user_id; $order->date_created = Carbon::now()->toDateString(); $order->save(); $value->delete(); } $this->response->redirect('/dashboard'); }
Page::$messages[] = array('type' => 'attention', 'message' => $msg); Page::message(); } if (!$authstatus && !isset($_REQUEST['regDo'])) { //registering order if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'placeorder') { //temprary saving order data $temp = TempOrder::getInstance(); setcookie('temporderid', $temp->Create(array('data' => serialize($_POST)))); } Page::setup('Registration form'); Page::RegForm(); } elseif (!isset($_REQUEST['regDo'])) { if (@$_REQUEST['action'] == 'placeorder') { //placing order $temp = TempOrder::getInstance(); setcookie('temporderid', $temp->Create(array('data' => serialize($_POST)))); header("Location: /index.php"); //Page::UserOrderPlaced(); } else { Page::$messages[] = array('type' => 'attention', 'message' => 'You are already registered!'); Page::message(); } Page::RegForm(); } else { //saving new user //checking if user with specified username and or email already exists if ($user->GetID(trim(@$_POST['username']), 'username') || $user->GetID(trim(@$_POST['email']), 'email')) { Page::$messages[] = array('type' => 'attention', 'message' => 'User already exists with specified username or email'); Page::message(); Page::RegForm();
Page::$userid = $userinstance->GetID($auth->username, 'username'); Page::$query_string = $_SERVER["QUERY_STRING"]; Page::$request_uri = $_SERVER["REQUEST_URI"]; Page::$page = @$_GET['page']; //Block 2: Dashboard if ($action == '' && $object == '' && $auth->check_auth() && $auth->get_rights() == 'Admin') { Page::init('admin'); Page::setup(Lang::$langarray['dashboard'], Lang::$langarray['pleasedtomeetyou']); Page::Dashboard(); exit; } elseif ($action == '' && $object == '' && $auth->check_auth() && $auth->get_rights() == 'Active') { //show user's dashboard Page::init('user'); if (is_numeric(@$_COOKIE['temporderid'])) { //creating new order from temprary one $temporder = TempOrder::getInstance(); $temporderarray = $temporder->FetchData($_COOKIE['temporderid']); if (count($temporderarray) > 1) { setcookie('temporderid', ''); $temporderdata = unserialize($temporderarray['data']); $order = Order::getInstance(); $orderid = $order->Create(Page::$userid, $temporderdata['pkgid'], 'new', '', '', '', 'Pending', $temporderdata['cycle']); Page::UserOrderPlaced($orderid); } } else { Page::UserDashboard(); } exit; } //Block 3: Show Object if ($action == '' && $object != '' && $auth->check_auth() && $auth->get_rights() == 'Admin') {