| Server IP : 109.234.162.214 / Your IP : 216.73.216.222 Web Server : Apache System : Linux servd162214.srv.odns.fr 4.18.0-372.26.1.lve.1.el8.x86_64 #1 SMP Fri Sep 16 14:08:19 EDT 2022 x86_64 User : carpe ( 1178) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/carpe/public_html/space/ |
Upload File : |
<?php
session_start();
include "database.php";
if (!isset($_SESSION['authenticated']) || $_SESSION['authenticated'] !== true) {
header('Location: check.php');
}else{
$username = $_SESSION['username'];
//echo "Nom d'utilisateur : $username <br>";
}
if (isset($_SESSION['admin'])) {
echo "<div id='switch'><a href='reservations.php'>Admin</a></div>";
}
echo "<div id='deco'><form method='POST' action='check.php'><input type='submit' name='decoo' value='Deconnexion'></form></div>";
if(isset($_POST['decoo'])){
session_destroy();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Outer Space</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
</head>
<style>
body{
margin:0;
padding:0;
background-color:#121214;
width:100%;
height:100vh;
color:white;
font-family: "Poppins", sans-serif;
font-weight: 400;
font-style: normal;
display:flex;
justify-content:center;
align-items:center;
}
#switch{
position:absolute;
z-index:999;
top:0;
background:#121214;
padding:10px;
color:white;
box-shadow: -3px 3px 7px black;
cursor:pointer;
right:0;
}
#deco{
position:absolute;
z-index:999;
bottom:0;
background:#121214;
color:white;
box-shadow: -3px 3px 7px black;
cursor:pointer;
right:0;
}
#contain{
width:100%;
height:100%;
position:relative;
margin:0;
padding:0;
}
#aside{
background:white;
color:black;
height:100%;
width:40%;
margin:0;
padding:0;
overflow: auto;
}
#switch a{
text-decoration:none;
color:white;
}
#deco input{
text-decoration:none;
color:white;
background:none;
border:none;
font-size:1rem;
padding:10px;
cursor:pointer;
}
.quatre{
width:100%;
display:flex;
align-items:center;
justify-content:center;
border-bottom:2px black solid;
padding-bottom:10px;
margin-top:20px;
}
.cinq{
width:60%;
line-height:1;
}
#aside div p{
line-height:1;
margin:0;
padding:0;
}
.as{
margin:20px;
}
#datepicker{
margin:50px;
}
h2{
margin:20px;
}
#cool h2{
margin:20px;
}
#un{
width:100%;
height:100%;
display:flex;
justify-content:center;
align-items:center;
margin:0;
padding:0;
}
#cool{
width:100%;
}
#cool{
display:flex;
justify-content:space-between;
flex-wrap:wrap;
}
.cool2{
width:400px;
}
#cool div h2{
width:100%;
}
#boom{
width:100%;
display:flex;
justify-content:center;
align-items:center;
}
#boom input{
all:initial;
margin:20px;
color:white;
font-family: "Poppins", sans-serif;
font-weight: 400;
cursor:pointer;
font-style: normal;
}
h1{
cursor:pointer;
}
#toi{
margin:20px;
}
#toi div{
display:flex;
justify-content:space-between;
width:100%;
}
#contain2{
width:100%;
height:50%;
display:flex;
justify-content:center;
align-items:center;
}
#contain3{
width:45%;
height:100%;
position:relative;
overflow:hidden;
}
#contain3 img{
width:80%;
margin-top:2%;
margin-left:20px;
position:absolute;
z-index:999;
}
#first{
left:600px;
}
#third{
right:600px;
}
#second{
position:absolute;
}
.sun{
transition : .5s all;
}
.suceed{
text-align:center;
width:100%;
}
@media only screen and (max-width: 1024px) {
#un{
flex-wrap:wrap;
}
#aside{
width:100%;
height:auto;
}
body{
flex-wrap:wrap;
height:80vh;
}
}
@media only screen and (max-width: 800px) {
body{
height:120vh;
}
#contain{
height:100%;
}
#contain3 img{
margin-top:40px;
margin-right:40px;
margin-left:0px;
}#contain2{
background:blue;
height:30%;
}
}
</style>
<body>
<form method="POST" action="home3.php" id="un">
<div id="contain">
<div>
<h2>1) Choisir la Destination de votre prochain voyage : </h2>
<div id="contain2">
<h1 id="left"><</h1>
<div id="contain3">
<img src="saturne.png" class="sun">
<img src="all.png" class="sun">
<img src="moon.png" class="sun">
<img src="namek.png" class="sun">
<img src="mars.png" class="sun">
<img src="jupiter.png" class="sun">
<img src="uranus.png" class="sun">
<img src="neptune.png" class="sun">
<input type="hidden" id="selected_value" name="selected_value" value="0">
</div>
<h1 id="right">></h1>
</div>
</div>
<div id="cool">
<div class="cool2">
<h2>2) Quand partez-vous ? </h2>
<div id="toi">
<div>
<label>Date de début</label>
<input type="date" name="date">
</div>
<div>
<label>Durée du voyage (jours)</label>
<input type="number" name="duree">
</div>
<p><i>A laissez vide de préférence, pour maximiser le nombre de choix</i></p>
</div>
</div>
<div class="cool2" id="cool3">
<h2>3) D'ou partez vous ? </h2>
<?php
$d = "SELECT `depart` FROM `trajets` group by depart";
$result_d = $mysqli->query($d);
while ($infos = $result_d->fetch_assoc()) {
$desti = $infos['depart'];
//echo "<option>".$desti."</option>";
echo "<input type='radio' name='depart' value='$desti'>";
echo $desti;
}
?>
</div>
</div>
<div id="boom">
<input type="reset" value='Reinitialiser'>
<input type="submit" name='send' value='Rechercher'>
</div>
<?php
if(isset($_SESSION['suceed'])) {
echo "<div class='suceed'>" . $_SESSION['suceed'] . "</div>";
unset($_SESSION['suceed']);
}
?>
</div>
</form>
<div id="aside">
<h1>Choississez votre trajet</h1>
<?php
if(!isset($_POST['send'])){
//$c = "SELECT * from vaisseaux";
//$result_c = $mysqli->query($c);
//while ($infos_c = $result_c->fetch_assoc()) {
//$id_vaisseau = $infos_c['id_vaisseau'];
//$k = "select count(*) as total from places, pr where places.id_place = pr.id_place AND places.id_vaisseau='$id_vaisseau'";
//$result_k = $mysqli->query($k);
//while ($infos_k = $result_k->fetch_assoc()) {
//echo $infos_k['total'];
//$total = $infos_k['total'];
//}
//}
//$ok = $infos_d['id_trajet'];
$date1 = date('Y-m-d');
$e = "select * from vt, trajets, vaisseaux where trajets.id_trajet = vt.id_trajet AND vaisseaux.id_vaisseau = vt.id_vaisseau AND date_debut > '$date1' ";
$result_e = $mysqli->query($e);
while ($infos_e = $result_e->fetch_assoc()) {
echo "<div class='quatre'>";
echo "<div class='cinq'><p>Destination :";
echo $infos_e['destination'];
echo "</p></br><p>Date depart :";
echo $infos_e['date_debut'];
echo "</p></br><p>Durée :";
echo $infos_e['duree'];
echo "</p></br><p>Depart :";
echo $infos_e['depart'];
echo "</p></br><p>Nom vaisseau :";
echo $infos_e['nom_vaisseau'];
echo "</div></p><div class='as'><form method='POST' action='inserer.php'>
<input type='submit' name='send5' value='Choisir'>
<input type='hidden' name='id_vaisseau' value='".$infos_e['id_vaisseau']."'>
<input type='hidden' name='id_trajet' value='".$infos_e['id_trajet']."'>
<input type='hidden' name='depart' value='".$infos_e['depart']."'>
</form></div>";
echo "</br>";
echo "</div>";
}
}
if(isset($_POST['send'])){
$date_debut=$_POST['date'];
$duree=$_POST['duree'];
//echo $_POST['selected_value'];
if($_POST['selected_value']==1){
//echo "Saturne";
$destination="Saturne";
}
if($_POST['selected_value']==0){
//echo "all";
}
if($_POST['selected_value']==-1){
$destination="Lune";
}
if($_POST['selected_value']==-2){
$destination="Namek";
}
if($_POST['selected_value']==-3){
$destination="Mars";
}
if($_POST['selected_value']==-4){
$destination="Jupiter";
}
if($_POST['selected_value']==-5){
$destination="Uranus";
}
if($_POST['selected_value']==-6){
$destination="Neptune";
}
//echo $destination;
if(!empty($_POST['destination']) AND !empty($_POST['date']) AND !empty($_POST['duree'])){
$d = "select * from vt, trajets, vaisseaux where trajets.id_trajet = vt.id_trajet AND vaisseaux.id_vaisseau = vt.id_vaisseau and destination = '$destination' AND date_debut='$date_debut' AND duree='$duree'";
$result_d = $mysqli->query($d);
}
if(!empty($_POST['destination']) AND !empty($_POST['date'])){
$d = "select * from vt, trajets, vaisseaux where trajets.id_trajet = vt.id_trajet AND vaisseaux.id_vaisseau = vt.id_vaisseau and destination = '$destination' AND date_debut='$date_debut'";
$result_d = $mysqli->query($d);
}
if(!empty($_POST['destination']) AND !empty($_POST['duree'])){
$d = "select * from vt, trajets, vaisseaux where trajets.id_trajet = vt.id_trajet AND vaisseaux.id_vaisseau = vt.id_vaisseau and destination = '$destination' AND duree='$duree'";
$result_d = $mysqli->query($d);
}
if(!empty($_POST['date']) AND !empty($_POST['duree'])){
$d = "select * from vt, trajets, vaisseaux where trajets.id_trajet = vt.id_trajet AND vaisseaux.id_vaisseau = vt.id_vaisseau and date_debut='$date_debut' AND duree='$duree'";
$result_d = $mysqli->query($d);
}
if(empty($_POST['destination']) AND empty($_POST['date']) AND empty($_POST['duree'])){
$d = "select * from vt, trajets, vaisseaux where trajets.id_trajet = vt.id_trajet AND vaisseaux.id_vaisseau = vt.id_vaisseau";
$result_d = $mysqli->query($d);
}
if(isset($destination)){
$d = "select * from vt, trajets, vaisseaux where trajets.id_trajet = vt.id_trajet AND vaisseaux.id_vaisseau = vt.id_vaisseau and destination = '$destination' ";
$result_d = $mysqli->query($d);
//echo "hefhef";
}
if(!empty($_POST['duree'])){
$d = "select * from vt, trajets, vaisseaux where trajets.id_trajet = vt.id_trajet AND vaisseaux.id_vaisseau = vt.id_vaisseau and duree='$duree'";
$result_d = $mysqli->query($d);
}
if(!empty($_POST['date'])){
$d = "select * from vt, trajets, vaisseaux where trajets.id_trajet = vt.id_trajet AND vaisseaux.id_vaisseau = vt.id_vaisseau and date_debut='$date_debut'";
$result_d = $mysqli->query($d);
}
if(!empty($_POST['depart'])){
$from = $_POST['depart'];
$d = "select * from vt, trajets, vaisseaux where trajets.id_trajet = vt.id_trajet AND vaisseaux.id_vaisseau = vt.id_vaisseau and depart='$from'";
$result_d = $mysqli->query($d);
}
if(!empty($_POST['depart']) AND !empty($_POST['duree'])){
$d = "select * from vt, trajets, vaisseaux where trajets.id_trajet = vt.id_trajet AND vaisseaux.id_vaisseau = vt.id_vaisseau and depart='$from' AND duree='$duree'";
$result_d = $mysqli->query($d);
}
if(!empty($_POST['depart']) AND !empty($_POST['date'])){
$d = "select * from vt, trajets, vaisseaux where trajets.id_trajet = vt.id_trajet AND vaisseaux.id_vaisseau = vt.id_vaisseau and depart='$from' AND date_debut='$date_debut'";
$result_d = $mysqli->query($d);
}
if(!empty($_POST['depart']) AND !empty($_POST['destination'])){
$d = "select * from vt, trajets, vaisseaux where trajets.id_trajet = vt.id_trajet AND vaisseaux.id_vaisseau = vt.id_vaisseau and depart='$from' AND destination='$destination'";
$result_d = $mysqli->query($d);
}
$stop = "Pas de trajets disponibles...";
while ($infos_d = $result_d->fetch_assoc()) {
echo "</br><div class='quatre'>";
$ok = $infos_d['id_trajet'];
$e = "select * from vt, trajets, vaisseaux where trajets.id_trajet = vt.id_trajet AND vaisseaux.id_vaisseau = vt.id_vaisseau and trajets.id_trajet = $ok";
$result_e = $mysqli->query($e);
while ($infos_e = $result_e->fetch_assoc()) {
echo "<div class='cinq'><p>Destination :";
echo $infos_d['destination'];
echo "</p></br><p>Date depart :";
echo $infos_d['date_debut'];
echo "</p></br><p>Durée :";
echo $infos_d['duree'];
echo "</p></br><p>Depart :";
echo $infos_d['depart'];
echo "</p></br><p>Nom vaisseau :";
echo $infos_e['nom_vaisseau'];
echo "</div></p><div class='as'><form method='POST' action='inserer.php'>
<input type='submit' name='send5' value='Choisir'>
<input type='hidden' name='id_vaisseau' value='".$infos_e['id_vaisseau']."'>
<input type='hidden' name='id_trajet' value='".$infos_e['id_trajet']."'>
</form></div>";
echo "</br>";
$stop ="";
}
echo "</div>";
}
echo $stop;
}
?>
</div>
</body>
</html>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
let value=0;
let index = 0;
let index2=0;
function updateHiddenInput(value) {
document.getElementById('selected_value').value = value;
}
let left = document.getElementById('left');
let right = document.getElementById('right');
let first = document.getElementById('first');
let second = document.getElementById('second');
let third = document.getElementById('third');
let elements = document.querySelectorAll('.sun');
let oe = -1200;
let ca = 0;
left.addEventListener("click", function() {
if(index2<1){
value++;
ca=ca +615;
oe=-1200;
index2++;
elements.forEach(function(element) {
oe = oe+615;
element.style.left = ca + oe + 'px';
});
updateHiddenInput(value);
}
});
right.addEventListener("click", function() {
if(index2>2-index){
value--;
ca=ca -615;
oe=+1200;
index2--;
elements.forEach(function(element) {
oe = oe-615;
element.style.left = ca - oe + 'px';
});
updateHiddenInput(value)
}
});
elements.forEach(function(element) {
oe = oe+615;
element.style.left = oe + 'px';
index++;
});
</script>