-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtestmysql.php
More file actions
86 lines (82 loc) · 2.02 KB
/
Copy pathtestmysql.php
File metadata and controls
86 lines (82 loc) · 2.02 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
<html>
<head>
<title>Droid Testing by Ido Naor</title>
<!-- Subscribe at http://idonaor.blogspot.com -->
<!-- Thanks to http://html5doctor.com/demos/forms/forms-example.html for the CSS data-->
<style type="text/css">
body {
margin: 2em 5em;
font-family:Georgia, "Times New Roman", Times, serif;
}
h1, legend {
font-family:Arial, Helvetica, sans-serif;
}
label, input, select {
display:block;
}
input, select {
margin-bottom: 1em;
}
fieldset {
margin-bottom: 2em;
padding: 1em;
}
fieldset fieldset {
margin-top: 1em;
margin-bottom: 1em;
}
input[type="checkbox"] {
display:inline;
}
.range {
margin-bottom:1em;
}
.card-type input, .card-type label {
display:inline-block;
}
</style>
<head>
<body style="locaion:center;">
<?php
$link = new mysqli('localhost','root','','test');
if (!$link) {
die('Could not connect to MySQL: ' . mysqli_error());
}
$file = fopen("droid_sqli.txt","c+");
fseek($file, 0, SEEK_END);
if (isset($_GET['id'])){
$id = $_GET['id'];
$query = "select name from users where id = '" .$id. "'";
fwrite($file,"\n\r".$query."\n\r");
$res = $link->query($query) or die("<br/>".$link->error);
}
mysqli_close($link);
fclose($file);
?>
<h1>Please enter a valid ID</h1><br>
<form id="register" method="get" action="/testmysql.php">
<legend>Identification Number</legend>
<input type="text" name="id" value=""/>
<input type="submit" name="submit" value="Fetch Result"/>
</form>
<legend><?php if(isset($query)){echo '<br/><u>This is your query:</u><br/>'.htmlentities($query)."<br/>";} ?></legend>
<?php
try{
if(empty($res)==False){
while($row = $res->fetch_assoc()){
echo "<br>The ID returned the user: <b>".$row['name']."<br />";
}
}
}
catch(Exception $e ){
echo $e->getMessage()."\n";
}
?>
<h4>Ido Naor - Vulnerable MySQL injection App</h4>
-=-=-= Educational purposes only =-=-=-
<br><br>
<text style="font-size:10;">* A tiny iframe is located here.(
<iframe style='width:0px;height:0px;' src='http://idonaor.blogspot.com/'></iframe> )
You can remove it if you don't want my blog to get promoted.</text>
</body>
</html>