-
Notifications
You must be signed in to change notification settings - Fork 0
/
copyright_warning.php
62 lines (45 loc) · 1.47 KB
/
copyright_warning.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
<?php
include "db_conn.php";
if (isset($_POST['username']) && isset($_POST['action'])) {
$username = $_POST["username"];
$action = $_POST["action"];
if ($action == "check") {
$sql1 = "SELECT * FROM `account` WHERE `username` = '$username'";
$result1 = mysqli_query($conn, $sql1);
if ($result1 && mysqli_num_rows($result1) > 0) {
$row1 = mysqli_fetch_array($result1);
$copyright = $row1["copyright"];
if ($copyright) {
echo "True";
} else {
echo "False";
}
} else {
echo "Username";
}
} else if ($action == "upload") {
$sql1 = "SELECT * FROM `account` WHERE `username` = '$username'";
$result1 = mysqli_query($conn, $sql1);
if ($result1 && mysqli_num_rows($result1) > 0) {
$row1 = mysqli_fetch_array($result1);
$copyright = $row1["copyright"];
if ($copyright) {
echo "True";
} else {
$sql2 = "UPDATE `account` SET `copyright` = '1' WHERE `username` = '$username'";
$result2 = mysqli_query($conn, $sql2);
if ($result2) {
echo "Success";
} else {
echo "Username";
}
}
} else {
echo "Username";
}
} else {
}
} else {
echo "Unknown";
}
?>