-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadminverify_proc.php
58 lines (45 loc) · 1.3 KB
/
adminverify_proc.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
<?php
if (isset($_GET['answer']))
{
session_start();
//collection form data
$answer = $_GET['answer'];
$artid = $_GET['artid'];
// database connection parameters
// $servername = "localhost";
// $username = "root";
// $db_password = "creativeS@23";
// $dbname = "creative_db";
$servername = "localhost";
$username = "root";
$db_password = "";
$dbname = "creative_db";
// Create connection
$conn = new mysqli($servername, $username, $db_password, $dbname);
// Check connection
if ($conn->connect_error) {
//stop executing the code and echo error
echo ("Connection failed: " . $conn->connect_error);
header("Location: adminverification.php");
exit();
}
$sql = "UPDATE artwork SET status='$answer' WHERE artworkID='$artid'";
$result = $conn->query($sql);
if ($result === TRUE) {
$_SESSION['done'] = "successfully updated";
header("Location: adminverification.php");
exit();
} else {
$_SESSION['wrong'] = "Encountered an error";
header("Location: adminverification.php");
exit();
}
//close database connection
$conn->close();
}
else {
// redirect to login page
header("Location: adminverification.php");
exit();
}
?>