-
Notifications
You must be signed in to change notification settings - Fork 7
/
bad.php
53 lines (37 loc) · 1.07 KB
/
bad.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
<?php
require 'config/config.php';
include 'frontend/functions.php';
if (isset($_GET['spotid'])) {
$spotid = $_GET['spotid'];
$loc = $_GET['loc'];
$selectquery = "SELECT bad FROM spots WHERE spotid='$spotid'";
$selectresult = $conn->query($selectquery);
$row = $selectresult->fetch_array(MYSQLI_NUM);
$bad = $row[0];
} else {
$spotid = $conn->real_escape_string($_POST['spotid']);
$bad = $conn->real_escape_string($_POST['bad']);
}
$sql = "SELECT bad FROM spots WHERE spotid='$spotid'";
if(!mysqli_query($conn,$sql))
{
echo 'Not correct';
}
else
{
$bad = ++$bad;
}
$sql1 = "UPDATE spots SET bad='$bad' WHERE spotid='$spotid'";
if(!mysqli_query($conn,$sql1))
{
echo 'Not Inserted';
}
else
{
if (isset($_GET['spotid'])) {
echo "<meta http-equiv=\"refresh\" content=\"0;URL=./index.php?loc=$loc&zoom=19\">";
} else {
echo "<meta http-equiv=\"refresh\" content=\"0;URL=./pokemon.php\">";
}
}
?>