-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathin_annonce.php
More file actions
169 lines (157 loc) · 5.08 KB
/
in_annonce.php
File metadata and controls
169 lines (157 loc) · 5.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!-- Nom du binome BALI-CROISILLE -->
<?php
session_start();
include("connex.inc.php");
$idcom=connex("sharemyhouse","myparam");
mysqli_set_charset($idcom, "utf8");
$temp=explode("=",$_SERVER["REQUEST_URI"]);
$idp=$temp[1];
$requete="SELECT * FROM annonce,inscription WHERE annonce.idp='".$idp."' AND annonce.ids=inscription.id ";
$result=@mysqli_query($idcom,$requete);
$tab=mysqli_fetch_array($result);
$_SESSION["pseudo_dest"]=$tab["pseudo"];
if (isset($_POST["submitreserve"])) {
if (isset($_POST["reserve1"]) && isset($_POST["reserve2"]) && isset($_SESSION["id"])) {
$requete2="SELECT * FROM `reservation` WHERE reserver_idp='".$idp."' AND `date_debut_r` BETWEEN '".$_POST['reserve1']."' AND '".$_POST['reserve2']."' AND `date_fin_r` BETWEEN '".$_POST['reserve1']."' AND '".$_POST['reserve2']."'";
$result2=@mysqli_query($idcom,$requete2);
$bis=mysqli_num_rows($result2);
if ($bis==0) {
$requete="INSERT INTO `reservation` (`ids`,`reserver_idp`,`date_debut_r`,`date_fin_r`) VALUES ('".$_SESSION['id']."','".$idp."','".$_POST['reserve1']."','".$_POST['reserve2']."')";
$result=@mysqli_query($idcom,$requete);
$erreur="Félicitation vous venez de réserver votre logement.";
}
else {
$erreur="Dommage cette date de réservation est déjà prise.";
}
}
else {
$erreur="Vous devez vous connecter pour réserver";
}
}
?>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="css/header.css">
<link rel="stylesheet" href="css/style.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"rel="stylesheet">
<style>
body{
background-image: url('autre/stripes-light.png');
}
</style>
<title>Annonce</title>
</head>
<body>
<header>
<nav class="menu">
<div class="menu_bis">
<div class="menu_left">
<a href="recherche2.php"><h1 id="logo">ShareMyhouse</h1></a>
</div>
<div class="menu_right">
<?php
if (isset($_SESSION["id"])) {
echo '<a class="link" href="profil.php"><i class="material-icons">account_circle</i> Profil</a>';
echo '<a class="link" href="reception.php"><i class="material-icons">local_post_office</i> Boîte de réception</a>';
echo '<a class="link" href="deconnexion.php"><i class="material-icons">exit_to_app</i> Se déconnecter</a>';
}
else {
echo '<a class="link" href="connexion.php"><i class="material-icons">person</i> Connexion</a>';
}
?>
</div>
</div>
</nav>
</header>
<div class="1" align="center">
<h2>Annonce de <?php echo $tab["pseudo"]; ?></h2>
</div>
<br>
<a href="messagerie.php?dest=<?php echo $tab["id"] ?>">Envoyer un message à l'host</a><br>
<a href="profiluser.php?id=<?= $tab["id"] ?>" target="_blank">Profil de l'hôte: <?= $tab["pseudo"] ?></a>
<br>
<div align="center">
<?php
echo "<img class='image' src='pictures/".$tab["photos"]."' alt='wow'>"; // le css ne marche pas
?>
</div>
<br><br>
<table align="center" class="intable">
<tr>
<td>
<?php echo ucfirst($tab["pays"]); ?>
</td>
</tr>
<tr>
<td>
<?php echo ucfirst($tab["ville"]); ?>
</td>
</tr>
<tr>
<td>
<?php echo ucfirst($tab["adresse"]); ?>
</td>
</tr>
<tr>
<td>
<?php echo ucfirst($tab["type"]); ?>
</td>
</tr>
<tr>
<td>
<?php echo $tab["prix"]; ?> €/nuit
</td>
</tr>
<tr>
<td>
<?php echo $tab["description"]; ?>
</td>
</tr>
<?php
if (isset($_SESSION["id"]) && $_SESSION["id"] != $tab["ids"] || !isset($_SESSION["id"])) {
?>
<tr>
<td>
<h4>Dates de réservations disponible:</h4>
</td>
</tr>
<tr>
<td>
Du: <?php echo $tab["dispo_debut"]; ?> Au: <?php echo $tab["dispo_fin"]; ?>
</td>
</tr>
<tr>
<td>
<form class="tdform" method="post">
<label>Veuillez choisir la date d'arrivée :
<input type="date" name="reserve1" min="<?php echo $tab["dispo_debut"] ?>" max="<?php echo $tab["dispo_fin"] ?>"required>
</label>
</td>
</tr>
<tr>
<td>
<label>Veuillez choisir la date de départ :
<input type="date" name="reserve2" min="<?php echo $tab["dispo_debut"] ?>" max="<?php echo $tab["dispo_fin"] ?>"required>
</label>
</td>
</tr>
<tr>
<td>
<input type="submit" name="submitreserve" value="Réserver">
</td>
</tr>
<?php
}
?>
</form>
</table>
</body>
</html>
<?php
if (isset($erreur)) {
echo '<p>';
echo '<strong><font color="red">'.$erreur.'</font></strong>';
echo '</p></body>';
}
?>