-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathprocess_data.php
190 lines (106 loc) · 2.85 KB
/
process_data.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
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
<?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
include 'credential.php';
$setadmin=test_input($setadmin);
$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();
$sessionadmin = test_input($_SESSION["admin@"]);
$sessionpass = test_input($_SESSION["pass@"]);
if ($sessionadmin==$setadmin && $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["admin_name"]=test_input($_POST["admin_name"]);
$_POST["password"]=test_input($_POST["password"]);
$admin=$_POST["admin_name"];
$pass=$_POST["password"];
//process_data.php
if(isset($_POST["admin_name"]))
{
$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 you had used restricted symbols.';
}
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($admin!=$setadmin or $pass!=$setpass)
{
$invalid_error = 'Invalid Username or Password';
}
if($admin_name_error == '' && $password_error == '' && $captcha_error == '' && $admin==$setadmin && $pass==$setpass)
{
$_SESSION["admin@"] = $setadmin;
$_SESSION["pass@"] = $setpass;
$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);
}
}
?>