-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.php
More file actions
53 lines (41 loc) · 1.61 KB
/
index.php
File metadata and controls
53 lines (41 loc) · 1.61 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
<?php
require 'vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
$app = new Silex\Application();
$app->get('/print', function(){
$response = new Response(file_get_contents(basename(__FILE__)), 200);
if (isset($_GET['public'])) {
$response->headers->set('Access-Control-Allow-Origin', '*');
$response->headers->set('Content-type', 'text/plain; charset=utf-8');
$response->headers->set('Access-Control-Allow-Methods', 'GET,POST,DELETE');
}
return $response;
});
$app->get('/author', function(){
$response = new Response('<h4 title="GossJS" id="author">Антон Бабахин</h4>', 200);
if (isset($_GET['public'])) {
$response->headers->set('Access-Control-Allow-Origin', '*');
$response->headers->set('Content-type', 'text/plain; charset=utf-8');
$response->headers->set('Access-Control-Allow-Methods', 'GET,POST,DELETE');
}
return $response;
});
$app->get('/info', function(){
return phpinfo();
});
$app->get('/', function(){
$response = new Response('<h1>'.date("d/m/Y H:i").'</h1>', 200);
if (isset($_GET['public'])) {
$response->headers->set('Access-Control-Allow-Origin', '*');
$response->headers->set('Content-type', 'text/plain; charset=utf-8');
$response->headers->set('Access-Control-Allow-Methods', 'GET,POST,DELETE');
}
return $response;
});
$app->post('/haha', function(){
$input = array_shift( unpack("C", file_get_contents("php://input")));
$output = ~ $input & '255';
return pack("C", $output);
});
$app->run();