-
Notifications
You must be signed in to change notification settings - Fork 2
/
2.php
150 lines (141 loc) · 3.7 KB
/
2.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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
$conn = mysqli_connect("localhost", "shl", "minigath38", "sqlidb") or exit();
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if($_SERVER["REQUEST_METHOD"] == "POST") {
error_log(print_r($_REQUEST, true));
$username = $_POST["user"];
$password = $_POST["pass"];
$username = str_replace('=', '', $username);
$password = str_replace('=', '', $password);
$result = mysqli_query($conn,"SELECT * FROM user WHERE user='" . $username . "' AND pass = '". $password."'");
$row = mysqli_fetch_array($result);
if($row) {
$_SESSION['sqli'] = array($username,$password);
echo "<script>alert('Congratulations! you have logged in!')</script>";
} else {
echo "<script>alert('invalid login')</script>";
}
}
if (isset($_GET['logout'])) {
unset($_SESSION['sqli']);
header('Location: ?');
}
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<style type="text/css">
body {
padding-top: 150px;
}
.form-style-6{
font: 95% Arial, Helvetica, sans-serif;
max-width: 400px;
margin: 10px auto;
padding: 16px;
background: #F7F7F7;
}
.form-style-6 h1{
background: #43D1AF;
padding: 20px 0;
font-size: 140%;
font-weight: 300;
text-align: center;
color: #fff;
margin: -16px -16px 16px -16px;
}
.form-style-6 input[type="text"],
.form-style-6 input[type="password"],
.form-style-6 input[type="date"],
.form-style-6 input[type="datetime"],
.form-style-6 input[type="email"],
.form-style-6 input[type="number"],
.form-style-6 input[type="search"],
.form-style-6 input[type="time"],
.form-style-6 input[type="url"],
.form-style-6 textarea,
.form-style-6 select
{
-webkit-transition: all 0.30s ease-in-out;
-moz-transition: all 0.30s ease-in-out;
-ms-transition: all 0.30s ease-in-out;
-o-transition: all 0.30s ease-in-out;
outline: none;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
width: 100%;
background: #fff;
margin-bottom: 4%;
border: 1px solid #ccc;
padding: 3%;
color: #555;
font: 95% Arial, Helvetica, sans-serif;
}
.form-style-6 input[type="text"]:focus,
.form-style-6 input[type="password"]:focus,
.form-style-6 input[type="date"]:focus,
.form-style-6 input[type="datetime"]:focus,
.form-style-6 input[type="email"]:focus,
.form-style-6 input[type="number"]:focus,
.form-style-6 input[type="search"]:focus,
.form-style-6 input[type="time"]:focus,
.form-style-6 input[type="url"]:focus,
.form-style-6 textarea:focus,
.form-style-6 select:focus
{
box-shadow: 0 0 5px #43D1AF;
padding: 3%;
border: 1px solid #43D1AF;
}
.form-style-6 input[type="submit"],
.form-style-6 input[type="button"]{
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
width: 100%;
padding: 3%;
background: #43D1AF;
border-bottom: 2px solid #30C29E;
border-top-style: none;
border-right-style: none;
border-left-style: none;
color: #fff;
}
.form-style-6 input[type="submit"]:hover,
.form-style-6 input[type="button"]:hover{
background: #2EBC99;
}
</style>
<?php
if (!isset($_SESSION['sqli'])) {
echo '
<div class="form-style-6">
<h1>Login Now</h1>
<form action="" method="POST">
<input type="text" name="user" placeholder="username" />
<input type="password" name="pass" placeholder="*****" />
<input type="submit" value="Login" />
</form>
</div>
';
}
if (isset($_SESSION['sqli'])) {
echo '
<div class="form-style-6">
<h1>Welcome To Administrator Page</h1>
<form action="" method="GET">
<!-- <input type="text" name="user" placeholder="username" />
<input type="password" name="pass" placeholder="*****" /> -->
<input type="submit" value="Logout" name="logout" />
</form>
</div>
'; }
?>
</body>
</html>