-
Notifications
You must be signed in to change notification settings - Fork 0
/
driver_validation.php
130 lines (108 loc) · 3.8 KB
/
driver_validation.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
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
<?php
session_start();
?>
<html>
<head>
<!-- Meta -->
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="./css/host.css">
<!-- Formoid Stuff -->
<link rel="stylesheet" href="formoid_files/formoid1/formoid-solid-blue.css" type="text/css" />
<script type="text/javascript" src="formoid_files/formoid1/jquery.min.js"></script>
<script type="text/javascript" src="formoid_files/formoid1/formoid-solid-blue.js"></script>
<!-- Functions -->
</head>
<body class="blurBg-false" style="background-color:#EBEBEB">
<div class = "title page">
"Become a driver"
</div>
<!-- Start Formoid form-->
<form class="formoid-solid-blue" style="background-color:#FFFFFF;font-size:14px;font-family:'Roboto',Arial,Helvetica,sans-serif;color:#34495E;max-width:480px;min-width:150px" method="post">
<div class="title">
<h2>Become a Driver</h2>
</div>
<div class="element-input">
<label class="title"></label>
<div class="item-cont">
<input class="large" type="text" name="event_code_input" placeholder="Event Code"/>
<span class="icon-place"></span>
</div>
</div>
<div class="submit">
<input type="submit" value="Submit"/>
</div>
</form>
<p class="frmd">
<a href="http://formoid.com/v29.php">web forms</a>
Formoid.com 2.9
</p>
<!-- Stop Formoid form-->
</body>
<?php
// session_start();
// $_SESSION['myValue']=3;
// bring in db configure
include '../config.php';
// define variables and set to empty values
// function test_input($data) {
// $data = trim($data);
// $data = stripslashes($data);
// $data = htmlspecialchars($data);
// return $data;
// }
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// $event_name = $place_id = "";
// $doc = new DomDocument;
// // We need to validate our document before refering to the id
// $doc->validateOnParse = true;
// $doc->Load('host.php');
// $docElement = $doc->getElementById('addressArea') ;
// $place_id = DOMinnerHTML($docElement);
// $place_id = test_input($_POST['variable']);
// $place_id = $_POST["place_id"];
// $event_name = $_POST["input"];
// $place_id = test_input($_POST['variable']);
$event_code = "";
$event_code = $_POST["event_code_input"];
// Create connection
echo $event_code;
$conn = mysqli_connect($host, $user, $password, $db);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = sprintf("SELECT id FROM host WHERE event_code = '%s'",$event_code);
// create sql command
// $sql = sprintf("INSERT INTO host (event_name,place_id) VALUES ('%s','%s')", $event_name , $place_id );
// $sql = sprintf("INSERT INTO host (event_name) VALUES ('%s')", $event_name );
// $sql = sprintf("INSERT INTO host (place_id) VALUES ('%s')" , $place_id );
if (mysqli_query($conn, $sql)) {
echo "checked sucessfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
$result = mysqli_query($conn, $sql);
if(mysqli_num_rows($result) == 0) {
echo "failed to find database";
} else {
$_SESSION['event_code'] = $event_code;
print_r($_SESSION);
session_write_close();
echo "found databases";
echo "<script> window.location.replace('driver.php') </script>";
}
}
mysqli_close($conn);
?>
<!-- Google Map Placement API
<script src="./js/host_google_maps.js"></script>
-->
<!-- Google API javascript reference
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBipA0YTrMPK1wx2Ok4DXNj7NTiiLVGpVY&libraries=places&callback=initAutocomplete"
async defer></script>
-->
<script scr="./js/jquery-3.1.1.js"
</html>