【php开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了php开源代码-showVisit.php的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
<?php require_once('Connections/connCounter.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$maxRows_RecVisit = 10;
$pageNum_RecVisit = 0;
if (isset($_GET['pageNum_RecVisit'])) {
$pageNum_RecVisit = $_GET['pageNum_RecVisit'];
}
$startRow_RecVisit = $pageNum_RecVisit * $maxRows_RecVisit;
mysql_select_db($database_connCounter, $connCounter);
$query_RecVisit = "SELECT * FROM
webcount ORDER BY count_time DESC";
$query_limit_RecVisit = sprintf("%s LIMIT %d, %d", $query_RecVisit, $startRow_RecVisit, $maxRows_RecVisit);
$RecVisit = mysql_query($query_limit_RecVisit, $connCounter) or die(
mysql_error());
$row_RecVisit = my
sql_fetch_assoc($RecVisit);
if (isset($_GET['totalRows_RecVisit'])) {
$totalRows_RecVisit = $_GET['totalRows_RecVisit'];
} else {
$all_RecVisit = mysql_query($query_RecVisit);
$totalRows_RecVisit = mysql_num_rows($all_RecVisit);
}
$totalPages_RecVisit = ceil($totalRows_RecVisit/$maxRows_RecVisit)-1;
?><!DOCTYPE html PUBLIC "-//W3C//DTD X
HTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>最近 10 条访客资料</title>
<style type="text/css">
<!--
p {
font-size: 10pt;
line-height: 120%;
margin-bottom: 10px;
}
tr td {
font-size: 10pt;
line-height: 120%;
}
.head {
line-height: 24px;
background-image: url(images/headback1.jpg);
background-repeat: repeat-x;
font-size: 10pt;
font-weight: bold;
color: #FFFFFF;
font-family: "宋体";
}
-->
</style>
</head>
<body bgcolor="#F0F0F0">
<p>网站浏览总人数:<?php echo $totalRows_RecVisit ?> ,最后记录时间为<?php echo $row_RecVisit['count_time']; ?>:。<br />
以下为最近 10 条访客资料:</p>
<table width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#000000">
<tr bgcolor="#0066CC">
<td height="24"><font color="#FFFFFF">访客 IP </font></td>
<td height="24"><font color="#FFFFFF">访客登录时间</font></td>
</tr>
<?php do { ?>
<tr>
<td height="24" bgcolor="#FFFFFF"><?php echo $row_RecVisit['count_ip']; ?></td>
<td height="24" bgcolor="#FFFFFF"><?php echo $row_RecVisit['count_time']; ?></td>
</tr>
<?php } while ($row_RecVisit = mysql_fetch_assoc($RecVisit)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($RecVisit);
?>