forked from lincanbin/Carbon-Forum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
404.php
22 lines (21 loc) · 832 Bytes
/
404.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
require_once(__DIR__."/config.php");//Timezone
//For IIS ISAPI_Rewrite
$RequestURI = isset($_SERVER['HTTP_X_REWRITE_URL']) ? $_SERVER['HTTP_X_REWRITE_URL'] : $_SERVER["REQUEST_URI"];
if(preg_match('/upload\/avatar\/(large|middle|small)\/[0-9]+.png/i', $RequestURI, $AvatarSize))
{
//header('Location: default.png');
header("HTTP/1.0 200 OK");
header("Status: 200 OK");
$DefaultAvatar = fopen('upload/avatar/'.$AvatarSize[1].'/default.png', "rb");
header("Accept-Ranges: bytes");
header("Content-Type: image/png");
header('Expires: '.gmdate ("D, d M Y H:i:s",strtotime("+7 day"))." GMT");
//Fri, 07 Nov 2014 18:15:11 GMT
echo stream_get_contents($DefaultAvatar);
fclose($DefaultAvatar);
}else{
header("HTTP/1.1 404 Not Found");
header("Status: 404 Not Found");
echo 'Error: 404 NOT FOUND';
}