-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
33 lines (31 loc) · 799 Bytes
/
index.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
27
28
29
30
31
32
33
<?php
define("SUMMETA","<!--this is the first view page created at ".date("Y-m-d H:i:s")." by summer -->");
$kv = new SaeKV();
$kv->init();
if($_GET['s']){
$url = $_SERVER['SCRIPT_URI'].'?s='.$_GET['s'];
echo fetchUrl($url);
exit;
}
$sitemap = $kv->get($_SERVER['SCRIPT_URI'].'index.html');
if ($sitemap) {
header('Content-type:text/html; charset=utf-8');
echo $sitemap;
}else{
echo fetchUrl($_SERVER['SCRIPT_URI']).SUMMETA;
}
function fetchUrl($url){
$ch=curl_init();
curl_setopt($ch, CURLOPT_AUTOREFERER,0);
curl_setopt($ch, CURLOPT_REFERER, 'staticindex');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$ret=curl_exec($ch);
curl_close($ch);
if ($ret) {
return $ret;
}else{
return false;
}
}
?>