-
Notifications
You must be signed in to change notification settings - Fork 0
/
rentSpace.php
53 lines (49 loc) · 1.87 KB
/
rentSpace.php
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<?php
session_start();
if(isset($_POST["rentSpaceRequest"])){
if(isset($_SESSION["userName"])){
if($_SESSION["userName"]!=""){
$username = $_SESSION["userName"];
// select to get user id
$spaceid = $_POST["spaceid"];
$timeStart = $_POST["dateStart"]." ".$_POST["timeStart"];
$timeEnd = $_POST["dateEnd"]." ".$_POST["timeEnd"];
$messagee = $_POST["message"];
if($spaceid != ""
&& $timeStart != " "
&& $timeEnd != " "){
require("inc/connect.inc");
$sql = "INSERT INTO renting
(spaceId,userName,timeStart,timeEnd)
VALUES
('".$spaceid."','".$username."','".$timeStart."','".$timeEnd."')
";
#if(mysqli_query($con,$sql) === TRUE){
if(mysqli_query($con, $sql)!=0){
echo '<script>alert("Đã gửi yêu cầu thuê thành công!");</script>';
header("Refresh:1;url=index.php",true,303);
}else{
echo '<script>alert("Đã xảy ra lỗi!");</script>';
#header("Refresh:1;url=index.php",true,303);
}
}else{
echo "No data";
}
}else{
echo "No session";
}
}else{
echo "No session set";
}
}else{
header("Location:index.php");
}
?>
</body>
</html>