-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess_data.php
More file actions
212 lines (115 loc) · 2.87 KB
/
Copy pathprocess_data.php
File metadata and controls
212 lines (115 loc) · 2.87 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
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<?php
include 'captcha.php';
//THIS ADMIN SYSTEM IS DESIGNED BY SUPRIN AZIZ TALPUR
//YOU CAN FREELY USE IT AND MODIFY IT, BUT PLEASE MENTION ME IN YOUR CREDIT
//theusername and password
$setpass="password";
$setpass=test_input($setpass);
$logout=test_input($_GET["logout"]);
if ($logout=="yes"){
session_start();
// remove all session variables
session_unset();
// destroy the session
session_destroy();
echo '
<script>
window.location.href = "index.php";
</script>
';
}
session_start();
$sessionpass = test_input($_SESSION["pass@"]);
if ($sessionpass==$setpass){
}
function test_input($data) {
$isequal = "=";
$oneone = "1=1";
$quote ='"';
if ($data==$isequal or $data==$oneone or $data=="105" or $data==$quote) {
$data="";
}
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
$_POST["password"]=test_input($_POST["password"]);
$pass=$_POST["password"];
//process_data.php
if(isset($_POST["password"]))
{
$admin_name = '';
$password = '';
$admin_name_error = '';
$password_error = '';
$captcha_error = '';
$invalid_error = '';
if(empty($_POST["admin_name"]))
{
$admin_name_error = 'Admin is empty or you had used restricted symbols.';
}
else
{
$admin_name = $_POST["admin_name"];
}
if(empty($_POST["password"]))
{
$password_error = 'Password is Empty or Invalid.';
}
else
{
$password = $_POST["password"];
}
if(empty($_POST['g-recaptcha-response']))
{
$captcha_error = 'Captcha is required';
}
else
{
$secret_key = $secret;
$response = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret_key.'&response='.$_POST['g-recaptcha-response']);
$response_data = json_decode($response);
if(!$response_data->success)
{
$captcha_error = 'Captcha verification failed, Please refresh the webpage.';
}
}
if($pass!=$setpass)
{
$invalid_error = 'Invalid Password';
}
//access and authencity from database
include 'db.php';
$sql = "SELECT id, memo, pass FROM control WHERE pass='".$pass."' ";
$result = $con->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$authpass=$row["pass"];
}
}
else {
}
$con->close();
//continued code
if($password_error == '' && $captcha_error == '' && $pass==$authpass)
{
$_SESSION["pass@"] = $authpass;
$data = array(
'success' => true
);
}
else
{
$data = array(
'admin_name_error' => $admin_name_error,
'password_error' => $password_error,
'captcha_error' => $captcha_error,
'invalid_error' => $invalid_error
);
}
if ($logout!="yes") {
echo json_encode($data);
}
}
php?>