<%@ Page Language="C#" AutoEventWireup="true" CodeFile="stat_manage.aspx.cs" Inherits="sysadmin_stat_stat_manage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>网站流量统计</title>
    <link href="../../SYSadmin/css/style.css" rel="stylesheet" type="text/css" />
    <link href="../../SYSadmin/css/neiye.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    <!--
    .tab{ clear:both; margin:0; padding:10px; width:98%; }
    .menubox { clear:both; background:url(../image/menubtn_bg.gif) repeat-x; height:28px; line-height:28px; }
    .menubox_left { float:left }
    .menubox_right { background:url(../image/menubtn_bg_right.gif) no-repeat right; width:3px; float:right }
    .menubox ul { margin:0; padding:0; }
    .menubox li { float:left; display:block; cursor:pointer; width:114px; text-align:center; color:#949694; font-weight:bold; background:url(../image/menubtn.gif); }
    .menubox li.hover { padding:0px; background:#fff; width:114px; border-left:1px solid #b8cbdc; border-top:1px solid #b8cbdc; border-right:1px solid #b8cbdc; background:url(../image/menubtn_on.gif); color:#000; font-weight:bold; height:27px; line-height:27px; }
    .contentbox { clear:both; margin-top:0px; border:1px solid #b8cbdc; border-top:none; height:465px; width:auto; overflow:auto; text-align:center; padding-top:8px; }
    .title { margin:10px; padding-left:10px; background:url(../image/titlebg.gif) #fff repeat-y; text-align:left; font-weight:bold; height:25px; line-height:25px; }
    .name { float:left; }
    .more { float:right; font-size:12px; font-weight:normal; padding-right:10px; }
    .content { margin:10px; text-align:center }
    -->
    </style>

    <script type="text/javascript">
    window.onload = function() {
        if(getCookie("id")!=null) {
            setTab(getCookie("id"), 4);
        }else{
            setTab(1, 4);
        }
    }
    function setCookie(name, value) {
        var days = 1;
        var exp = new Date(); 
        exp.setTime(exp.getTime() + days * 24 * 60 * 60 * 1000);
        document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
    }
    function getCookie(name) {
        var arr,reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
        if(arr = document.cookie.match(reg)) {
            return unescape(arr[2]);
        }else{
            return null;
        }
    }
    function setTab(id, count){
        for(var i = 1; i <= count; i++) {
            document.getElementById("sc_" + i).className = i == id ? "hover" : "";
            document.getElementById("content_" + i).style.display = i == id ? "block" : "none";
        }
        setCookie("id", id);
    }
    </script>

</head>
<body scroll="no">
    <form id="form1" runat="server">
        <div class="tab">
            <div class="menubox">
                <div class="menubox_left">
                    <ul>
                        <li id="sc_1" onclick="setTab(1, 4)">统计概况</li>
                        <li id="sc_2" onclick="setTab(2, 4)">流量分析</li>
                        <li id="sc_3" onclick="setTab(3, 4)">内容分析</li>
                        <li id="sc_4" onclick="setTab(4, 4)">访问明细</li>
                    </ul>
                </div>
                <div class="menubox_right">
                    &nbsp;</div>
            </div>
            <div class="contentbox">
                <div id="content_1">
                    <div class="title">
                        <span class="name">时段流量分析 -
                            <%=DateTime.Now.ToLongDateString() %>
                        </span><span class="more">15分钟在线：<%=iOnline %>人</span>
                    </div>
                    <div class="content">
                        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
                            width="90%" height="210">
                            <param name="movie" value="chart/chart.swf" />
                            <param name="FlashVars" value="data=chart/hour_analysis.txt" />
                            <param name="quality" value="high" />
                            <param name="WMODE" value="transparent" />
                            <embed src="chart/chart.swf" wmode="transparent" flashvars="data=chart/hour_analysis.txt"
                                quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"
                                width="90%" height="210"></embed>
                        </object>
                    </div>
                    <div class="title">
                        <span class="name">综合分析</span> <span class="more">已统计时间：<%=Stat_Days %>天</span>
                        <span class="more">开始统计时间：<%=Convert.ToString(Stat_DateTime.ToLongDateString()) %></span>
                    </div>
                    <div class="content">
                        <table cellspacing="0" cellpadding="0" style="width: 60%">
                            <tr>
                                <th width="15%">
                                </th>
                                <th width="15%" style="text-align: left;">
                                    访问量(PV)</th>
                                <th width="15%" style="text-align: left;">
                                    独立访客(UV)</th>
                                <th width="15%" style="text-align: left;">
                                    独立IP(IP)</th>
                            </tr>
                            <tr>
                                <td style="text-align: left">
                                    <strong>今日流量：</strong></td>
                                <td style="text-align: left">
                                    <%=iTodayPV %>
                                </td>
                                <td style="text-align: left">
                                    <%=iTodayUV %>
                                </td>
                                <td style="text-align: left">
                                    <%=iTodayIP %>
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align: left">
                                    <strong>昨日流量：</strong></td>
                                <td style="text-align: left">
                                    <%=iYesterdayPV %>
                                </td>
                                <td style="text-align: left">
                                    <%=iYesterdayUV %>
                                </td>
                                <td style="text-align: left">
                                    <%=iYesterdayIP %>
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align: left">
                                    <strong>平均每日：</strong></td>
                                <td style="text-align: left">
                                    <%=iAvgdayPV %>
                                </td>
                                <td style="text-align: left">
                                    <%=iAvgdayUV %>
                                </td>
                                <td style="text-align: left">
                                    <%=iAvgdayIP %>
                                </td>
                            </tr>
                            <tr>
                                <td style="height: 20px; text-align: left">
                                    <strong>最高记录：</strong></td>
                                <td style="text-align: left; height: 20px;">
                                    <%=iHighPV%>
                                </td>
                                <td style="text-align: left; height: 20px;">
                                    <%=iHighUV%>
                                </td>
                                <td style="text-align: left; height: 20px;">
                                    <%=iHighIP%>
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align: left">
                                    <strong>本月合计：</strong></td>
                                <td style="text-align: left">
                                    <%=iMonthPV%>
                                </td>
                                <td style="text-align: left">
                                    <%=iMonthUV%>
                                </td>
                                <td style="text-align: left">
                                    <%=iMonthIP%>
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align: left">
                                    <strong>流量总计：</strong></td>
                                <td style="text-align: left; font-weight: bold; color: #3399ff;">
                                    <%=iTotalPV%>
                                </td>
                                <td style="text-align: left; font-weight: bold; color: #3399ff;">
                                    <%=iTotalUV%>
                                </td>
                                <td style="text-align: left; font-weight: bold; color: #3399ff;">
                                    <%=iTotalIP%>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <br />
                </div>
                <div id="content_2" style="display: none;">
                    <div class="title">
                        <span class="name">日流量分析 -
                            <%=DateTime.Now.ToLongDateString() %>
                        </span><span class="more"></span>
                    </div>
                    <div class="content">
                        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
                            width="90%" height="210">
                            <param name="movie" value="chart/chart.swf" />
                            <param name="FlashVars" value="data=chart/day_analysis.txt" />
                            <param name="quality" value="high" />
                            <param name="WMODE" value="transparent" />
                            <embed src="chart/chart.swf" wmode="transparent" flashvars="data=chart/day_analysis.txt"
                                quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"
                                width="90%" height="210"></embed>
                        </object>
                    </div>
                    <div class="title">
                        <span class="name">月流量分析</span> <span class="more"></span>
                    </div>
                    <div class="content">
                        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
                            width="90%" height="210">
                            <param name="movie" value="chart/chart.swf" />
                            <param name="FlashVars" value="data=chart/month_analysis.txt" />
                            <param name="quality" value="high" />
                            <param name="WMODE" value="transparent" />
                            <embed src="chart/chart.swf" wmode="transparent" flashvars="data=chart/month_analysis.txt"
                                quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"
                                width="90%" height="210"></embed>
                        </object>
                    </div>
                    <div class="title">
                        <span class="name">年流量分析</span> <span class="more"></span>
                    </div>
                    <div class="content">
                        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
                            width="90%" height="210">
                            <param name="movie" value="chart/chart.swf" />
                            <param name="FlashVars" value="data=chart/year_analysis.txt" />
                            <param name="quality" value="high" />
                            <param name="WMODE" value="transparent" />
                            <embed src="chart/chart.swf" wmode="transparent" flashvars="data=chart/year_analysis.txt"
                                quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"
                                width="90%" height="210"></embed>
                        </object>
                    </div>
                    <br />
                </div>
                <div id="content_3" style="display: none">
                    <div class="title">
                        <span class="name">搜索引擎分析</span> <span class="more"></span>
                    </div>
                    <div class="content">

                        <script type="text/javascript" src="chart/swfobject.js"></script>

                        <div id="showpie">You need to upgrade your Flash Player
                        </div>

                        <script type="text/javascript">
                        var so = new SWFObject("chart/ampie.swf", "pie", "90%", "230", "8", "#ffffff");
                        so.addVariable("path", "chart/");
                        so.addVariable("settings_file", escape("chart/ampie_settings.xml"));
                        so.addVariable("data_file", "chart/search_analysis.xml");
                        so.addVariable("loading_settings", "loading settings...");
                        so.addVariable("loading_data", "loading data...");
                        so.addVariable("preloader_color", "#999999");
                        so.write("showpie");
                        </script>

                    </div>
                    <div class="title">
                        <span class="name">关键字分析</span> <span class="more"></span>
                    </div>
                    <div class="content">

                        <script type="text/javascript" src="chart/swfobject.js"></script>

                        <div id="showpie1">You need to upgrade your Flash Player
                        </div>

                        <script type="text/javascript">
                        var so = new SWFObject("chart/ampie.swf", "pie", "90%", "250", "8", "#ffffff");
                        so.addVariable("path", "chart/");
                        so.addVariable("settings_file", escape("chart/ampie_settings.xml"));
                        so.addVariable("data_file", "chart/keywords_analysis.xml");
                        so.addVariable("loading_settings", "loading settings...");
                        so.addVariable("loading_data", "loading data...");
                        so.addVariable("preloader_color", "#999999");
                        so.write("showpie1");
                        </script>

                    </div>
                </div>
                <div id="content_4" style="display: none">
                    <div class="title">
                        <span class="name">访问明细列表</span> <span class="more"></span>
                    </div>
                    <div class="content">
                        <asp:GridView ID="GridView" runat="server" AutoGenerateColumns="False" Width="95%">
                            <Columns>
                                <asp:BoundField HeaderText="时间" DataField="S_VisitDate" />
                                <asp:BoundField HeaderText="IP地址" DataField="S_IP" />
                                <asp:TemplateField HeaderText="来源网址">
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <a href="<%# Eval("S_SourceUrl") %>" target="_blank">
                                            <%# new Cls_Operation().Cutstring(Convert.ToString(Eval("S_SourceUrl")), 25)%>
                                        </a>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Left" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="访问网址">
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <a href="<%# Eval("S_VisitUrl") %>" target="_blank">
                                            <%# new Cls_Operation().Cutstring(Convert.ToString(Eval("S_VisitUrl")), 25)%>
                                        </a>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Left" />
                                </asp:TemplateField>
                                <asp:BoundField HeaderText="来源地区" DataField="S_Area" />
                            </Columns>
                            <HeaderStyle CssClass="tright" />
                        </asp:GridView>
                        <asp:Panel ID="PagePanel" runat="server" Width="95%" Height="30px" HorizontalAlign="right">
                            <div style="padding-top: 5px;">
                                <asp:Table ID="pagebar" runat="server">
                                </asp:Table>
                            </div>
                        </asp:Panel>
                        <asp:Panel ID="RecordPanel" runat="server" Width="95%" HorizontalAlign="center" Visible="False">
                            <br />
                            <asp:Label ID="nologs" runat="server" BackColor="Transparent" Font-Bold="True" ForeColor="Red"
                                Text="暂无访问明细!"></asp:Label>
                            <br />
                        </asp:Panel>
                    </div>
                </div>
            </div>
        </div>
    </form>
</body>
</html>
