分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 前端开发

0619PHP练习:简单留言板

发布时间:2023-09-06 02:00责任编辑:蔡小小关键词:PHP留言板

登陆页面=============================================================================================================================

<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<link rel="stylesheet" type="text/css" href="public/bootstrap.min.css"/>
<script src="public/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>
<script src="public/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
<style type="text/css">
*{
margin: 0px auto;
padding: 0px;
}
.box{
width: 500px;
height: 350px;
border: 1px solid gray;
border-radius: 5px;

}
.box_title{
width: 100%;
height: 50px;

text-align: center;

}
.box_id{
margin-left: 100px;

}
.form-control{
width: 300px;

}
.box_but{
width: 200px;

}
</style>
</head>
<body>
<div >
<div >开发部内部留言板</div>
<div >
<label>账号:</label>
<input type="text" placeholder="请输入账号" >
<label>密码:</label>
<input type="password" placeholder="请输入密码" >
</div>
<div >
<button >&nbsp;&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;&nbsp;</button>
<button >&nbsp;&nbsp;复&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;位&nbsp;&nbsp;</button>
</div>
</div>
</body>
</html>
<script type="text/javascript">
/*登陆======================================================================*/
function denglu(){
var nid = document.getElementById("nid").value;
var npa = document.getElementById("npa").value;
$.ajax({
type:"post",
url:"dlcl.php",
async:true,
data:{
typ:"denglu",
nid:nid,
npa:npa
},
dataType:"text",
success:function(dl){
if(dl == "yes"){
window.location.href = "zhuye.php";
}else if(dl == "no"){
alert("密码错误,请重新输入!");
}else if(dl == "ik"){
alert("请输入账号!");
}else if(dl == "mk"){
alert("请输入密码!");
}
}
});
}
/*登陆======================================================================*/
</script>

登陆页面=============================================================================================================================

主页面===============================================================================================================================

<?php
session_start();
if(empty($_SESSION[‘bsa‘])){
header(‘Location:denglu.php‘);
die;
}
?>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<link rel="stylesheet" type="text/css" href="public/bootstrap.min.css"/>
<script src="public/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>
<script src="public/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
<style type="text/css">
*{
margin: 0px auto;
padding: 0px;
}
body{
-moz-user-select: none;
}
.title{
width: 1260px;
}
.title_box{
height: 60px;

text-align: left;
line-height: 60px;
margin-left: 20px;
}
.nav{
width: 1260px;
border: 1px solid gray;
border-radius: 5px 5px 0px 0px;
}
.nav_box{
width: 500px;
height: 50px;
margin-left: 20px;
}
.nav_but{
width: 100px;
height: 30px;

float: left;
line-height: 27px;
text-align: center;
margin-left: 51px;
margin-right: 80px;
border: 1px solid gray;
border-radius: 5px;
}
.nav_but:hover{
cursor: pointer;
}
.nav_text{
height: 30px;

float: left;
line-height: 30px;
}
.room{
width: 1260px;
height: 500px;
border: 1px solid gray;
border-radius: 0px 0px 5px 5px;
}
.room_boxa{
width: 200px;
height: 450px;

margin-left: 20px;
float: left;
border: 1px solid gray;
border-radius: 5px;
}
.room_but{
width: 100px;
height: 30px;

line-height: 27px;
text-align: center;
border: 1px solid gray;
border-radius: 5px;
}
.room_but:hover{
cursor: pointer;
}
.room_boxb{
width: 1000px;
height: 450px;

margin-left: 20px;
float: left;
border: 1px solid gray;
border-radius: 5px;
}
#fybut{

