<?PHP
function globule ($fname) {
$item = $fname;
if(!strncmp($fname,"/",1)) {
if(strncmp($fname,$_SERVER['DOCUMENT_ROOT'],
strlen($_SERVER['DOCUMENT_ROOT'])))
{
$item = $fname;
$fname = $_SERVER['DOCUMENT_ROOT'] . $fname;
} else
$item = substr($fname,strlen($_SERVER['DOCUMENT_ROOT'])+1);
} else
$item = $fname;
while(!strncmp($item,"/",1))
$item = substr($item,1);
$url = parse_url($_SERVER['GLOBULE_SECTION'] . "/" . $item);
$host = $url["host"];
$port = $url["port"];
$file = $url["path"];
if($port == 0) {
$servername = $host;
$port = 80;
} else
$servername = $host . ":" . $port;
$fp = fsockopen("tcp://127.0.0.1", $port);
fwrite($fp, "HEAD " . $file . " HTTP/1.1\r\nHost: " . $servername .
"\r\nConnection: Close\r\n\r\n");
while(!feof($fp)) {
fgets($fp, 128);
}
fclose($fp);
return $fname;
}
function globuleGetInfo ($keys) {
global $ARGS;
# for kv in $keys make k=v&k=v, etc
$url = parse_url("http://" . $_SERVER['SERVER_NAME'] . ":"
. $_SERVER['SERVER_PORT'] . dirname($_SERVER['REQUEST_URI'])
. "/getinfo.php?" . $keys);
$host = $url["host"];
$port = $url["port"];
if($port == 0) {
$servername = $host;
$port = 80;
} else
$servername = $host . ":" . $port;
$fp = fsockopen("tcp://127.0.0.1", $port);
fwrite($fp, "GET " . $url['path'] . "?" . $url['query'] .
" HTTP/1.1\r\nHost: " . $servername . "\r\nConnection: Close\r\n\r\n");
if(!feof($fp) && sscanf(fgets($fp),"HTTP/1.1 %d %s",$status,$message) > 0 &&
$status == 200)
{
$result = "";
$chunked = 0;
while(!feof($fp)) {
$s = fgets($fp);
if($s == "" || $s == "\n\n" || $s == "\r\n" )
break;
if(preg_match('/Transfer\\-Encoding:\\s+chunked\\r\\n/',$s))
$chunked = 1;
}
if($chunked) {
do {
$ch = '';
$chunksize = '';
do {
$chunksize .= $ch;
$ch = fread($fp,1);
} while($ch != "\r" && $ch != "\n"); // till match CR
if($ch == "\r")
fread($fp,1); // skip the LF
$chunksize = hexdec($chunksize);
if($chunksize > 0) {
$result .= fread($fp,$chunksize);
fread($fp,2); // discard the CRLF trailing chunk
}
} while($chunksize);
} else {
while(!feof($fp)) {
$s = fgets($fp);
$result .= $s;
}
}
}
fclose($fp);
eval($result);
}
function globuleInfo (&$var, $keys) {
# dirname($_SERVER['REQUEST_URI') in case relative URL?
$var = array();
$url = parse_url("http://" . $_SERVER['SERVER_NAME'] . ":"
. $_SERVER['SERVER_PORT'] . dirname($_SERVER['SCRIPT_NAME'])
. "/info?" . $keys);
$host = $url["host"];
$port = $url["port"];
if($port == 0) {
$servername = $host;
$port = 80;
} else
$servername = $host . ":" . $port;
$fp = fsockopen("tcp://127.0.0.1", $port);
fwrite($fp, "GET " .$url['path'] . "?" . $url['query'] .
" HTTP/1.1\r\nHost: " . $servername . "\r\nConnection: Close\r\n\r\n");
if(!feof($fp) && sscanf(fgets($fp),"HTTP/1.1 %d %s",$status,$message) > 0 &&
$status == 200)
{
while(!feof($fp)) {
$s = fgets($fp);
if($s == "" || $s == "\n\n" || $s == "\r\n" )
break;
}
while(!feof($fp)) {
$s = fgets($fp);
parse_str($s,$var);
}
}
fclose($fp);
}
function globuleFormatFileSize ($bytes) {
if($bytes > 2*1048576)
return number_format($bytes/1048576,1,".","") . " MB";
else if($bytes > 2*1024)
return number_format($bytes/1024,1,".","") . " KB";
else
return $bytes;
}
function globuleFormatTime ($timestamp) {
return gmstrftime("%A %d-%b-%y %T %Z",$timestamp);
}
function globuleFormatInterval ($seconds) {
$rtstring = "";
$days = floor($seconds / 86400);
$hours = floor($seconds / 3600) % 24;
$minutes = floor($seconds / 60) % 60;
$seconds = $seconds % 60;
if($days > 0) {
if(strcmp($rtstring,""))
$rtstring .= " ";
if($days > 1)
$rtstring .= $days . " days";
else if($hours==0 && $minutes==0 && $seconds==0)
$rtstring .= "daily";
else
$rtstring .= "one day";
}
if($hours > 0) {
if(strcmp($rtstring,""))
$rtstring .= " ";
if($hours > 1)
$rtstring .= $hours . " hours";
else if($days==0 && $minutes==0 && $seconds==0)
$rtstring .= "every hour";
else
$rtstring .= $hours . " hours";
}
if($minutes > 0) {
if(strcmp($rtstring,""))
$rtstring .= " ";
if($minutes > 1)
$rtstring .= $minutes . " minutes";
else
$rtstring .= "one minut";
}
if($seconds > 0) {
if(strcmp($rtstring,""))
$rtstring .= " ";
if($seconds > 1)
$rtstring .= $seconds . " seconds";
else
$rtstring .= "one second";
}
if(strcmp($rtstring,""))
return $rtstring;
else
return "never";
}
$globule_mysql__links = array();
$globule_mysql__statements = array();
$globule_mysql__keywords = array (
array("SELECT", "GET"),
array("UPDATE", "POST"),
array("INSERT", "POST"),
array("REPLACE", "POST"),
array("DELETE", "POST")
);
function globule_mysql__reconnect($link)
{
global $globule_mysql__links;
$fp = fsockopen("tcp://127.0.0.1", $_SERVER['SERVER_PORT']);
$globule_mysql__links[$link-1]['fp'] = $fp;
}
function globule_mysql_attach($location, $new_link = FALSE, $client_flags = 0)
{
global $globule_mysql__links;
$link = array ( 'location' => $location,
'errno' => 0,
'error' => "",
'affected' => -1 );
$globule_mysql__links[] = $link;
$link = count($globule_mysql__links);
globule_mysql__reconnect($link);
return $link;
}
function globule_mysql_reattach($location, $link = 0)
{
global $globule_mysql__links;
if($link == 0)
$link = count($globule_mysql__links);
$globule_mysql__links[$link-1]['location'] = $location;
$globule_mysql__links[$link-1]['errno'] = 0;
$globule_mysql__links[$link-1]['error'] = "";
return TRUE;
}
function globule_mysql_connect($hostname = "",
$username = "",
$password = "",
$new_link = FALSE, $client_flags = 0)
{
global $globule_mysql__links;
$link = array ( 'hostname' => $hostname,
'username' => $username,
'password' => $password,
'errno' => -1,
'error' => "not attached to globule",
'affected' => -1 );
$globule_mysql__links[] = $link;
$link = count($globule_mysql__links);
globule_mysql__reconnect($link);
return $link;
}
function globule_pconnect($hostname = "",
$username = "",
$password = "",
$client_flags = 0)
{
global $globule_mysql__links;
return FALSE;
}
function globule_mysql_close($link = 0)
{
global $globule_mysql__links;
if($link == 0)
$link = count($globule_mysql__links);
fclose($globule_mysql__links[$link-1]['fp']);
return TRUE;
}
function globule_mysql_select_db($database, $link = 0)
{
global $globule_mysql__links;
if($link == 0)
$link = count($globule_mysql__links);
$globule_mysql__links[$link-1]['database'] = $database;
return TRUE;
}
function globule_mysql__getcontent($fp)
{
$content = "";
$chunked = 0;
$length = -1;
while(!feof($fp)) {
$s = fgets($fp);
if($s == "" || $s == "\n\n" || $s == "\r\n" )
break;
if(preg_match('/Transfer\\-Encoding:\\s+chunked\\r\\n/',$s))
$chunked = 1;
$args = array();
if(preg_match('/Content-Length:\\s+(\\d+)\\r\\n/',$s,$args)) {
$length = $args[0];
}
}
if($chunked) {
do {
$ch = '';
$chunksize = '';
do {
$chunksize .= $ch;
$ch = fread($fp,1);
} while($ch != "\r" && $ch != "\n"); // till match CR
if($ch == "\r")
fread($fp,1); // skip the LF
$chunksize = hexdec($chunksize);
if($chunksize > 0)
没有合适的资源?快使用搜索试试~ 我知道了~
mod-globule-1.3.2-i386-linux.tar.gz_MOD
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 16 浏览量
2022-09-24
17:48:33
上传
评论
收藏 5.15MB GZ 举报
温馨提示
共57个文件
tpl:19个
php:18个
cgi:5个
内容分发网络方面,对于大型网站的分发加速有很大作用
资源推荐
资源详情
资源评论
收起资源包目录
mod-globule-1.3.2-i386-linux.tar.gz (57个子文件)
namebinding.php 4KB
chart.php 2KB
httpd-globule.conf 13KB
Globule.css 6KB
index.php 3KB
globuleutil 312KB
sections.cgi 2KB
chart-map.php 2KB
section.cgi.tpl 3KB
general.html 5KB
section-report.php 3KB
section.php.tpl 7KB
footer.inc 251B
sections.php 4KB
section.php 10KB
statistics.php.tpl 262B
general.php.tpl 3KB
resources.php.tpl 2KB
diagnostics.html 1KB
diagnostics.html.tpl 2KB
diagnostics.php 4KB
sections.cgi.tpl 2KB
globule.php 14KB
globule.png 28KB
index.html 745B
sections.php.tpl 2KB
i.png 295B
section-report.php.tpl 1KB
general.html.tpl 5KB
getinfo.php 95B
general.cgi.tpl 2KB
resources.php 5KB
statistics.php 3KB
globule.cgi 769B
general.cgi 2KB
settings.conf 33B
index.cgi 796B
index.php.tpl 864B
namebinding.php.tpl 1KB
site.png 3KB
auto.php 60B
index.cgi.tpl 816B
peers.php.tpl 2KB
index.html.tpl 746B
database.php.tpl 3KB
peers.php 4KB
header.inc 3KB
adnonsense.png 4KB
general.php 6KB
mod_globule-1.3.2.so 12.4MB
filtering.php.tpl 4KB
diagnostics.php.tpl 1KB
database.php 5KB
section.cgi 3KB
adnonsense.xcf 8KB
filtering.php 6KB
checkup.php 81B
共 57 条
- 1
资源评论
JonSco
- 粉丝: 69
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功