Example #1
0
    $info = file($count_file);
    $info_all = count($info);
    list($php_code, $yesterday, $today, $month, $total, $all_day, $top_day, $top_day_time, $top_online, $top_online_time, $mode, $time, $pass, $pagename, $pageurl, $ip1, $bak_num) = explode("|", $info[0]);
    if ($all_day > 0) {
        $day = ceil($total / $all_day);
    }
    if ($time != "") {
        $today_max = ceil($today * 86400 / (date("H", $time) * 3600 + date("i", $time) * 60 + date("s", $time)));
    }
    //预计今日访问量
    echo "\r\n<div align=left>\r\n>>帐号名称: <a href='{$pageurl}' target=blank>{$id}</a><br>\r\n>>站点名称: <a href='{$pageurl}' target=blank>{$pagename}</a></div>\r\n";
    if (($_COOKIE[STAT_BOOM_ID] == "index" or $_COOKIE[STAT_BOOM_ID] == $id) and $_COOKIE[STAT_BOOM_PASSWORD]) {
        //已经登陆
        echo "| <a href='?id={$id}&m=edit'>修改资料</a> | <a href='?id={$id}&m=del'>注销帐号</a> |<br>恢复备份<b>{$bak_num}</b> 次<br>";
    }
    echo "\r\n<table width=290 align=center cellspacing=1 cellpadding=3 class=tab1>\r\n<tr><td colspan=2 align=center><b>访问信息统计</b></td></tr>\r\n<tr><td>今日访问量</td><td align=right>{$today}</td></tr>\r\n<tr><td>预计今日访问量</td><td align=right>{$today_max}</td></tr>\r\n<tr><td>昨日访问量</td><td align=right>{$yesterday}</td></tr>\r\n<tr><td>本月访问量</td><td align=right>{$month}</td></tr>\r\n<tr><td>总 访问量</td><td align=right>{$total}</td></tr>\r\n<tr><td>总统计天数</td><td align=right>{$all_day} 天</td></tr>\r\n<tr><td>日均访问量</td><td align=right>{$day}</td></tr>\r\n<tr><td>最高日访问量 {$top_day}</td><td align=right>统计日期:{$top_day_time}</td></tr>\r\n</table>\r\n<br>\r\n<table width=540 align=center cellspacing=1 cellpadding=3 class=tab2>\r\n<tr style='background-color: ffffff'><td colspan=5 align=center><b>最后{$config[info_max]}位访客信息记录</b></td></tr>\r\n<tr style='background-color: eeeeee'><td width=20></td><td width=90>时间</td><td width=80>IP地址</td><td width=75 align=center>地理位置</td><td>来访页面</td></tr>\r\n";
    $bgcolor = 255;
    for ($i = $info_all - 1; $i > 0; $i--) {
        list($time, $ip, $locality, $from) = explode("|", $info[$i]);
        $time = date("Y-m-d H:i", $time);
        if (strlen($from) > 40) {
            $from_show = substr($from, 0, 36) . " ...";
        } else {
            $from_show = $from;
        }
        echo "<tr bgcolor=" . base_convert($bgcolor, 10, 16) . base_convert($bgcolor, 10, 16) . base_convert($bgcolor, 10, 16) . "><td width=15 class=small align=right>{$i}</td><td width=90 class=small>{$time}</td><td width=80 class=small>{$ip}</td><td width=75 align=center>{$locality}</td><td class=small><a href='{$from}' title='{$from}'>{$from_show}</a></td></tr>\n";
        $bgcolor--;
    }
    echo "</table>当前时间:" . date("Y-m-d H:i:s") . "  |  您的IP:" . guest_ip();
}
include "bottom.php";
Example #2
0
function php_count($id = "index", $type = "", $image = "1", $path = "")
{
    require "config.php";
    $from = check($_SERVER[HTTP_REFERER]);
    $count_file = "{$path}{$config[dir]}/{$id}.php";
    //数据文件
    $count_bak_file = "{$path}{$config[dir]}/{$id}.bak.php";
    //备份数据文件
    if (!file_exists($count_file)) {
        //如果数据文件不存在
        if ($config[mode] == b) {
            $fp = fopen($count_file, "w");
            chmod("{$count_file}", 0666);
            fputs($fp, "{$php_code}|0|0|0|0|0|0||||||||http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}||||||");
            fclose($fp);
            $fp = fopen("{$config['dir']}/list.txt", "a");
            flock($fp, LOCK_EX);
            fputs($fp, "{$id}\n");
            fclose($fp);
        } else {
            echo "<font color=ff0000>帐号<b>{$id}</b>不存在</font>";
            exit;
        }
    }
    $info = file_myfun($count_file);
    if (!$info[0]) {
        //数据为0则使用备份数据文件
        $info = file_myfun($count_bak_file);
        $bak = "0";
    }
    $info_all = count($info);
    list(, $yesterday, $today, $month, $total, $all_day, $top_day, $top_day_time, $top_online, $top_online_time, $mode, $time1, $pass, $pagename, $pageurl, $ip1, $bak_num) = explode("|", $info[0]);
    $time = time();
    if ($bak == "0") {
        $bak_num++;
    }
    if (!$_COOKIE["STAT_BOOM_{$id}"] or $_COOKIE["STAT_BOOM_{$id}"] != $id) {
        //判断防止刷新
        $yx_time = $time + $config[jgtime];
        setcookie("STAT_BOOM_{$id}", "{$id}", "{$yx_time}", "{$_SERVER['PHP_SELF']}");
        if (date("d", $time1) != date("d", $time)) {
            //判断是否同一天
            $all_day++;
            $yesterday = $today;
            $today = 1;
            if ($bak != "0") {
                copy($count_file, $count_bak_file);
            }
        } else {
            $today++;
        }
        if (date("m", $time1) != date("m", $time)) {
            //判断是否同一月
            $month = 1;
        } else {
            $month++;
        }
        if ($today > $top_day) {
            $top_day = $today;
            $top_day_time = date("Y-m-d");
        }
        $total++;
        $ip = guest_ip();
        $locality = convert_ip($ip);
        //************************** 写入新数据 **************************//
        $fp = fopen($count_file, "w");
        flock($fp, LOCK_EX);
        fputs($fp, "{$php_code}|{$yesterday}|{$today}|{$month}|{$total}|{$all_day}|{$top_day}|{$top_day_time}|{$top_online}|{$top_online_time}|{$mode}|{$time}|{$pass}|{$pagename}|{$pageurl}|{$ip}|{$bak_num}|||\n");
        if ($info_all > $config[info_max]) {
            $i = $info_all - $config[info_max] + 1;
        } else {
            $i = 1;
        }
        for ($i; $i < $info_all; $i++) {
            $info[$i] = trim($info[$i]) . "\n";
            fputs($fp, $info[$i]);
        }
        fputs($fp, "{$time}|{$ip}|{$locality}|{$from}|\n");
        fclose($fp);
    }
    //************************** 显示信息 **************************//
    if ($type == img) {
        $count = $total;
        $len = strlen($count);
        //总访量位数
        if ($len < 7) {
            $rest = 7 - $len;
        } else {
            $rest = 2;
        }
        for ($i = 1; $i <= $rest; $i++) {
            $count = "0" . $count;
            //补足0
        }
        for ($i = 0; $i < strlen($count); $i++) {
            $number = substr($count, $i, 1);
            $images = "<img src='{$config[url]}images/number/{$image}/{$number}.gif' border=0>";
            $show = "{$show}" . "{$images}";
        }
        echo "<A href='{$config[url]}index.php?id={$id}' title='-=BOOM流量统计2.9=-&#10;今日:{$today} | 昨日:{$yesterday}'>{$show}</A>";
    } elseif ($type == move) {
        echo "<table width='88' border='0' cellspacing='1' cellpadding='2' height='31' background='{$config[url]}/images/logo/{$image}.gif'>";
        echo "  <tr height=14><td align='center' valign='top'><marquee scrollDelay='50' scrollAmount='2'>";
        echo "    <a href='{$config[url]}index.php?id={$id}' target=blank style='FONT-FAMILY:Arial, Verdana; font-size: 9pt; color: #ffffff; text-decoration: none'>总访问量:" . $total . " 本月访问:" . $month . " 今日访问:" . $today . "</a></marquee></td></tr>";
        echo "  <tr height=8><td></td></tr></table>";
    } elseif ($type == ico) {
        echo "<A href='{$config[url]}index.php?id={$id}'><IMG src='{$config[url]}/images/ico/{$image}.gif' border=0 title='-=BOOM流量统计2.9=-&#10;今日:{$today} | 昨日:{$yesterday}'></A>";
    } elseif ($type == hide) {
    } else {
        echo "<A href='{$config[url]}index.php?id={$id}' title='-=BOOM流量统计2.9=-&#10;昨日:{$yesterday} | 本月:{$month}'>今日访问:{$today} 总访问量{$total}</A>";
    }
}
Example #3
0
     }
 } else {
     $today++;
 }
 if (date("m", $time1) != date("m", $time)) {
     //判断是否同一月
     $month = 1;
 } else {
     $month++;
 }
 if ($today > $top_day) {
     $top_day = $today;
     $top_day_time = date("Y-m-d");
 }
 $total++;
 $ip = guest_ip();
 $locality = convert_ip($ip);
 //************************** 写入新数据 **************************//
 $fp = fopen($count_file, "w");
 flock($fp, LOCK_EX);
 fputs($fp, "{$php_code}|{$yesterday}|{$today}|{$month}|{$total}|{$all_day}|{$top_day}|{$top_day_time}|{$top_online}|{$top_online_time}|{$mode}|{$time}|{$pass}|{$pagename}|{$pageurl}|{$ip}|{$bak_num}|||\n");
 if ($info_all > $config[info_max]) {
     $i = $info_all - $config[info_max] + 1;
 } else {
     $i = 1;
 }
 for ($i; $i < $info_all; $i++) {
     $info[$i] = trim($info[$i]) . "\n";
     fputs($fp, $info[$i]);
 }
 fputs($fp, "{$time}|{$ip}|{$locality}|{$from}|\n");