-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
87 lines (78 loc) · 2.06 KB
/
index.php
File metadata and controls
87 lines (78 loc) · 2.06 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Database Project</title>
</head>
<body>
<div align="center">
<?php
error_reporting(0);
if(isset($_POST['type'], $_POST['one'], $_POST['two'])) {
if($_POST['type'] != '' && $_POST['one'] != '' && $_POST['two'] != '') {
echo '<h1>Result</h1>';
include('./func.php');
$query = $_POST['type']." ".$_POST['one']." FROM ".$_POST['two'];
if(isset($_POST['three'])) {
if($_POST['three'] != '') {
$query = $query." WHERE ".$_POST['three'];
}
}
page($query);
} else {
display_interface();
}
}
else if(isset($_POST['insert_one'], $_POST['insert_two'])) {
if($_POST['insert_two'] != '') {
echo '<h1>Result</h1>';
include('./func.php');
$query = "INSERT INTO ".$_POST['one']." VALUES ".$_POST['two'];
page($query);
} else {
display_interface();
}
}
else if(isset($_POST['query'])) {
if($_POST['query'] != '') {
echo '<h1>Result</h1>';
include('./func.php');
page($_POST['query']);
} else {
display_interface();
}
}
else {
display_interface();
}
function display_interface() {
echo '<h1>Interface</h1>
<br/><br/>
<h2>Select/Delete query</h2>
<form method="post" action="index.php">
<select name="type">
<option value="SELECT">SELECT</option>
<option value="DELETE">DELETE</option>
</select>
<input type="text" name="one" /> FROM
<input type="text" name="two" /> WHERE
<input type="text" name="three" />
<input type="submit" value="Send" />
</form><br/>
<h2>Insert query</h2>
<form method="post" action="index.php">
INSERT INTO <input type="text" name="insert_one" />
VALUES <input type="text" name="insert_two" />
<input type="submit" value="Send" />
</form><br/>
<h2>Other query</h2>
<form action="index.php" method="POST">
<label>General SQL query</label> : <input type="text" name="query" />
<input type="submit" value="Send" />
</form>
';
}
?>
</div>
</body>
</html>