text-align: center;
}
.fysp{
cursor: pointer;
}
.room_room{
height: 393px;
border-bottom: 1px solid #DEE2E6;
}
.neirong{
width: 175px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.xiangqing:hover{
cursor: pointer;
}
.room_boxc{
width: 998px;
height: 450px;
margin: 20px;
float: left;
display: none;
border: 1px solid gray;
border-radius: 5px;
}
.boxc_title{
width: 150px;
float: left;
border-right: 1px solid #DEE2E6;
}
.boxc_count{
width: 846px;
float: left;
}
.nrxq{
height: 300px;
}
.fanyebox{

}
</style>
</head>
<body>
<div >
<div >
开发部内部留言板
</div>
</div>
<div >
<div >
<div >退出系统</div>
<div ><span style="color: red;"><?php echo $_SESSION[‘bsa‘];?></span> 欢迎您登陆本系统</div>
</div>
</div>
<div >
<div >
<div data-toggle="modal" data-target="#myModal">发布信息</div>
<div >所有信息</div>
</div>
<div >
<div >
<table >

</table>
</div>
<table >
<tr>
<td id = ‘fybut‘></td>
</tr>
</table>
</div>
<div >
<table >
<tr><td>发送人</td></tr>
<tr><td>接收人</td></tr>
<tr><td>发送时间</td></tr>
<tr style="height: 300px;"><td>内容</td></tr>
</table>
<table >

</table>
</div>
</div>
<!-- 模态框 -->
<div >
<div >
<div >

<!-- 模态框头部 -->
<div style="width: 420px;">
<h4 >发布信息</h4>
<button type="button" data-dismiss="modal">&times;</button>
</div>

<!-- 模态框主体 -->
<div style="width: 420px;">
<label>接收人:</label>
<input id = "addid">
<label>内容:</label>
<textarea rows="10" id = "addtext"></textarea>
</div>

<!-- 模态框底部 -->
<div style="width: 420px;">
<button type="button" data-dismiss="modal" >提交</button>
</div>

</div>
</div>
</div>
</body>
</html>
<script type="text/javascript">
var fybut = 0;
var fb = 0;
var fbz = 0;
chaxun();
function chaxun(){
var xianshi = "7";
$.ajax({
type:"post",
url:"dlcl.php",
async:true,
data:{
typ:"chaxun",
xianshi:xianshi,
fybut:fybut
},
dataType:"json",
success:function(x){
var str = "<tr><td><div>时间</div></td><td><div>发送人</div></td><td><div>接收人</div></td><td><div>内容</div></td><td><div>查看状态</div></td></tr>";
for (var i =0;i < x.length;i++) {
str += "<tr>"
for (var j = 0; j < x[i].length;j++) {
if(x[i][j] == ""){
x[i][j] = "所有人";
}else if(x[i][j] == "0"){
x[i][j] = "未查看";
}else if(x[i][j] == "1"){
x[i][j] = "已查看";
}
if(j == 0){

}else if(j == 4){
str += "<td class = ‘xiangqing‘ onclick = ‘xiangqing(\""+x[i][0]+"\")‘><div class = ‘neirong‘>" + x[i][j] + "</div></td>";
}else{
str += "<td><div class = ‘neirong‘>" + x[i][j] + "</div></td>";
}
}
str += "</tr>"
}
document.getElementsByClassName("room_count")[0].innerHTML = str;
}
});
$.ajax({
type:"post",
url:"dlcl.php",
async:true,
data:{
typ:"fybut"
},
dataType:"json",
success:function(x){
var attrbut = "";
for (var i = 0;i < x.length/xianshi;i++) {
if(i == fb){
attrbut += "<span class = ‘fysp‘ onclick = ‘fenyea(\""+i+"\")‘>上一页 </span><span>" + (i+1) + " / " + Math.ceil(x.length/xianshi) + "</span><span class = ‘fysp‘ onclick = ‘fenyeb(\""+i+"\")‘> 下一页 </span>&nbsp;&nbsp;&nbsp;第 <input class = ‘fyroom‘ type = ‘text‘ style = ‘width:20px;height:20px‘></input> 页 <span class = ‘fysp‘ onclick = ‘fenyec()‘>跳转 </span>";
}
fbz = Math.ceil(x.length/xianshi);
}
document.getElementById("fybut").innerHTML = attrbut;
}
});
}
function fenyea(){
fb -= 1;
if(fb < 0){
fb = 0;
}
fybut -= 1;
if(fybut < 0){
fybut = 0;
}
chaxun();
}
function fenyeb(){
fb += 1;
if(fb > fbz-1){
fb = fbz-1;
}
console.log(fb)
fybut += 1;
if(fybut > fbz-1){
fybut = fbz-1;
}
chaxun();
}
function fenyec(){
fb = document.getElementsByClassName("fyroom")[0].value-1;
if(fb > fbz-1){
fb = fbz-1;
}else if(fb < 0){
fb = 0;
}
fybut = document.getElementsByClassName("fyroom")[0].value-1;
if(fybut > fbz-1){
fybut = fbz-1;
}else if(fybut < 0){
fybut = 0;
}
chaxun();
}
function zhuxiao(){
$.ajax({
type:"post",
url:"dlcl.php",
async:true,
data:{
typ:"zhuxiao"
},
dataType:"text",
success:function(x){
window.location.href = "denglu.php";
}
});
}
function fabu(){
var addid = document.getElementById("addid").value;
var addtext = document.getElementById("addtext").value;
$.ajax({
type:"post",
url:"dlcl.php",
async:true,
data:{
typ:"fabu",
addid:addid,
addtext:addtext
},
&

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved