📄 allview.jsp.bak
字号:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*,Db_sql"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.util.Hashtable"%>
<%@ page import="com.stevesoft.pat.*"%>
<%
String strSql;
String strURL;
Db_sql db = null;
int pg_row_num=25;
int max_pg_num = 0;
int pg;
int pos;
boolean bType = false;
String strType = "";
String strTypeNo = "";
String TYPE[] = {"电 脑 网 络", "休 闲 娱 乐","生 活 资 讯", "游 戏 天 地",
"社 科 艺 术", "文 化 教 育", "情 感 天 地", "工 商 财 经",
"自 然 科 学", "医 疗 保 健", "运 动 体 育", "新 闻 时 事",
"信 息 电 子", "其 它 类 别"};
if (request.getParameter("pg") != null)
pg = Integer.parseInt(request.getParameter("pg")) - 1;
else
pg = 0;
if (request.getParameter("type") != null)
{
bType = true;
strTypeNo = request.getParameter("type");
try {
strType = TYPE[Integer.parseInt(strTypeNo)];
} catch(Exception e) { return; }
}
%>
<html>
<head>
<META HTTP-EQUIV="refresh" CONTENT="60" URL="online.jsp">
<title>中华网---个人主页分类平均排名</title>
<style type="text/css">
<!--
body.t{ font-family: "宋体", "Arial", "Times New Roman"; font-size: 9pt;
line-height: 150%; letter-spacing: 1px}
.tt3{ font-family: "!宋体", "!Arial", "!Times New Roman"; font-size:11pt;
line-height: 130%; color: #000000;}
TD {
COLOR: #333300; FONT-SIZE: 9pt
}
.big { font-size: 11pt; font-family: "宋体"}
-->
</style></head>
<BODY bgColor=#FFFFFF link="#003366" vlink="#003366" alink="#003366">
<DIV align=left class="big">
<table width="650" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="163"><a href="http://home4u.china.com/" target=_blank><img src="images/logohome.gif" width="143" height="87" border="0"></a></td>
<td width="437"><a href="http://home4u.china.com/" target=_blank><img
alt=申请home4u border=0 height=60 src="http://home4u.china.com/images/home4ubanner.gif"
width=468></a></td>
</tr>
</table>
<table width="650" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/topedge.gif" width="650" height="9"></td>
</tr>
</table>
<table width="650" border="0" align="center" cellpadding="5" cellspacing="0" bgcolor="#FFE8D0">
<tr>
<td>
<p>
<p>
<table border=0 cellspacing=0 width=99% align="center" bgcolor="#FFCC99" cellpadding="5">
<tr><td width="17%" valign="top">
<div align="center">
<img src="images/pai.gif" width="70" height="90"></div>
<div align="center"><b>分类平均排名</b></div>
<%
//显示分类
int j=0;
while(j<TYPE.length){
%>
<a href="allview.jsp?type=<%=j%>">
<div align="center">
<% out.println(TYPE[j]);%></div></a>
<% j+=1;
}
%>
<a href="allview.jsp"><div align="center">总 排 名</div></a>
</td>
<td width="85%" bgcolor="#ffffff" valign="top">
<%
try {
// db = new Db_sql("10.1.1.202","1521","oracle8","home4u","home4u");
db = new Db_sql("202.84.10.191","7137","appdb","liu","liujie8");
/*
strSql = "select count(t2.username) as total from stat t1,userinfo t2 ";
strSql += " where t1.puid=t2.username ";
if (bType) strSql += " and t2.category= '" + strType + "' ";
strSql += " and not t2.category is null ";
strSql += " and rownum<=100 order by avghits desc ";
*/
strSql = "select count(*) as total from (select * from (select t2.username,t2.title,t1.starttime,t1.totalhits,round(SYSDATE-starttime)+1 as days,t1.avghits,t1.sitetype from stat t1,userinfo t2 ";
strSql += " where t1.puid=t2.username ";
if (bType) strSql += " and t2.category= '" + strType + "' ";
strSql += " order by t1.avghits desc) where rownum <= 100) ";
db.query(strSql);
db.next();
int iTotal = db.getInt("total");
strSql = "select * from (select t2.username,t2.title,t1.starttime,t1.totalhits,round(SYSDATE-starttime)+1 as days,t1.avghits,t1.sitetype from stat t1,userinfo t2 ";
strSql += " where t1.puid=t2.username ";
if (bType) strSql += " and t2.category= '" + strType + "' ";
strSql += " order by t1.avghits desc) where rownum <= 100 ";
db.query(strSql);
if (iTotal<=0)
{
}
else {
if(iTotal % pg_row_num==0)
max_pg_num=iTotal/pg_row_num;
else
max_pg_num=iTotal/pg_row_num+1;
if(pg<1)
pg=0;
if(pg>max_pg_num)
pg=max_pg_num;
for (int i=0;i<pg;i++)
{
for (j=0;j<pg_row_num;j++)
db.next();
}
pos = pg * pg_row_num;
%>
<br>
<table align="center" border="0" width="100%" bgcolor="#FFFFFF" cellspacing="0"
cellpadding="2" class="tt3">
<tr bgcolor=#4e4e82>
<td align="center"><font color="f0f0f0">名次</font></td>
<td align="center"><font color="f0f0f0">站点名称</font></td>
<td align="center"><font color="f0f0f0">登记时间</font></td>
<td align="right"><font color="f0f0f0">平均人数</font></td>
<td align="right"><font color="f0f0f0">总人数</font></td>
<td align="right"><font color="f0f0f0">天数</font></td>
<td align="center"><font color="f0f0f0">网站类别</font></td>
</tr>
<%
int iCount = 0;
int iCount1 = 0;
while (db.next() && iCount<pg_row_num) {
iCount++;
iCount1=pos+iCount;
//从username获得dns 绝对路径
strURL = "http://" + db.getString("username") + ".at.china.com";
%>
<tr>
<td align="left">
<% out.println(iCount1); %></td>
<td align="center"><a href=<% out.println(strURL);%> target="_blank">
<% out.println(db.getString("title"));%></a></td>
<td align="center"><% out.println(db.getDate("starttime"));%> </td>
<td align="right"><% out.println(db.getInt("totalhits") / db.getInt("days"));%> </td>
<td align="right"><% out.println(db.getInt("totalhits"));%></td>
<td align="right"><% out.println(db.getInt("days"));%></td>
<td align="center"><% out.println(db.getString("sitetype"));%></td>
</tr>
<%}
%>
</table>
<p>
<table class="tt3" border="0" width="80%" align="center" cellspacing="0" cellpadding="0">
<tr>
<td width="80%" height="60" align="right">
<% int k=0;
String strTemp = "";
if (bType) strTemp = "&type=" + strTypeNo;
while (k < max_pg_num){
%>
<a href="allview.jsp?pg=<% out.println((k+1) + strTemp); %>">
第 <% out.println(k+1); %>页</a>
<% k++;}
%>
</td>
</tr>
</table>
<%
}
} finally
{
try { db.close(); } catch(Exception e) {}
}
%>
</td></tr></table>
</td></tr></table>
</DIV>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -