-
Notifications
You must be signed in to change notification settings - Fork 0
/
save.php
52 lines (42 loc) · 1.57 KB
/
save.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
<?php
include 'connection/connection.php';
$autototal= $_POST["autototal"];
$teletotal= $_POST["teletotal"];
$chargingstationstatus = $_POST["chargingstationstatus"];
$hangarcheckbox = $_POST["hangarcheckbox"];
$ballcheckbox = $_POST["ballcheckbox"];
$defanscheckbox = $_POST["defanscheckbox"];
$imagerawdata = $_POST["imagerawdata"];
$teamid = $_POST["teamid"];
$notes = $_POST["notes"];
$matchid = $_POST["matchid"];
$penalties = $_POST["penalties"];
$grid = $_POST["GridStatus"];
$objecttotal = $_POST["objecttotal"];
if ($chargingstationstatus==1){
$totalpoint = 2;
}elseif ($chargingstationstatus==2){
$totalpoint = 8;
}elseif ($chargingstationstatus==3){
$totalpoint = 12;
}
$totalpoint = $totalpoint+$autototal+$teletotal;
function getip(){
$ip = "";
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
$ip = getip();
$sql = "INSERT INTO `data` (`req_ip`, `teamid`, `autototal`, `teletotal`, `objecttotal`, `chargingstationstatus`, `hangarcheckbox`, `ballcheckbox`, `defanscheckbox`, `imagerawdata`, `matchid`, `notes`, `totalpoint`, `penalties`, `grid`) VALUES ('$ip', '$teamid', '$autototal', '$teletotal', '$objecttotal', '$chargingstationstatus', '$hangarcheckbox', '$ballcheckbox', '$defanscheckbox', '$imagerawdata', '$matchid', '$notes', '$totalpoint', '$penalties', '$grid');";
if($conn->query($sql)){
header("location:index.html");
}else{
echo 'An error occurred while saving data';
}
?>