主要语言
PHP MySQL JavaScript CSS 原生
运行截图
用户登录

if (!empty($_POST)) {//是否点击提交if (!empty($_POST['username']) && !empty($_POST['password'])) {if($_SESSION["code"]==$_POST['code']){//查询是否有该用户$sql = "select * from admin where username='" . $_POST['username'] . "' and password='" . $_POST['password'] . "'";$result = mysqli_query($conn, $sql);$user=mysqli_fetch_object($result);//存储Username$_SESSION['name'] = $user->username;//判断if($user){echo "<script>alert('登录成功!');window.location.href='index.php'</script>";}else{echo "<script>alert('用户名或密码错误,登录失败');window.location.href='mlogin.php'</script>";}}else{echo "<script>alert('验证码错误,登录失败');window.location.href='mlogin.php'</script>";}} else {echo "<script>alert('请完善信息!');window.location.href='mlogin.php'</script>";}}
用户注册

//导入数据库连接文件include('./conn/conn.php');//数据库插入语句$sql="insert into `admin` (`username`,`password`) values ('".$_POST['username1']."','".$_POST['password1']."');";$str=mysqli_query($conn,$sql);//判断结果if($str){echo "<script>alert('用户注册成功!');window.location.href='login.php'</script>";}else{echo "<script>alert('用户注册失败!请稍后重试');window.location.href='login.php'</script>";};
留言列表

//防止报错error_reporting(0);require_once './conn/conn.php';session_start();//数据分页$per_page=3;$sql="select * from comment";$str = mysqli_query($conn, $sql);$total=mysqli_num_rows($str);$_SESSION['total'] = $total;
添加留言

//引入文件include './conn/conn.php';if(!empty($_POST)){//数据库代码$sql = "INSERT INTO `comment`(`poster`,`mail`,`comment`,`date`) VALUES ('".$_POST['poster']."','".$_POST['mail']."','".$_POST['comment']."',now()); ";$result = mysqli_query($conn, $sql);//判断结果if($result){echo "<script>alert('录入成功!');window.location.href='index.php'</script>";}else{echo "<script>alert('请稍后重试!');window.location.href='index.php'</script>";}}
留言查询

$sql1 = "select * from comment where poster like '%".$_POST['text']."%'";$result1 = mysqli_query($conn, $sql1);// $user1=mysqli_fetch_object($result1);$total=mysqli_num_rows($result1);if($_POST['text']){if($total!=0){<table border="1px" ><th colspan="7" style="color:black;font-weight: bold;">查询结果</th>

解锁后完整源码含数据库将在下方展示
原文作者:麻了秃头;如有侵权,请联系管理员删除。