Parent Directory | Revision Log
Revision 45 - (view) (download)
1 : | ian | 45 | <?php |
2 : | $file_chmod = 0666; | ||
3 : | $res_dir = '../content/'; | ||
4 : | |||
5 : | //requested resource | ||
6 : | $res = $_GET['res']; | ||
7 : | //current game server map | ||
8 : | $map = $_GET['map']; | ||
9 : | //auth hash | ||
10 : | $key = $_GET['key']; | ||
11 : | //auth hash time stamp | ||
12 : | $time = $_GET['time']; | ||
13 : | //server id | ||
14 : | $sid = $_GET['sid']; | ||
15 : | |||
16 : | $res = ltrim( $res, '\\/' ); | ||
17 : | $f_name = basename( $res ); | ||
18 : | $res = $res_dir . $res; | ||
19 : | |||
20 : | if( file_exists( $res ) && !preg_match( '/.php$/', $res ) ) | ||
21 : | { | ||
22 : | //echo 'File ' . $res . ' . ' exists.'; | ||
23 : | |||
24 : | header( 'Content-type: application/octet-stream' ); | ||
25 : | $f_size = filesize( $res ); | ||
26 : | header( 'Content-Length: ' . $f_size ); | ||
27 : | header( 'Content-Disposition: attachment; filename="' . $f_name . '"' ); | ||
28 : | readfile( $res ); | ||
29 : | } | ||
30 : | else | ||
31 : | { | ||
32 : | header( 'HTTP/1.0 404 Not Found' ); | ||
33 : | echo '<html><head><title>Not Found [404]</title></head><body><h1>Not Found</h1>The requested URL was not found on this server.</body></html>'; | ||
34 : | |||
35 : | $p_log = fopen( 'content_server.log', 'a+' ); | ||
36 : | fwrite ( $p_log, "$map\t$res\t\t\t$sid\n" ); | ||
37 : | //echo 'File ' . $res . ' does not exist.'; | ||
38 : | chmod( 'content_server.log', $file_chmod ); | ||
39 : | fclose( $p_log ); | ||
40 : | } | ||
41 : | |||
42 : | ?> |
Contact | ViewVC Help |
Powered by ViewVC 1.0.4 |