本文实例为大家分享了PHP留言板功能的具体代码,供大家参考,具体内容如下
数据库用到的三张表
一.登录界面 (denglu.PHP login.PHP)
1.denglu.PHP
2.login.PHP
PHP;">
require "DBDA.class1.php";
$db = new DBDA();
$sql = "select PassWord from yuangong where UserName = '{$UserName}'";
$arr = $db->query($sql);
$db = new DBDA();
$sql = "select PassWord from yuangong where UserName = '{$UserName}'";
$arr = $db->query($sql);
if(count($arr))
{
if($arr[0][0] == $PassWord && !empty($PassWord))
{
//存储用户名
$_SESSION["UserName"] = $UserName;
header("location:main.<a href="https://www.jb51.cc/tag/PHP/" target="_blank" class="keywords">PHP</a>");
}
}
else
{
header("location:denglu.PHP");
}
二.主界面(main.PHP tuichu.PHP)
1.main.PHP
if(empty($_SESSION["UserName"]))
{
header("location:denglu.php");
exit;
}
require "DBDA.class1.php";
$db = new DBDA();
$UserName = $_SESSION["UserName"];
?>