-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_event.php
43 lines (35 loc) · 1.15 KB
/
create_event.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
<?php
//start session
session_start();
//connect to database
require 'connection.php';
$conn = Connect();
//variable set
$event_name = $conn->real_escape_string($_POST['event_name']);
$event_id = $conn->real_escape_string($_POST['event_id']);
$dj_password = $conn->real_escape_string($_POST['dj_password']);
$password = $conn->real_escape_string($_POST['password']);
$privacy = $conn->real_escape_string($_POST['privacy']);
$creator_IP = $_SERVER['REMOTE_ADDR'];
//update database
$sql = "INSERT into event (event_name,event_id,dj_password,creator_IP) VALUES('" . $event_name . "','" . $event_id . "','" . $dj_password . "', '" . $creator_IP . "')";
$success = $conn->query($sql);
//error check
if (!$success){
$conn->query($sql);
header('Location: create.php');
}
//variable session set
$_SESSION["EVENT_ID"] = $event_id;
$_SESSION["EVENT_NAME"] = $event_name;
$_SESSION["DJ_MODE"] = "on";
//output
echo "Event ID: $event_id<br>";
echo "Event Name: $event_name<br>";
echo "DJ Password: $dj_password<br>";
echo "Privacy: $privacy";
//close connection
$conn->close();
//redirect
header('Location: home.php');
?>