📄 fns_gbook.php
字号:
<?php
function eb_rescript()
{
$conn = db_connect();
$result = $conn->query("select id,content from eb_rescript where id=1");
if (!$result)
{
echo '查询数据库失败';
exit;
}
$row = $result->fetch_row();
echo $row[1];
}
function get_book_page($dat)
{
$conn = db_connect();
$result = $conn->query("select id,title,name,mail,sex,ip,dat,text,retxt from eb_gbook where dat='$dat' order by id desc");
if (!$result)
{
echo '查询数据库失败';
exit;
}
$nums = $result->num_rows;
if ($nums == '')
{
echo '数据库内无数据';
}
for ($i=1; $i<=$nums; $i++)
{
$rows = $result->fetch_row();
display_list($rows[0],$rows[1],$rows[2],$rows[3],$rows[4],$rows[5],$rows[6],$rows[7],$rows[8]);
}
}
function get_book()
{
global $web_list;
$conn = db_connect();
$result = $conn->query("select id,title,name,mail,sex,ip,dat,text,retxt from eb_gbook order by id desc");
if (!$result)
{
echo '查询数据库失败';
exit;
}
$nums = $result->num_rows;
if ($nums == '')
{
echo '数据库内无数据';
}
for ($i=1; $i<=$nums; $i++)
{
$rows = $result->fetch_row();
display_list($rows[0],$rows[1],$rows[2],$rows[3],$rows[4],$rows[5],$rows[6],$rows[7],$rows[8]);
if ($i == $web_list)
break;
}
}
function display_list($id,$title,$name,$mail,$sex,$ip,$dat,$text,$retxt)
{
?>
<table border="0" cellpadding="0" cellspacing="0" align="center" class="table_list">
<tr>
<td bgcolor="#F1F9CA">
<img src="skin/eb_images/sex_<?php echo $sex; ?>.gif" title="帅哥" />
<span class="title">标题:<?php echo $title; ?></span> </td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="40" valign="top"><img src="skin/eb_gif/fk.gif" /></td>
<td class="title_re">
<?php echo $text; ?>
<span style="color:#009933;font-size:8pt;">
[<?php
if (!($mail == ''))
{
echo '<a href="mailto:'.$mail.'">E-mail</a>';
}
if (!($name == ''))
{
echo ' 大名:<strong>'.$name.'</strong>';;
}
?>
日期:<?php echo $dat; ?> IP:<?php echo $ip; ?>]
</span>
</td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50"></td>
<td>
<?php
if (@$_SESSION['admin'] != '')
{
?>
<a href="admin_del.php?did=<?php echo $id; ?>">[删除]</a> <a href="admin_re.php?did=<?php echo $id; ?>">[回复]</a>
<?php
}
?>
<span style="background-color: #3366CC;color:#FFFFFF;">
<?php
if (!($retxt == ''))
echo ' 站长回复:'.$retxt.' ';
else
echo ' 站长回复:还未回复 ';
?></span></td>
</tr>
</table></td>
</tr>
</table>
<?php
}
function add_gbook($title,$name,$mail,$sex,$text)
{
$name = htmlspecialchars(addslashes($name));
$title = htmlspecialchars(addslashes($title));
$mail = htmlspecialchars(addslashes($mail));
$sex = htmlspecialchars(addslashes($sex));
$text = htmlspecialchars(addslashes($text));
$dat = date('Y').'/'.date('m');
$ip = getenv("REMOTE_ADDR");
$conn = db_connect();
$result = $conn->query("select dat from eb_list where dat='$dat'");
if (!$result)
{
echo '查询错误';
}
if ($result->num_rows == 0)
{
$result = $conn->query("insert into eb_list (dat) values ('$dat')");
if (!$result)
{
echo '写入数据库错误';
}
}
$result = $conn->query("insert into eb_gbook (title,name,mail,sex,ip,dat,text) values
('$title','$name','$mail','$sex','$ip','$dat','$text')");
if (!$result)
{
echo '写入数据库失败';
exit;
}
return true;
}
function page_menu()
{
$conn = db_connect();
$result = $conn->query("select dat from eb_list");
if (!$result)
{
echo '查询数据库失败';
}
$nums = $result->num_rows;
if ($nums == '')
{
echo '数据库内暂无数据';
}
for ($i=1; $i<=$nums; $i++)
{
$rows = $result->fetch_row();
echo '<a href="default_page.php?page='.$rows[0].'">'.$rows[0].'</a> ';
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -