Пример #1
0
	if(!isset($_SESSION['step_01_completed']) || $_SESSION['step_01_completed'] != true){
		die(header('Location: ' . DOMAIN . 'dashboard/add-hotel/step-01'));
	}else if(!isset($_SESSION['step_02_completed']) || $_SESSION['step_02_completed'] != true){
		die(header('Location: ' . DOMAIN . 'dashboard/add-hotel/step-02'));
	}else if(!isset($_SESSION['step_03_completed']) || $_SESSION['step_03_completed'] != true){
		die(header('Location: ' . DOMAIN . 'dashboard/add-hotel/step-03'));
	}

	if(!isset($_POST['csrf']) || $_POST['csrf'] != 'd1b30e3e603d149cd12327fe2ec7510d'){
		$_SESSION['hotel_step_error'] = 'Some error occurred with the submission, please try again.';
		die(header('Location: ' . $_SESSION['page_url']));
	}else{
		if(!isset($_POST['info']) || (count(array_filter($_POST['info'])) < 1)){
			die(header('Location: ' . $_SESSION['page_url']));
		}
		$info = $_POST['info'];

		$hotelAttribute = new HotelAttribute();
		$hotelAttribute->hotel_id = $hotel_id;
		$hotelAttribute->is_airport_transfer = $info['is_transport'];
		$hotelAttribute->airport_transfer_fee = $info['ransport_fee'];
		$hotelAttribute->distance_to_airport = $info['distance'];
		$hotelAttribute->check_in = $info['check_in'];
		$hotelAttribute->check_out = $info['check_out'];
		$hotelAttribute->save();

		$_SESSION['step_04_completed'] = true;
		die(header('Location: ' . DOMAIN . 'dashboard/add-hotel/step-05'));
	}
?>
Пример #2
0
	}else if(!isset($_SESSION['step_02_completed']) || $_SESSION['step_02_completed'] != true){
		die(header('Location: ' . DOMAIN . 'dashboard/add-hotel/step-02'));
	}else if(!isset($_SESSION['step_03_completed']) || $_SESSION['step_03_completed'] != true){
		die(header('Location: ' . DOMAIN . 'dashboard/add-hotel/step-03'));
	}

	if(!isset($_POST['csrf']) || $_POST['csrf'] != 'd1b30e3e603d149cd12327fe2ec7510d'){
		$_SESSION['hotel_step_error'] = 'Some error occurred with the submission, please try again.';
		die(header('Location: ' . $_SESSION['page_url']));
	}else{
		if(!isset($_POST['info']) || (count(array_filter($_POST['info'])) < 1)){
			die(header('Location: ' . $_SESSION['page_url']));
		}
		$info = $_POST['info'];

		$hotelAttribute = new HotelAttribute();

		$toRemAttr = $hotelAttribute->where('hotel_id', '=', $hotel_id)->get();
		$toRemAs = [];
		foreach($toRemAttr as $toRemAtt){
			$toRemAs[] = $toRemAtt->id;
		}
		$hotelAttribute->whereIn('id', $toRemAs)->delete();

		$hotelAttribute->hotel_id = $hotel_id;
		$hotelAttribute->is_airport_transfer = $info['is_transport'];
		$hotelAttribute->airport_transfer_fee = $info['ransport_fee'];
		$hotelAttribute->distance_to_airport = $info['distance'];
		$hotelAttribute->check_in = $info['check_in'];
		$hotelAttribute->check_out = $info['check_out'];
		$hotelAttribute->save();