-
Notifications
You must be signed in to change notification settings - Fork 0
/
editdb.php
58 lines (49 loc) · 1.35 KB
/
editdb.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(empty($_POST["password"])) {
echo "password not entered";
}
else{
require'config.php';
$password=$_POST["password"];
if($password=="#thegladiator124") {
$id=$_POST['ID'];
$ans=$_POST['ANSWER'];
$url=$_POST['URL'];
$id = stripslashes($id);
$ans = stripslashes($ans);
$url = stripslashes($url);
//$id = mysql_real_escape_string($id);
//$ans = mysql_real_escape_string($ans);
//$url = mysql_real_escape_string($url);
$query=mysql_query("SELECT * FROM $kryptostable WHERE ID='$id'");
$no=mysql_num_rows($query);
if($no>=1) {
if($ans=="") {
$query1=mysql_query("UPDATE $kryptostable SET URL='$url' WHERE ID='$id'");
}
else if($url=="") {
$query1=mysql_query("UPDATE $kryptostable SET ANSWER='$ans' WHERE ID='$id'");
}
else if(!empty($_POST['ANSWER']) && !empty($_POST['URL'])){
$query1=mysql_query("UPDATE $kryptostable SET ANSWER='$ans',URL='$url' WHERE ID='$id'");
}
if(!$query1){
die("update failed");
}
}
else if(!empty($_POST['ID'])) {
$query1=mysql_query("INSERT INTO $kryptostable (ID,ANSWER,URL) VALUES('$id','$ans','$url') ",$connection);
if(!$query1){
die("insertion failed");
}
}
else {
die("Invalid id");
}
echo "Database successfully updated";
}
else{
echo "Invalid password";
}
}
?>