p
數據庫結構
表一: admin
字段: id(int
表二: lo
字段: id(int
<?php
mysql_connect(
mysql_select_db(
?>
復制代碼 代碼如下:
<!DOCTYPE html PUBLIC
<html xmlns=
<head>
<meta http
<title>銀子留言板 Version
</head>
<link rel=
<body>
<?php session_start(); ?>
<div id=
<div id=
<ul>
<li><a >偶要看留言</a></li>
<li><a >偶要發表</a></li>
<?php
//session_start();//DOFY同學指出本句前不能有任何輸出內容
if($_SESSION[
?>
<li><a >退出管理</a></li>
<?
}
else
{
?>
<li><a >偶要管理</a></li>
<?}?>
</ul>
</div>
<div id=
</div>
復制代碼 代碼如下:
<?php
$counterFile=
function displayCounter($counterFile){
$fp = fopen($counterFile
$num = fgets($fp
$num +=
print
exec(
exec(
}
if(!file_exists($counterFile)){
exec(
}
displayCounter($counterFile);
?>
</body>
</html>
復制代碼 代碼如下:
<?php
require_once(
require_once(
session_start();
//分頁代碼開始
$pagesize =
$rs = mysql_query(
$myrow = mysql_fetch_array($rs);
$numrows = $myrow[
$pages = intval($numrows/$pagesize);
if($numrows%$pagesize)$pages++;//設置頁數
if(isset($_GET[
{
$page = intval($_GET[
}
else
{
$page =
}
$offset = $pagesize*($page
//分頁代碼結束
$sql =
$result = mysql_query($sql);
$num = mysql_num_rows($result);
if($num>
while($row = mysql_fetch_array($result))
{
//echo print_r($row);
if($row[
{
$sex =
}
else
{
$sex =
}
?>
<div id=
<p class=
<p class=
<p class=
<div id=
</div>
<?php
}
}
else
{
echo
}
?>
<div id=
<p>
<?php
$first=
$prev=$page
$next=$page+
$last=$pages;
if($page==
{
echo
echo
echo
echo
}
elseif($page>=
{
echo
echo
echo
echo
}
elseif($page==$pages&&$page!=
{
echo
echo
echo
echo
}
elseif($page==$pages)
{
echo
echo
echo
echo
}
else
{
echo
echo
echo
echo
}
?>
共 <span><?= $pages ?></span> 頁 | 當前第 <span><?= $page ?></span> 頁 | 共 <span><?=$numrows ?></span> 條留言</p>
</div>
<?php
mysql_close();
?>
<?php
require_once(
?>
From:http://tw.wingwit.com/Article/program/PHP/201405/30967.html