forked from COP-4710/Event_Manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreatePrivateEvent.php
More file actions
89 lines (86 loc) · 2.41 KB
/
createPrivateEvent.php
File metadata and controls
89 lines (86 loc) · 2.41 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
<?php
session_start();
include ("config.php");
if($_SERVER["REQUEST_METHOD"] == "POST")
{
$event_name = $_POST["event_name"];
$date = $_POST["date"];
$description = $_POST["description"];
$start = $_POST["start"];
$end = $_POST["end"];
$location_name = $_POST["location_name"];
$longitude = 1;
$latitude =1;
$sql = "INSERT INTO `location` (event_name, start, end, date, location_name,longitude, latitude) VALUES ('$event_name','$start','$end','$date','$location_name', '$longitude', '$latitude')";
$result = $db->query($sql);
$sql2 = "SELECT event_name, start, end, date, location_name FROM location WHERE event_name ='$event_name'";
$result2 = $db->query($sql2);
if($result2->num_rows > 0 )
{
$sql3 = "INSERT INTO `Private_event` (university, event_name, date, description, start, end) VALUES ('{$_SESSION["university"]}','$event_name', '$date', '$description', '$start','$end')";
$result3 = $db->query($sql3);
$sql4 = "SELECT event_name, start, end, date, description FROM event WHERE event_name = '$event_name'";
$result4 = $db->query($sql4);
if($result4->num_rows >0)
{
header("Location:http://157.245.128.154/eventpage.php");
}
else
{
echo "event inserting failed";
}
}
else
{
echo "time conflicts or event name conflict";
//header("Location:http://157.245.128.154/eventpage.php");
}
}
?>
<!DOCTYPE html>
<html lang = "en-US">
<head>
<title>Create Public Event</title>
<style>
section {
width: 100%;
height: 100vh;
background: url(bg.jpg);
background-size: cover;
}
section .window {
color: white;
margin: auto;
padding: 30px;
text-align: center;
width: 500px;
height: 500px;
background-color: rgba(0,0,0,0.7);
}
</style>
</head>
<body>
<section>
<div class='window'>
<form action='createPrivateEvent.php' method='post'>
<p>Event Name:</p>
<textarea name='event_name'>Type Name here</textarea>
<p>Event date</p>
<input type="date" name='date' />
</br>
<p>Event start and end time</p>
<input type="time" name='start' /> <p> - </p> <input type="time" name='end' />
</br>
<p>Event Description</p>
<textarea name='description'>Event Description</textarea>
</br>
<p>Event Location Address</p>
<textarea name='location_name'>Event Location</textarea>
</br>
<button name='submit' type='submit'>Create Event</button>
</form>
</br>
</div>
</section>
</body>
</html>