精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>● PHP>>功能代码>>留言板>> 转载一个php操作mysql的留言版的例子2

主题: 转载一个php操作mysql的留言版的例子2
发信人: zawenhui()
整理人: jackyz(2000-08-10 12:20:14), 站内信件
//index.php代码如下:
<?php
if(empty($GBName))
{
setcookie( "GBName", $name, time()+99999999);
$GBName=$name;
}

if(empty($GBEmail))
{
setcookie( "GBEmail", $email, time()+99999999);
$GBEmail=$email;
}
include ("./connect.inc.php3");
include("$header");
include ("./theme.inc.php3");

if ($show < 1) {
include ("./form.inc.php3");
}
else {
print "<center><a href=\"$PHP_SELF\">$submit ";
}

if (!isset($show)) $show=0;
{
  $result1 = mysql_query("select Count(*) as total from $userstable") 

or die(mysql_error());
  $row=mysql_fetch_Array($result1); 
  $total=$row[total];
}

if ($show < $total){
$query = "select * from $userstable order by id desc limit $show, $lim

it";
$result = mysql_query($query);
$number = mysql_numrows($result);
}

elseif ($show = all){
$query = "select * from $userstable order by id desc";
$result = mysql_query($query);
$number = mysql_numrows($result);
}

$i = 0;

if ($number == 0){
print "<center>$no_entry</center>";
}

elseif ($number > 0) {
print "<p align=\"center\">$total_entries: $total </p><br><br>";

        while ($i < $number){

$row = mysql_fetch_array($result);
$name = stripslashes($row[name]);
$email = $row[email];
$url = $row[url];
$title = stripslashes($row[title]);
$body = stripslashes(nl2br($row[body]));
$host = $row[host];
$date = $row[date];


print "<table border=0 cellspacing=0 cellpadding=3 width=\"800\">";
print "<tr><td width=100% align=\"left\">$name1: <a href=\"mailto:

$email\">$name<br>";
if ($host == ""){
print "";
}
else {
print " $from_host $host";
}
print "<br>$am $date
</td></tr>";
print "<td width=100% align=\"left\">$hp1: <a href=\"$url\">$url</

td></tr>";
print "<td width=100% align=\"left\">$hptitle:$title</td></

tr>";
print "<td width=100% align=\"left\">$comment:<br>$body</td></tr>";
print "</table><hr width=50%>";             
print "<br><br>";

                $i++;

        }
}
include ("./pages.inc.php3");
include("$footer");
?>
《待续》


--
████████████████████████████████
█  ╭──────────────────────────╮  █
█  │最憎人对住我讲英文,最憎人讲日文,最憎人偏偏唔识讲广│  █
█  │州话,使乜望住我啊,就系讲紧你。                    │  █
█  │~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~            │  █
█  │ oicq:9880798                                       │  █

※ 修改:.zawenhui 于 Jun 17 09:43:17 修改本文.[FROM: 202.104.73.145]
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.104.73.145]

[关闭][返回]