예제 #1
0
파일: header2.php 프로젝트: VSG24/ccms
<?php

Sessions::checkLogStatusForSite();
if (getCurrentUser() == '') {
    doCache();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <?php 
//session_start();
?>
    <base href="/">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">
    <title><?php 
echo makeSiteTitle();
?>
</title>

    <!-- Bootstrap core CSS -->
    <link href="<?php 
echo THEME_BASE;
?>
css/bootstrap.min.css" rel="stylesheet">
예제 #2
0
function urlfetch($uri, $postdata = null, $headers = null, $timeout = 15)
{
    global $proxy_name, $proxy_ip, $proxy_port, $cacheTime;
    $cacheIt = false;
    if (empty($postdata)) {
        $method = 'GET';
        $cacheIt = hitCache($uri, $cacheTime);
    } else {
        $method = 'POST';
        $data = '';
        foreach ($postdata as $key => $val) {
            if ($data != '') {
                $data .= '&';
            }
            $data .= "{$key}={$val}";
        }
    }
    logf($method . ': ' . $uri);
    $ssl = '';
    if ($proxy_port == 443) {
        $ssl = 'ssl://';
    }
    $fp = fsockopen($ssl . $proxy_ip, $proxy_port, $errno, $errstr, 5);
    if (!$fp) {
        return false;
    }
    stream_set_timeout($fp, $timeout);
    $response = '';
    $out = "{$method} {$uri} HTTP/1.0\r\n";
    $out .= "Host: {$proxy_name}\r\n";
    if (is_array($headers)) {
        foreach ($headers as $key => $val) {
            $out .= "{$key}: {$val}\r\n";
        }
    }
    $out .= "User-Agent: TwiyiaProxy/1.0\r\n";
    $out .= "Content-type: application/x-www-form-urlencoded\r\n";
    $out .= "Content-length: " . strlen($data) . "\r\n";
    $out .= "Connection: Close\r\n\r\n";
    $out .= $data;
    fwrite($fp, $out);
    while (!feof($fp)) {
        $response .= fgets($fp, 128);
    }
    fclose($fp);
    if (empty($response)) {
        return false;
    }
    $responses = explode("\r\n\r\n", $response, 2);
    $headers = explode("\r\n", $responses[0]);
    if (count($headers) < 2) {
        return false;
    }
    $body = $responses[1];
    if ($cacheIt & strpos($headers[0], '200') > 0) {
        doCache($uri, $body);
    }
    return array('headers' => $headers, 'body' => $body);
}