-
Notifications
You must be signed in to change notification settings - Fork 0
/
csv.php
26 lines (22 loc) · 787 Bytes
/
csv.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
<?php
$_session_id = sha1(microtime().$_SERVER['REMOTE_ADDR']);
$entityBody = preg_replace('/^/m', "$_session_id,", file_get_contents('php://input'))."\n";
// make sure results exists and is not accessible from the web
if (!is_dir("results")) {
if (!@mkdir("results")) {
$error = error_get_last();
echo $error['message'];
}
}
if (!file_exists("results/.htaccess")) file_put_contents("results/.htaccess", "
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
# Apache 2.2
<IfModule !mod_authz_core.c>
Order Allow,Deny
Deny from all
</IfModule>
");
file_put_contents("results/$_session_id.csv", $entityBody);