-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.php
executable file
·113 lines (90 loc) · 3.07 KB
/
log.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
<?php session_start();
#include('/var/www/html/db_config.php');
include('db_config.php');
if ($_POST["log"] == "Check Dupe") {
$sql = "select count(ol.contactcallsign) as cntcallsign from ospotalog ol ";
$sql .= "join sysbands b on ol.bandid = b.sysbandsid ";
$sql .= "where contactcallsign = '" . strtoupper($_POST["callsign"]) . "' ";
$sql .= "and trim(b.band) = '" . strtoupper($_SESSION["band"]) . "'";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
$cntcallsign = $row["cntcallsign"];
}
if ($cntcallsign > 0) {
$_SESSION["dupecheck"] = 0;
header("location: index.php");
exit();
} else {
$_SESSION["dupecheck"] = 1;
$_SESSION["callsign"] = strtoupper($_POST["callsign"]);
$_SESSION["parkid"] = strtoupper($_POST["parkid"]);
$_SESSION["stdx"] = strtoupper($_POST["stdx"]);
header("location: index.php");
exit();
}
}
if ($_POST["log"] == "Clear") {
$_SESSION["callsign"] = '';
$_SESSION["parkid"] = '';
$_SESSION["stdx"] = '';
$_SESSION["dupecheck"] = 2;
header("location: index.php");
exit();
}
$sql = "select count(ol.contactcallsign) as cntcallsign from ospotalog ol ";
$sql .= "join sysbands b on ol.bandid = b.sysbandsid ";
$sql .= "where contactcallsign = '" . strtoupper($_POST["callsign"]) . "' ";
$sql .= "and trim(b.band) = '" . strtoupper($_SESSION["band"]) . "'";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
$cntcallsign = $row["cntcallsign"];
}
if ($cntcallsign > 0) {
$_SESSION["dupecheck"] = 3;
header("location: index.php");
exit();
}
$sql = "select licenseclassid from ospotasettings";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
$licenseclassid = $row["licenseclassid"];
}
if ($_POST["parkid"] == "") {
$parkid = 76;
} else {
$sql = "select ospotaparkid from ospotaparks where parkid = '" . strtoupper($_POST["parkid"]) . "'";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
$parkid = $row["ospotaparkid"];
}
}
if ($_POST["stdx"] == "") {
$stateid = 52;
} else {
$sql = "select sysstatesid from sysstates where stateabrv = '" . strtoupper($_POST["stdx"]) . "'";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
$stateid = $row["sysstatesid"];
}
}
$sql = "select sysbandsid from sysbands where band = '" . $_SESSION["band"] . "' and licenseclassid = " . $licenseclassid . " and mode =1";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
$sysbandsid = $row["sysbandsid"];
}
$sql = "insert into ospotalog (contactcallsign, parkid, stateid, utc_datetime, mode, bandid) ";
$sql = $sql . "values(";
$sql = $sql . "'" . strtoupper($_POST["callsign"]) . "',";
$sql = $sql . $parkid . ",";
$sql = $sql . $stateid . ",";
$sql = $sql . "'" . gmdate("Y-m-d H:i:s") . "',";
$sql = $sql . "1,";
$sql = $sql . $sysbandsid;
$sql = $sql . ")";
$conn->query($sql);
$_SESSION["callsign"] = '';
$_SESSION["parkid"] = '';
$_SESSION["stdx"] = '';
$_SESSION["dupecheck"] = 2;
header("location: index.php");
?>