-
Notifications
You must be signed in to change notification settings - Fork 0
/
push.php
39 lines (39 loc) · 1.18 KB
/
push.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
<?php
$servername = "localhost";
$username = "svcehost_DJ2_0";
$password = "Svceacm123";
$dbname = "svcehost_DJ2.0";
$flag=true;
$id = "\"".$_POST['gh_id']."\"";
$name = "\"".$_POST['gh_fname']."\"";
$status = "\"".$_POST['status']."\"";
$email = "\"".$_POST['email']."\"";
//$id, $name, $status, $email
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$check_sql = "select count(1) as \"check\" from Participant_List where email=".$email.";";
//$check_stmt = $conn->prepare($check_sql);
//$check_stmt->execute();
$result = $conn->query($check_sql);
foreach ($result as $row) {
if ($row["check"]==0) {
$flag=false;
}
}
if ($flag) {
$submit_sql = "INSERT INTO `submission` (`gh_id`, `gh_name`, `status`, `email`) VALUES (".$id.",".$name.",".$status.",".$email.");";
$submit_stmt = $conn->prepare($submit_sql);
$submit_stmt->execute();
$conn->close();
header('Location: confirmation.html');
}
else {
// If user not registered
$conn->close();
header('Location: noreg.html');
}
?>