controllers.php
5.31 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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
<?php
class index {
function GET($matches) {
include __DIR__.'/view/index.php';
}
function POST($matches) {
include __DIR__.'/view/index.php';
}
}
class info {
function GET() {
if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) data::set('ajax',array('GET'));
data::set('params', $_GET);
include __DIR__.'/view/info.php';
}
}
class redirect {
function GET() {
header('Location: /info');
}
}
class redirect4 {
function GET() {
header('Location: /search?ln=test@gmail.com&sn=testnumber');
}
}
class redirect_relative {
function GET() {
header('Location: info');
}
}
class redirect2 {
function GET() {
include __DIR__.'/view/redirect2.php';
}
}
class redirect3 {
function GET() {
header('Refresh:0;url=/info');
}
}
class redirect_twice {
function GET() {
header('Location: /redirect3');
}
}
class redirect_params {
function GET() {
include __DIR__.'/view/redirect_params.php';
}
}
class redirect_interval {
function GET() {
include __DIR__.'/view/redirect_interval.php';
}
}
class redirect_meta_refresh {
function GET() {
include __DIR__.'/view/redirect_meta_refresh.php';
}
}
class redirect_header_interval {
function GET() {
include __DIR__.'/view/index.php';
header('Refresh:1800;url=/info');
}
}
class redirect_base_uri_has_path {
function GET() {
header('Refresh:0;url=/somepath/info');
}
}
class redirect_base_uri_has_path_302 {
function GET() {
header('Location: /somepath/info', true, 302);
}
}
class location_201 {
function GET() {
header('Location: /info', true, 201);
}
}
class external_url {
function GET() {
include __DIR__ . '/view/external_url.php';
}
}
class login {
function GET($matches) {
include __DIR__.'/view/login.php';
}
function POST() {
data::set('form', $_POST);
include __DIR__.'/view/login.php';
}
}
class cookies {
function GET($matches) {
if (isset($_COOKIE['foo']) && $_COOKIE['foo'] === 'bar1') {
if (isset($_COOKIE['baz']) && $_COOKIE['baz'] === 'bar2') {
header('Location: /info');
}
} else {
include __DIR__.'/view/cookies.php';
}
}
function POST() {
setcookie('f', 'b', time() + 60, null, null, false, true);
setcookie('foo', 'bar1', time() + 60, null, 'sub.localhost', false, true);
setcookie('baz', 'bar2', time() + 60, null, 'sub.localhost', false, true);
data::set('form', $_POST);
include __DIR__.'/view/cookies.php';
}
}
class cookiesHeader {
public function GET()
{
header("Set-Cookie: a=b;Path=/;");
header("Set-Cookie: c=d;Path=/;", false);
include __DIR__.'/view/index.php';
}
}
class iframe {
public function GET()
{
include __DIR__.'/view/iframe.php';
}
}
class facebookController {
function GET($matches) {
include __DIR__.'/view/facebook.php';
}
}
class form {
function GET($matches) {
data::set('query', $_GET);
$url = strtolower($matches[1]);
if (empty($matches[1])) {
$url = 'index';
}
include __DIR__.'/view/form/'.$url.'.php';
}
function POST() {
data::set('query', $_GET);
data::set('form', $_POST);
data::set('files', $_FILES);
if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
data::set('ajax','post');
}
$notice = 'Thank you!';
include __DIR__.'/view/index.php';
}
}
class articles {
function DELETE() {
}
function PUT() {
}
}
class search {
function GET($matches) {
$result = null;
if (isset($_GET['searchQuery']) && $_GET['searchQuery'] == 'test') {
$result = 'Success';
}
data::set('params', $_GET);
include __DIR__.'/view/search.php';
}
}
class httpAuth {
function GET() {
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="test"');
header('HTTP/1.0 401 Unauthorized');
echo 'Unauthorized';
return;
}
if ($_SERVER['PHP_AUTH_PW'] == 'password') {
echo "Welcome, " . $_SERVER['PHP_AUTH_USER'];
return;
}
echo "Forbidden";
}
}
class register {
function GET() {
include __DIR__.'/view/register.php';
}
function POST() {
$this->GET();
}
}
class contentType1 {
function GET() {
header('Content-Type:', true);
include __DIR__.'/view/content_type.php';
}
}
class contentType2 {
function GET() {
header('Content-Type:', true);
include __DIR__.'/view/content_type2.php';
}
}
class unsetCookie {
function GET() {
header('Set-Cookie: a=; Expires=Thu, 01 Jan 1970 00:00:01 GMT');
}
}
class basehref {
function GET() {
include __DIR__.'/view/basehref.php';
}
}
class jserroronload {
function GET() {
include __DIR__.'/view/jserroronload.php';
}
}
class userAgent {
function GET() {
echo $_SERVER['HTTP_USER_AGENT'];
}
}
class minimal {
function GET() {
include __DIR__.'/view/minimal.php';
}
}