客户管理系统开发定制PHP留言板的制作

php+mysql客户管理系统开发定制制作留言版

 

           作为一个PHP的初学者,客户管理系统开发定制我就试着写了一个留言板,客户管理系统开发定制用来加深自己对PHP语句和mysql语句

客户管理系统开发定制的运用和理解。

           客户管理系统开发定制首先我们先来介绍什么是留言板,客户管理系统开发定制留言板就是我们所发表客户管理系统开发定制意见的载体,客户管理系统开发定制用来承载和展示我们对客户管理系统开发定制某些事物的看法和意见。

           客户管理系统开发定制首先我们再写留言板前客户管理系统开发定制需要创建一个数据库和客户管理系统开发定制两个数据表(客户管理系统开发定制或三个数据表都可以,客户管理系统开发定制这里我选择的是建立两个数据表)

           info数据库:

       

        建立好数据库后创建两个表:

        第一个member表(用来管理账号)

        

        第二个speak表(用来管理留言的):

    #一:现在我们需要写一个注册页面:

    #member.php(这是注册的前端代码)    代码如下

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>会员管理系统</title>
  8. <style>
  9. .main{width= 80%;margin: 0 auto;text-align:center}
  10. /* margin设置一个元素所有外边距的宽度,或者设置各边上外边距的宽度 若使用auto浏览器计算外边距*/
  11. /* .main ul{width: 90%;margin: 0 auto;text-align: center} */
  12. .current{color: darkgreen}
  13. /* font-size:16px作用设置设置字体的尺寸 */
  14. /* */
  15. h2{text-align: center;font-size:20px;}
  16. h2 a:hover{ color: aqua;text-decoration:underline}/* 在这个hover中的color主要是设置鼠标放在标题上的颜色 text-decoration 主要是设置鼠标放在标题上出现下划线*/
  17. h2 a:last-child{margin-right:0px}/* a:last-childa标签中最后一个子元素 */
  18. h2 a{margin-right: 15px;color: navy;text-decoration: none}/* margin-right设置a标签右边的距离 */
  19. .color{color:#FF3333}
  20. body
  21. {
  22. background:url('./127.jpeg') no-repeat center top;
  23. background-size:cover;
  24. /* background="./127.jpg" background-size:cover; */
  25. }
  26. </style>
  27. </head>
  28. <body >
  29. <div class="main">
  30. <h1>留言板</h1>
  31. <h2>
  32. <a href="member.php" class="current">1:注册 </a>
  33. <a href="login.php" >2:登陆 </a>
  34. </h2>
  35. <form action="member1.php" method="post" onsubmit="return check()">
  36. <table align="center" border="1" font-size:16px; style="border-collapse: collapse" cellpadding="10" cellspacing="0"><!-- border作用是增加一个边框 -->
  37. <tr>
  38. <td align="right">用户名:</td>
  39. <td align="left"><input type="text" name="username" onblur="checkUsername()" value="请输入用户名"><span class="color">*</span></td> <!--onblur="checkUsername()"的作用是连接javascript 即当用户离开输入字段时执行 JavaScript-->
  40. </tr>
  41. <tr>
  42. <td align="right">密码:</td>
  43. <td align="left"><input type="password" name="code" ><span class="color">*</span></td>
  44. </tr>
  45. <tr>
  46. <td align="right">性别:</td>
  47. <td>
  48. <input type="radio" checked="checked" name="sex" id="1" value="1"><label for="1"></label>
  49. <input type="radio" name ="sex" id="2" value="0"><label for="2"></label>
  50. </td>
  51. </tr>
  52. <tr>
  53. <td align="right">爱好</td>
  54. <td align="left">
  55. <input type="checkbox" name="fav[]" id="t"value="听音乐"><label for="t">听音乐</label>
  56. <input type="checkbox" name="fav[]" id="wt" value="看电音"><label for="wt">看电影</label>
  57. <input type="checkbox" name="fav[]" checked="checked" id="日落" value="看日落"><label for="日落">看日落</label>
  58. </tr>
  59. <tr>
  60. <td align="right"><input type="submit" value="提交"></td>
  61. <td><input type="reset" value="重置"></td>
  62. </tr>
  63. </table>
  64. </form>
  65. </div>
  66. <script>
  67. function check()
  68. {
  69. let username = document.getElementsByName('username')[0].value.trim();
  70. let code = document.getElementsByName('code')[0].value.trim();
  71. //用户名验证
  72. let usernameReg = /^[a-zA-Z0-9]{6,20}$/;
  73. if(!usernameReg.test(username))//js中test() 方法用于检测一个字符串是否匹配某个模式
  74. {
  75. alert('用户名必填,且只能由大小写字符和数字构成,长度为6到20个字符!');
  76. return false;
  77. }
  78. let pwreg = /^[a-zA-Z0-9_*]{6,20}$/;
  79. if(!pwreg.test(code))
  80. {
  81. alert('密码必填,且只能由大小写字符和数字构成,长度为6到20个字符!');
  82. return false;
  83. }
  84. return true;
  85. }
  86. </script>
  87. </body>
  88. </html>

 #member1.php(这是注册页面的后端)代码如下:

  1. <?php
  2. header("Content-Type:text/html;charset=utf-8");
  3. $username=trim($_POST['username']);
  4. $code=trim($_POST['code']);
  5. $sex=trim($_POST['sex']);
  6. $fav=@implode(",",$_POST['fav']);//inplode做用是用逗号把爱好个数组连接起来即把数组元素组合为字符串:
  7. // 连接数据库;
  8. // 1:连接数据库服务器;
  9. //2:设置字符集。
  10. if(!strlen($username) || !strlen($code) )//判断字符串长度
  11. {
  12. echo "<script>alert('用户名和密码必须全部填写');history.back();</script>";
  13. exit;
  14. }
  15. if(!preg_match('/^[a-zA-Z0-9]{6,20}$/',$username))//preg_match 函数用于执行一个正则表达式匹配。即判断$username是否满足正则表达式规则
  16. {
  17. echo "<script>alert('用户名必填,且只能大小写字符和数字构成,长度为6到20个字符!')history.back()</script>";
  18. exit;
  19. }
  20. if(!preg_match('/^[a-zA-Z0-9]{6,20}$/',$code))
  21. {
  22. echo "<script>alert('密码必填,且只能大小写字符和数字组成,长度为6到20个字符');history.back();</script>";
  23. exit;
  24. }
  25. include_once "conn.php";
  26. $sql="select * from member where username='$username'";
  27. $result=mysqli_query($conn,$sql);//返回一个字符集 执行针对数据库的查询 query 必需,规定查询字符串。
  28. $num=mysqli_num_rows($result);//mysqli_num_rows()函数返回结果集中行的数量
  29. if($num)
  30. {
  31. echo "<script>alert('输入的用户名已经存在,请重新输入。'); history.back();</script>";
  32. exit;
  33. }
  34. $sql="insert into member(username,code,sex,fav,createtime) value('$username','".md5($code)."','$sex','$fav','".time()."')";
  35. $result=mysqli_query($conn,$sql);
  36. if($result)
  37. {
  38. echo "<script>alert('注册成功,请登陆用户');location.href='login.php';</script>";
  39. // location.href='login.php'作用是注册成功跳转到login.php页面。
  40. }
  41. else
  42. {
  43. echo "<script>alert('注册失败,请重新注册。');history.back();</script>";
  44. // history.back()的作用是注册失败重新返回注册页面
  45. }

展示图:

(这是注册页面的后端)代码如下:

  #二:是我们的登陆页面:

登陆前端代码login.php  代码如下:

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>留言板</title>
  8. <style>
  9. .main{width= 80%;margin: 0 auto;text-align:center}
  10. .current{color:darkgreen}
  11. h2{text-align:center;font-size:20px;}
  12. h2 a{margin-right: 15px; color:navy ;text-decoration: none}
  13. h2 a:hover{color:aqua;text-decoration:underline}
  14. h2 a:last-child{margin-right:0px}
  15. body
  16. {
  17. background:url('./5.jpg') no-repeat center top; /* 一般的链接指向代码。 no-repeat作用是不铺平页面即不会随着页面的改变而铺平整个页面*/
  18. background-size:cover;/* background-size规定背景图片的尺寸。 */
  19. /* background="./127.jpg" background-size:cover; */
  20. /* */
  21. }
  22. </style>
  23. </head>
  24. <body >
  25. <div class="main">
  26. <h1>留言板</h1>
  27. <h2>
  28. <!-- <a href="index.php" >1:首页 </a> -->
  29. <a href="member.php" >1:注册 </a>
  30. <a href="login.php" class="current">2:登陆 </a>
  31. <!-- <a href="revise.php" >4:个人资料修改 </a> -->
  32. <!-- <a href="admin.php" >5:后台管理</a></br> -->
  33. </h2>
  34. <form action="Login1.php" method="post" onsubmit="return check()">
  35. <table border="1" align="center" cellpadding="10" cellspacing="0" font-size:16px; style="border-collapse: collapse" >
  36. <!-- <table style="width: 30%;height:200px;margin: 0 auto;margin-top:15%;background:#E0FFFF60;border-radius:20px"> -->
  37. <tr>
  38. <td align="right">用户名:</td>
  39. <td align="left"><input type="text" name="username" placeholder="请输入用户名" onblur="checkUsername()"></td>
  40. </tr>
  41. <tr>
  42. <td align="right">密码:</td>
  43. <td align="left"><input type="password" name="code"></td>
  44. </tr>
  45. <tr>
  46. <td colspan="2"> <input type="submit" value="登录"> </td>
  47. </tr>
  48. </table>
  49. </form>
  50. </div>
  51. <script>
  52. function check()
  53. {
  54. let username = document.getElementsByName('username')[0].value.trim();
  55. let code = document.getElementsByName('code')[0].value.trim();
  56. let usernameReg = /^[a-zA-Z0-9]{6,20}$/;
  57. if(!usernameReg.test(username))
  58. {
  59. alert('用户名必填,且只能大小写字符和数字构成,长度为6到20个字符!');
  60. return false;
  61. }
  62. let pwreg=/^[a-zA-Z0-9]{6,20}$/;
  63. if(!pwreg.test(code))
  64. {
  65. alert('密码必填,且只能大小写字符和数字组成,长度为6到20个字符');
  66. return false;
  67. }
  68. return true;
  69. }
  70. </script>
  71. </body>
  72. </html>

 登陆后端代码Lojin1.php  代码如下:

  1. <?php
  2. session_start();
  3. $username = trim($_POST['username']);
  4. $code = trim($_POST['code']);
  5. if(!strlen($username) || !strlen($code))
  6. {
  7. echo "<script>alert('用户名和密码必须全部填写');history.back();</script>";
  8. exit;
  9. }
  10. if(!preg_match('/^[a-zA-Z0-9]{6,20}$/',$username))
  11. {
  12. echo "<script>alert('用户名必填,且只能大小写字符和数字构成,长度为6到20个字符!');history.back();</script>";
  13. exit;
  14. }
  15. if(!preg_match('/^[a-zA-Z0-9]{6,20}$/',$code))
  16. {
  17. echo "<script>alert('密码必填,且只能大小写字符和数字组成,长度为6到20个字符');history.back()</script>";
  18. exit;
  19. }
  20. include_once "conn.php";
  21. $sql="select * from member where username='$username'and code='".md5($code)."'";
  22. $result=mysqli_query($conn,$sql);//返回一个字符集
  23. $num=mysqli_num_rows($result);
  24. if($num)
  25. {
  26. $info=mysqli_fetch_array($result);
  27. if($info['admin'])
  28. {
  29. $_SESSION['isadmin']=1;
  30. }
  31. else
  32. {
  33. $_SESSION['isadmin']=0;
  34. }
  35. $_SESSION['loggedUsername']=$username;
  36. echo "<script>alert('登陆成功');location.href = 'index0.php';</script>";
  37. }
  38. else
  39. {
  40. unset($_SESSION['loggedUsername']);//unset() 函数用于销毁给定的变量。
  41. echo "<script>alert('登陆失败');history.back();</script>";
  42. }

     展示图:

     #三这是我们的个人资料修改代码: 

    个人资料修改前端代码 revise.php  代码如下:

     

  1. <?php
  2. session_start();
  3. ?>
  4. <!DOCTYPE html>
  5. <html lang="en">
  6. <head>
  7. <meta charset="UTF-8">
  8. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  9. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  10. <title>会员管理系统</title>
  11. <style>
  12. .main{width= 80%;margin: 0 auto;text-align:center}
  13. /* .main ul{width: 90%;margin: 0 auto;text-align: center} */
  14. .current{color: darkgreen}
  15. /* font-size:16px作用设置设置字体的尺寸 */
  16. /* */
  17. h2{text-align: center;font-size:20px;}
  18. h2 a:hover{ color: aqua;text-decoration:underline}/* 在这个hover中的color主要是设置鼠标放在标题上的颜色 text-decoration 主要是设置鼠标放在标题上出现下划线*/
  19. h2 a:last-child{margin-right:0px}/* a:last-childa标签中最后一个子元素 */
  20. h2 a{margin-right: 15px;color: navy;text-decoration: none}/* margin-right设置a标签右边的距离 */
  21. body
  22. {
  23. background:url('./5.jpg') no-repeat center top;
  24. background-size:cover;
  25. /* background="./127.jpg" background-size:cover; */
  26. }
  27. </style>
  28. </head>
  29. <body >
  30. <div class="main">
  31. <h1>留言板</h1>
  32. <h2>
  33. <a href="index0.php" >1:首页 </a>
  34. <!-- <a href="member.php" >2:注册 </a> -->
  35. <!-- <a href="login.php" >3:登陆 </a> -->
  36. <a href="revise.php" class="current">4:个人资料修改 </a>
  37. <a href="admin.php" >5:后台管理</a></br>
  38. </h2>
  39. <?php
  40. include_once "conn.php";
  41. $sql="select *from member where username='".$_SESSION['loggedUsername']."'";
  42. $result=mysqli_query($conn,$sql);
  43. $num=mysqli_num_rows($result);
  44. if( $num)
  45. {
  46. $info=mysqli_fetch_array($result);
  47. $fav = explode(",",$info['fav']);
  48. // echo "$fav";
  49. }
  50. else
  51. {
  52. die('未找到有效用户');
  53. }
  54. ?>
  55. <form action="revise1.php" method="post" onsubmit="return check()">
  56. <table align="center" border="1" font-size:16px; style="border-collapse: collapse" cellpadding="10" cellspacing="0"><!-- border作用是增加一个边框 -->
  57. <tr>
  58. <td align="right">用户名:</td>
  59. <td align="left">
  60. <input type="text" name="username" onblur="checkUsername()" value="<?php echo $info['username'] ?>" readonly >
  61. </td>
  62. <!--onblur="checkUsername()"的作用是连接javascript 即当用户离开输入字段时执行 JavaScript-->
  63. <!-- readonly的作用是定义用户名为只读 -->
  64. </tr>
  65. <tr>
  66. <td align="right">密码:</td>
  67. <td align="left"><input type="password" name="code" placeholder="不修改密码请留空" ></td>
  68. </tr>
  69. <tr>
  70. <td align="right">性别:</td>
  71. <td>
  72. <input type="radio" name="sex" id="1" value="1" <?php if($info['sex']){echo "checked";}?>><label for="1"></label>
  73. <input type="radio" name ="sex" id="2" value="0" <?php if(!$info['sex']){echo "checked";}?>><label for="2"></label>
  74. </td>
  75. </tr>
  76. <tr>
  77. <td align="right">爱好</td>
  78. <td align="left">
  79. <input type="checkbox" name="fav[]" id="t"value="听音乐" <?php if(in_array('听音乐',$fav)){echo "checked";}?>><label for="t">听音乐</label>
  80. <input type="checkbox" name="fav[]" id="wt" value="看电影" <?php if(in_array('看电影',$fav)){echo "checked";}?>><label for="wt">看电影</label>
  81. <input type="checkbox" name="fav[]" checked="checked" id="日落" value="看日落" <?php if(in_array('看日落',$fav)){echo "checked";}?>><label for="日落">看日落</label>
  82. </tr>
  83. <tr>
  84. <td align="right"><input type="submit" value="提交"></td>
  85. <td><input type="reset" value="重置"></td>
  86. </tr>
  87. </table>
  88. </form>
  89. </div>
  90. <script>
  91. function check()
  92. {
  93. let code = document.getElementsByName('code')[0].value.trim();
  94. //用户名验证
  95. let pwreg = /^[a-zA-Z0-9_*]{6,20}$/;
  96. if(code.length > 0)
  97. {
  98. if(!pwreg.test(code))
  99. {
  100. alert('密码只能由大小写字符和数字构成,长度为6到20个字符!');
  101. return false;
  102. }
  103. }
  104. return true;
  105. }
  106. </script>
  107. </body>
  108. </html>

 个人资料修改后端代码revise1.php  代码如下:

  1. <?php
  2. header("Content-Type:text/html;charset=utf-8");
  3. $username=$_POST['username'];
  4. $code=$_POST['code'];
  5. $sex=$_POST['sex'];
  6. $fav=@implode(",",$_POST['fav']);
  7. if(!strlen($username))
  8. {
  9. echo "<script>alert('用户名必须填写');history.back();</script>";
  10. exit;
  11. }
  12. if(!empty($code))
  13. //empty() 函数用于检查一个变量是否为空。
  14. //empty() 判断一个变量是否被认为是空的。当一个变量并不存在,或者它的值等同于 FALSE,那么它会被认为不存在。如果变量不存在的话,empty()并不会产生警告。
  15. {
  16. if(preg_match('/^[a-zA-Z0-9]{6,20}$/',$code))
  17. {
  18. echo "<script<alert('密码只能由大小写字符和数字组成,长度为6到20个字符');history.back();</script>";
  19. exit;
  20. }
  21. }
  22. include_once 'conn.php';
  23. if($code)
  24. {
  25. $sql="update member set code='".md5($code)."' sex=$sex ,fav='$fav' where username='$username'";
  26. }
  27. else
  28. {
  29. $sql="update member set sex=$sex, fav='$fav' where username='$username'";
  30. }
  31. $result=mysqli_query($conn,$sql);
  32. if($result)
  33. {
  34. echo "<script>alert('资料改写成功');location.href='index0.php';</script>";
  35. exit;
  36. }
  37. else
  38. {
  39. echo "<script>alert('资料改写失败,请重写改写据。');history.back();</script>";
  40. exit;
  41. }

 展示图:

 #后台管理前端代码admin.php  代码如下:

  1. <?php
  2. session_start();
  3. if(!isset($_SESSION['isadmin']) || !$_SESSION['isadmin'])
  4. {
  5. echo "<script>alert('请以管理员的的身份登录后,在进入后台。');location.href='index0.php';</script>";
  6. exit;
  7. }
  8. ?>
  9. <!DOCTYPE html>
  10. <html lang="en">
  11. <head>
  12. <meta charset="UTF-8">
  13. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  14. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  15. <title>留言板</title>
  16. <style>
  17. .main{width= 80%;margin: 0 auto;text-align:center}
  18. .current{color:darkgreen}
  19. h2{text-align:center;font-size:20px;}
  20. h2 a{margin-right: 15px; color:navy ;text-decoration: none}
  21. h2 a:hover{color:aqua;text-decoration:underline}
  22. h2 a:last-child{margin-right:0px}
  23. tr:hover{background-color:azure}
  24. body
  25. {
  26. background:url('./5.jpg') no-repeat center top;
  27. background-size:cover;
  28. /* background="./127.jpg" background-size:cover; */
  29. }
  30. </style>
  31. </head>
  32. <body >
  33. <div class="main">
  34. <h1>留言板</h1>
  35. <?php
  36. if(isset($_SESSION['loggedUsername']) && $_SESSION['loggedUsername'] <> ''){
  37. ?>
  38. <div class="logged">当前登录者:<?php echo $_SESSION['loggedUsername'];?> <?php if($_SESSION['isadmin']) {?><span style="color: crimson">欢迎管理员登录 </span><?php }?><span class="logout"><a href="logout.php">注销登录</a></span> </div>
  39. <?php
  40. }
  41. ?>
  42. <h2>
  43. <a href="index0.php" >1:首页 </a>
  44. <a href='留言管理.php'>2:留言管理</a>
  45. <!-- <a href="member.php" >2:注册 </a> -->
  46. <!-- <a href="login.php" >3:登陆 </a> -->
  47. <!-- <a href="revise.php" >4:个人资料修改 </a> -->
  48. <a href="admin.php" class="current">3:后台管理</a></br>
  49. </h2>
  50. <?php
  51. include_once 'conn.php';
  52. $sql="select * from member order by id desc";//order by id desc 作用是让查到的数据id按照有大到下的顺序排列。
  53. $result=mysqli_query($conn,$sql);
  54. ?>
  55. <table align="center" border="1" width="100%" cellspacing="0" cellpadding="10" styel="border-collapase: collapse" >
  56. <tr>
  57. <td>序号</td>
  58. <td>用户名</td>
  59. <td>密码</td>
  60. <td>性别</td>
  61. <td>爱好</td>
  62. <td>是否是管理员</td>
  63. <td>操作</td>
  64. </tr>
  65. <?php
  66. $i=1;
  67. while($info=mysqli_fetch_array($result))
  68. {
  69. ?>
  70. <tr>
  71. <td><?php echo $i;?></td>
  72. <td><?php echo $info['username'];?></td>
  73. <td><?php echo $info['code'];?></td>
  74. <td><?php echo $info['sex'] ? '男' : '女'; ?></td>`
  75. <td><?php echo $info['fav'];?></td>
  76. <td><?php echo $info['admin'] ? '是' : '否';?></td>
  77. <td>
  78. <!-- <a href='留言管理.php'>留言管理</a> -->
  79. <a href='revise+.php?username=<?php echo $info['username'];?>'>资料修改</a>
  80. <?php if($info['username'] <> 'isadmin')
  81. {?>
  82. <a href="javascript:del(<?php echo $info['id'];?>,'<?php echo $info['username'];?>')">删除用户</a><!-- javascript:del的作用是给一机会判断是否删除用户 -->
  83. <?php
  84. }
  85. else
  86. {?>
  87. <span style="color:gray">删除用户</span>
  88. <?php
  89. }
  90. ?>
  91. <?php if($info['admin'])
  92. {
  93. if($info['username'] <> 'isadmin')
  94. {?>
  95. <a href="setadmin.php?action=0&id=<?php echo $info['id'];?>">取消管理员</a> <!-- 涉及到地址传参,其中&是用来分割参数的 -->
  96. <?php
  97. }
  98. else
  99. {
  100. echo '<span style="color:gray">取消管理员</spqn>';
  101. }
  102. ?>
  103. <?php
  104. }
  105. else
  106. {?>
  107. <a href="setadmin.php?action=1&id=<?php echo $info['id'];?>">设置管理员</a>
  108. <?php
  109. }
  110. ?>
  111. </td>
  112. </tr>
  113. <?php
  114. $i++;
  115. }
  116. ?>
  117. </table>
  118. </div>
  119. <script>
  120. function del(id,name)
  121. {
  122. if(confirm('您确定要删除 '+name+' 用户吗?'))
  123. {
  124. location.href='del.php?id='+id+'&username='+name;
  125. }
  126. }
  127. </script>
  128. </body>
  129. </html>

  后台管理后端代码:

  1:取消管理员代码setadmin.php  代码如下:

  1. <?php
  2. session_start();
  3. if(!isset($_SESSION['isadmin']) || !$_SESSION['isadmin'])//isset() 函数用于检测变量是否已设置并且非 NULL
  4. {
  5. echo "<script>alert('请以管理员的的身份登录后,在进入后台。');location.href='index0.php';</script>";
  6. exit;
  7. }
  8. ?>
  9. <?php
  10. $action=$_GET['action'];
  11. $id=$_GET['id'];
  12. include_once 'conn.php';
  13. if(is_numeric($action) && is_numeric($id))//判断is_numeric()函数的作用是判断括号中的内容是不是数字。
  14. {
  15. if($action==1 || $action==0)
  16. {
  17. $sql="update member set admin='$action' where id='$id'";
  18. }
  19. else
  20. {
  21. echo "<script>alert('参数错误');history.back();</script>";
  22. }
  23. $result=mysqli_query($conn,$sql);
  24. if($result)
  25. {
  26. echo "<script>alert('设置或取消管理员成功');location.href='admin.php';</script>";
  27. }
  28. else
  29. {
  30. echo "<script>alert('设置或取消管理员失败');history.back();</script>";
  31. }
  32. }
  33. else
  34. {
  35. //id和action 其中一个或全部不是数字
  36. echo "<script>alert('参数错误');history.back();</script>";
  37. }

2:管理员实现用户资料修改  resive+.php  代码如下:

  1. <?php
  2. session_start();
  3. ?>
  4. <!DOCTYPE html>
  5. <html lang="en">
  6. <head>
  7. <meta charset="UTF-8">
  8. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  9. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  10. <title>会员管理系统</title>
  11. <style>
  12. .main{width= 80%;margin: 0 auto;text-align:center}
  13. /* .main ul{width: 90%;margin: 0 auto;text-align: center} */
  14. .current{color: darkgreen}
  15. /* font-size:16px作用设置设置字体的尺寸 */
  16. /* */
  17. h2{text-align: center;font-size:20px;}
  18. h2 a:hover{ color: aqua;text-decoration:underline}/* 在这个hover中的color主要是设置鼠标放在标题上的颜色 text-decoration 主要是设置鼠标放在标题上出现下划线*/
  19. h2 a:last-child{margin-right:0px}/* a:last-childa标签中最后一个子元素 */
  20. h2 a{margin-right: 15px;color: navy;text-decoration: none}/* margin-right设置a标签右边的距离 */
  21. </style>
  22. </head>
  23. <body>
  24. <div class="main">
  25. <h1>留言板</h1>
  26. <h2>
  27. <a href="index.php" >1:首页 </a>
  28. <!-- <a href="member.php" >2:注册 </a> -->
  29. <!-- <a href="login.php" >3:登陆 </a> -->
  30. <a href="revise.php" class="current">4:个人资料修改 </a>
  31. <a href="admin.php" >5:后台管理</a></br>
  32. </h2>
  33. <?php
  34. include_once "conn.php";
  35. $username=$_GET['username'];
  36. $sql="select *from member where username='$username'";
  37. $result=mysqli_query($conn,$sql);
  38. $num=mysqli_num_rows($result);
  39. if( $num)
  40. {
  41. $info=mysqli_fetch_array($result);
  42. $fav = explode(",",$info['fav']);
  43. // echo "$fav";
  44. }
  45. else
  46. {
  47. die('未找到有效用户');
  48. }
  49. ?>
  50. <form action="revise1.php" method="post" onsubmit="return check()">
  51. <table align="center" border="1" font-size:16px; style="border-collapse: collapse" cellpadding="10" cellspacing="0"><!-- border作用是增加一个边框 -->
  52. <tr>
  53. <td align="right">用户名:</td>
  54. <td align="left">
  55. <input type="text" name="username" onblur="checkUsername()" value="<?php echo $info['username'] ?>" >
  56. </td>
  57. <!--onblur="checkUsername()"的作用是连接javascript 即当用户离开输入字段时执行 JavaScript-->
  58. <!-- readonly的作用是定义用户名为只读 -->
  59. </tr>
  60. <tr>
  61. <td align="right">密码:</td>
  62. <td align="left"><input type="password" name="code" placeholder="不修改密码请留空" ></td>
  63. </tr>
  64. <tr>
  65. <td align="right">性别:</td>
  66. <td>
  67. <input type="radio" name="sex" id="1" value="1" <?php if($info['sex']){echo "checked";}?>><label for="1"></label>
  68. <input type="radio" name ="sex" id="2" value="0" <?php if(!$info['sex']){echo "checked";}?>><label for="2"></label>
  69. </td>
  70. </tr>
  71. <tr>
  72. <td align="right">爱好</td>
  73. <td align="left">
  74. <input type="checkbox" name="fav[]" id="t"value="听音乐" <?php if(in_array('听音乐',$fav)){echo "checked";}?>><label for="t">听音乐</label>
  75. <input type="checkbox" name="fav[]" id="wt" value="看电影" <?php if(in_array('看电影',$fav)){echo "checked";}?>><label for="wt">看电影</label>
  76. <input type="checkbox" name="fav[]" checked="checked" id="日落" value="看日落" <?php if(in_array('看日落',$fav)){echo "checked";}?>><label for="日落">看日落</label>
  77. </tr>
  78. <tr>
  79. <td align="right"><input type="submit" value="提交"></td>
  80. <td><input type="reset" value="重置"></td>
  81. </tr>
  82. </table>
  83. </form>
  84. </div>
  85. <script>
  86. function check()
  87. {
  88. let code = document.getElementsByName('code')[0].value.trim();
  89. //用户名验证
  90. let pwreg = /^[a-zA-Z0-9_*]{6,20}$/;
  91. if(code.length > 0)
  92. {
  93. if(!pwreg.test(code))
  94. {
  95. alert('密码只能由大小写字符和数字构成,长度为6到20个字符!');
  96. return false;
  97. }
  98. }
  99. return true;
  100. }
  101. </script>
  102. </body>
  103. </html>

3:管理员删除用户del.php   代码如下:

  1. <?php
  2. session_start();
  3. if(!isset($_SESSION['isadmin']) || !$_SESSION['isadmin'])
  4. {
  5. echo "<script>alert('请以管理员的的身份登录后,在进入后台。');location.href='index.php';</script>";
  6. exit;
  7. }
  8. include_once 'conn.php';
  9. $id=$_GET['id'];
  10. $username=$_GET['username'];
  11. // echo "<script>alert('$id');</script>";
  12. if(is_numeric($id))//is_numeric()函数用于检测变量是否为数字或数字字符串。
  13. {
  14. $sql="delete from member where id=$id";
  15. $result=mysqli_query($conn,$sql);
  16. if($result)
  17. {
  18. echo "<script>alert('删除用户 $username 成功!');location.href='admin.php';</script>";
  19. }
  20. else
  21. {
  22. echo "<script>alert('删除用户 $username 失败!');history.back();</script>";
  23. }
  24. }
  25. else
  26. {
  27. echo "<script>alert('参数错误!');history.back();</script>";
  28. }

后端管理展示图:

#四:首页留言页面:

首页index0.php  代码如下:

  1. <?php
  2. session_start();
  3. ?>
  4. <!DOCTYPE html>
  5. <html lang="en">
  6. <head>
  7. <meta charset="UTF-8">
  8. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  9. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  10. <title>留言板</title>
  11. <style>
  12. /* *{margin:0;padding:0;} */
  13. /* body,html{width: 100px;height: 100px;} */
  14. .main{width= 80%;margin: 0 auto;text-align:center}
  15. .current{color:darkgreen}
  16. h2{text-align:center;font-size:20px;}
  17. h2 a{margin-right: 15px; color:navy ;text-decoration: none}
  18. h2 a:hover{color:aqua;text-decoration:underline}
  19. h2 a:last-child{margin-right:0px}
  20. .logged{font-size:15px;color:#00FFCC}
  21. .logout{margin-left:15px;margin-bottom:10px}
  22. .logged a{color:#CCCCFF;text-decoration:none}
  23. .logged a:hover{text-decoration:underline;color:aqua}
  24. body
  25. {
  26. background:url('./127.jpg') no-repeat center top;
  27. background-size:cover;
  28. /* background="./127.jpg" background-size:cover; */
  29. }
  30. .message
  31. {
  32. width:600px;
  33. height:170px;
  34. background:#fff;
  35. background:rgba(255,255,255,0.25);
  36. margin: 100px auto 0;
  37. border: radious 5px;
  38. padding: 5px;
  39. }
  40. .message p
  41. {
  42. color:aqua;
  43. font-size:12px;
  44. line-height:25px;
  45. }
  46. .message .text
  47. {
  48. width: 600px;
  49. height:70px;
  50. border: 1px solid #ddd;
  51. background:rgba(255,255,255,0.25);
  52. }
  53. .message .btn
  54. {
  55. width:600px;
  56. height:50px;
  57. margin-top:10;/* 遇上个边框的距离为10像素 */
  58. }
  59. .message .btn .face-btn
  60. {
  61. float:left;/*属性定义元素在哪个方向浮动。以往这个属性总应用于图像*/
  62. }
  63. .message .btn .mes-btn
  64. {
  65. float:right;
  66. background:rgba(255,255,255,0.25);/* rgba() 函数使用红(R)、绿(G)、蓝(B)、透明度(A)的叠加来生成各式各样的颜色。其中最后一个为调节透明度 */
  67. padding: 0px 5px;/* 设置 p 元素的 4 个内边距 其中第一个为上下边距 第二个为左右边距 */
  68. border-radius:0px;/* 向 div 元素添加圆角边框 */
  69. font-size:12px;/* 设置字体大小 */
  70. cursor:pointer;/* 设置鼠标形状。 */
  71. }
  72. .message .btn input
  73. {
  74. float:right;
  75. background:rgba(255,255,255,0.25);
  76. padding: 5px 20px;
  77. border-radius:5px;
  78. font-size:12px;
  79. cursor:pointer;/* 设置鼠标形状。 */
  80. }
  81. </style>
  82. </head>
  83. <body>
  84. <div class="main">
  85. <h1>留言板</h1>
  86. <?php
  87. if(isset($_SESSION['loggedUsername']) && $_SESSION['loggedUsername'] <> ''){
  88. ?>
  89. <div class="logged">当前登录者:<?php echo $_SESSION['loggedUsername'];?> <?php if($_SESSION['isadmin']) {?><span style="color: crimson">欢迎管理员登录 </span><?php }?><span class="logout"><a href="logout.php">注销登录</a></span> </div>
  90. <?php
  91. }
  92. ?>
  93. <h2>
  94. <a href="index0.php" class="current">1:首页 </a>
  95. <a href="展示留言.php" >2:显示留言 </a>
  96. <!-- <a href="login.php" >3:登陆 </a> -->
  97. <a href="revise.php" >3:个人资料修改 </a>
  98. <a href="admin.php" >4:后台管理</a></br>
  99. </h2>
  100. </div>
  101. <form action="留言后端.php" method="post" >
  102. <div class="message">
  103. <P>你想对iu说些什么?</p>
  104. <div class="btn">
  105. <textarea name="speak" cols="30" rows="10" placeholder="说点什么..." class="text" onblur="checkUsername()"></textarea>
  106. <span class="mes-btn"><p align="right"><input type="submit" value="发表" ></p></span>
  107. <span class="mes-btn"><p align="left"><input name="name" type="text" placeholder="你的名字"></p></p></span>
  108. </div>
  109. </div>
  110. </form>
  111. </form>
  112. </div>
  113. </body>
  114. </html>

留言后端代码:留言后端.php(文件名称最好用英文不要用中文)  代码如下:

  1. <?php
  2. session_start();
  3. $username=$_SESSION['loggedUsername'];
  4. $speak=$_POST['speak'];
  5. $name=$_POST['name'];
  6. include_once 'conn.php';
  7. if(!strlen($speak))
  8. {
  9. echo "<script>alert('留言必须填写!(你怎能没有什么想说的)');history.back();</script>";
  10. exit;
  11. }
  12. if(!strlen($name))
  13. {
  14. echo "<script>alert('姓名你都不填,你想干啥!');history.back();</script>";
  15. exit;
  16. }
  17. // echo "<script>alert('sdfsdfsd');location.href='22.php';</script>";
  18. // echo "<script>alert('');location.href='22.php';</script>";
  19. $sql="insert into speak(name,speak,createtime,username) value('$name','$speak','".time()."','$username')";
  20. $result=mysqli_query($conn,$sql);
  21. if($result)
  22. {
  23. echo "<script>alert('留言成功');location.href='index0.php';</script>";
  24. }
  25. else
  26. {
  27. echo "<script>alert('留言失败。')hisotory.back();</script>";
  28. }

留言页面展示图:

 

#五:展示留言:

 展示留言.php   代码如下:

  1. <?php
  2. session_start();
  3. ?>
  4. <!DOCTYPE html>
  5. <html lang="en">
  6. <head>
  7. <meta charset="UTF-8">
  8. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  9. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  10. <title>留言板</title>
  11. <style>
  12. .main{width= 80%;margin: 0 auto;text-align:center}
  13. .current{color:darkgreen}
  14. h2{text-align:center;font-size:20px;}
  15. h2 a{margin-right: 15px; color:navy ;text-decoration: none}
  16. h2 a:hover{color:aqua;text-decoration:underline}
  17. h2 a:last-child{margin-right:0px}
  18. tr:hover{background-color:azure}
  19. body
  20. {
  21. background:url('./5.jpg') no-repeat center top;
  22. background-size:cover;
  23. /* background="./127.jpg" background-size:cover; */
  24. }
  25. </style>
  26. </head>
  27. <body >
  28. <div class="main">
  29. <h1>留言板</h1>
  30. <h2>
  31. <a href="index0.php" >1:首页 </a>
  32. <a href="展示留言.php" class="current">2:显示留言 </a>
  33. <a href="revise.php" >3:个人资料修改 </a>
  34. <a href="admin.php" >4:后台管理</a></br>
  35. </h2>
  36. <?php
  37. include_once 'conn.php';
  38. $sql="select * from speak order by id desc";//order by id desc 作用是让查到的数据id按照有大到下的顺序排列。
  39. $result=mysqli_query($conn,$sql);
  40. ?>
  41. <table align="center" border="1" width="100%" cellspacing="0" cellpadding="10" styel="border-collapase: collapse" >
  42. <tr>
  43. <td>序号</td>
  44. <td>用户名</td>
  45. <td>姓名</td>
  46. <td>留言</td>
  47. <td>时间</td>
  48. <td>操作</td>
  49. </tr>
  50. <tr>
  51. <?php
  52. $i=1;
  53. while($info=mysqli_fetch_array($result))
  54. {?>
  55. <tr>
  56. <td><?php echo $i;?></td>
  57. <td><?php echo $info['username'];?></td>
  58. <td><?php echo $info['name'];?></td>
  59. <td><?php echo $info['speak'];?></td>
  60. <td><?php echo $info['createTime'];?></td>
  61. <td>
  62. <?php
  63. if($info['username']==$_SESSION['loggedUsername'])
  64. {?>
  65. <a href="编辑留言.php?id=<?php echo $info['id'];?>">编辑留言</a>
  66. <a href="javascript:del(<?php echo $info['id'];?>,'<?php echo $info['name'];?>')">删除留言</a>
  67. <?php
  68. }
  69. else
  70. {
  71. echo '<span style="color:gray">编辑留言 </spqn>';
  72. echo '<span style="color:gray"> 删除留言</spqn>';
  73. }
  74. ?>
  75. </tr>
  76. <?php
  77. $i++;
  78. }
  79. ?>
  80. </tr>
  81. </table>
  82. </div>
  83. <script>
  84. function del(id,name)
  85. {
  86. if(confirm('您确定要删除 '+name+' 的留言吗?'))
  87. {
  88. location.href='删除后端.php?id='+id+'&username='+name;
  89. }
  90. }
  91. </script>
  92. </body>
  93. </html>

编辑留言.php     代码如下:

  1. <?php
  2. session_start();
  3. ?>
  4. <?php
  5. include_once 'conn.php';
  6. $id=$_GET["id"];
  7. // $sql="select * from speak where id='$id'";
  8. // $result=mysqli_query($conn,$sql);
  9. $sql="select * from speak where id='$id'";
  10. $result=mysqli_query($conn,$sql);
  11. $info=mysqli_fetch_array($result);
  12. ?>
  13. <!DOCTYPE html>
  14. <html lang="en">
  15. <head>
  16. <meta charset="UTF-8">
  17. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  18. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  19. <title>留言板</title>
  20. <style>
  21. /* *{margin:0;padding:0;} */
  22. /* body,html{width: 100px;height: 100px;} */
  23. .main{width= 80%;margin: 0 auto;text-align:center}
  24. .current{color:darkgreen}
  25. h2{text-align:center;font-size:20px;}
  26. h2 a{margin-right: 15px; color:navy ;text-decoration: none}
  27. h2 a:hover{color:aqua;text-decoration:underline}
  28. h2 a:last-child{margin-right:0px}
  29. .logged{font-size:15px;color:#00FFCC}
  30. .logout{margin-left:15px;margin-bottom:10px}
  31. .logged a{color:#CCCCFF;text-decoration:none}
  32. .logged a:hover{text-decoration:underline;color:aqua}
  33. body
  34. {
  35. background:url('./127.jpg') no-repeat center top;
  36. background-size:cover;
  37. /* background="./127.jpg" background-size:cover; */
  38. }
  39. .message
  40. {
  41. width:600px;
  42. height:170px;
  43. background:#fff;
  44. background:rgba(255,255,255,0.25);
  45. margin: 100px auto 0;
  46. border: radious 5px;
  47. padding: 5px;
  48. }
  49. .message p
  50. {
  51. color:aqua;
  52. font-size:12px;
  53. line-height:25px;
  54. }
  55. .message .text
  56. {
  57. width: 600px;
  58. height:70px;
  59. border: 1px solid #ddd;
  60. background:rgba(255,255,255,0.25);
  61. }
  62. .message .btn
  63. {
  64. width:600px;
  65. height:50px;
  66. margin-top:10;/* 遇上个边框的距离为10像素 */
  67. }
  68. .message .btn .face-btn
  69. {
  70. float:left;
  71. }
  72. .message .btn .mes-btn
  73. {
  74. float:right;
  75. background:rgba(255,255,255,0.25);
  76. padding: 0px 5px;
  77. border-radius:0px;
  78. font-size:12px;
  79. cursor:pointer;/* 设置鼠标形状。 */
  80. }
  81. .message .btn input
  82. {
  83. float:right;
  84. background:rgba(255,255,255,0.25);
  85. padding: 5px 20px;
  86. border-radius:5px;
  87. font-size:12px;
  88. cursor:pointer;/* 设置鼠标形状。 */
  89. }
  90. </style>
  91. </head>
  92. <body>
  93. <div class="main">
  94. <h1>留言板</h1>
  95. <?php
  96. if(isset($_SESSION['loggedUsername']) && $_SESSION['loggedUsername'] <> '')//isset() 函数用于检测变量是否已设置并且非 NULL
  97. {
  98. ?>
  99. <div class="logged">当前登录者:<?php echo $_SESSION['loggedUsername'];?> <?php if($_SESSION['isadmin']) {?><span style="color: crimson">欢迎管理员登录 </span><?php }?><span class="logout"><a href="logout.php">注销登录</a></span> </div>
  100. <?php
  101. }
  102. ?>
  103. <h2>
  104. <a href="index0.php" class="current">1:首页 </a>
  105. <!-- <a href="member.php" >2:注册 </a> -->
  106. <!-- <a href="login.php" >3:登陆 </a> -->
  107. <a href="revise.php" >4:个人资料修改 </a>
  108. <a href="admin.php" >5:后台管理</a></br>
  109. </h2>
  110. </div>
  111. <form action="编辑后端.php" method="post">
  112. <div class="message">
  113. <P>你想对iu说些什么?</p>
  114. <div class="btn">
  115. <textarea name="speak" cols="30" rows="10" placeholder="说点什么..." class="text" id="<?php echo $info['id'];?>"><?php echo $info['speak'];?></textarea>
  116. <span class="mes-btn"><p align="right"><input type="submit" value="更新留言" ></p></span>
  117. <span class="mes-btn"><p align="left">留言人姓名:<input name="name" type="text" value="<?php echo $info['name'];?>" readonly></p></p></span>
  118. </div>
  119. </div>
  120. </form>
  121. </form>
  122. </div>
  123. </body>
  124. </html>

展示留言界面  展示图:

编辑留言后端

编辑后端.php   代码如下:

  1. <?php
  2. $speak=$_POST['speak'];
  3. $name=$_POST['name'];
  4. $id=$_POST['id'];
  5. if(!strlen($speak))
  6. {
  7. echo "<script>alert('留言必须填写!!!');history.back();</script>";
  8. exit;
  9. }
  10. include_once 'conn.php';
  11. $sql="update speak set speak='$speak' where name='$name' ";
  12. $result=mysqli_query($conn,$sql);
  13. if($result)
  14. {
  15. echo "<script>alert('更新留言成功!!!');location.href='展示留言.php';</script>";
  16. exit;
  17. }
  18. else
  19. {
  20. echo "<script>alert('更新留言失败!!!');history.back();</script>";
  21. exit;
  22. }

  删除后端代码

  删除后端.php   代码如下:

  1. <?php
  2. session_start();
  3. $id=$_GET['id'];
  4. $username=$_GET['username'];
  5. if(is_numeric($id))//判断传入的id是否位数字。
  6. {
  7. include_once 'conn.php';
  8. $sql="delete from speak where id=$id";
  9. $result=mysqli_query($conn,$sql);
  10. if($result)
  11. {
  12. echo "<script>alert('$username 用户的留言删除成功!');location.href='展示留言.php';</script>";
  13. }
  14. else
  15. {
  16. echo "<script>alert('$username 用户留言删除失败!');history.back();</script>";
  17. }
  18. }
  19. else
  20. {
  21. echo "<script>alert('参数错误!');history.back();</script>";
  22. }

管理员编辑后端代码

留言管理.php   代码如下:

  1. <?php
  2. session_start();
  3. if(!isset($_SESSION['isadmin']) || !$_SESSION['isadmin'])
  4. {
  5. echo "<script>alert('请以管理员的的身份登录后,在进入后台。');location.href='index.php';</script>";
  6. exit;
  7. }
  8. ?>
  9. <!DOCTYPE html>
  10. <html lang="en">
  11. <head>
  12. <meta charset="UTF-8">
  13. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  14. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  15. <title>留言板</title>
  16. <style>
  17. .main{width= 80%;margin: 0 auto;text-align:center}
  18. .current{color:darkgreen}
  19. h2{text-align:center;font-size:20px;}
  20. h2 a{margin-right: 15px; color:navy ;text-decoration: none}
  21. h2 a:hover{color:aqua;text-decoration:underline}
  22. h2 a:last-child{margin-right:0px}
  23. tr:hover{background-color:azure}
  24. body
  25. {
  26. background:url('./10.jpeg') no-repeat center top;
  27. background-size:cover;
  28. /* background="./127.jpg" background-size:cover; */
  29. }
  30. </style>
  31. </head>
  32. <body >
  33. <div class="main">
  34. <h1>留言板</h1>
  35. <h2>
  36. <a href="index0.php" >1:首页 </a>
  37. <a href="展示留言.php" class="current">3:显示留言 </a>
  38. <a href="revise.php" >4:个人资料修改 </a>
  39. <a href="admin.php" >5:后台管理</a></br>
  40. </h2>
  41. <?php
  42. include_once 'conn.php';
  43. $sql="select * from speak order by id desc";//order by id desc 作用是让查到的数据id按照有大到下的顺序排列。
  44. $result=mysqli_query($conn,$sql);
  45. ?>
  46. <table align="center" border="1" width="100%" cellspacing="0" cellpadding="10" styel="border-collapase: collapse" >
  47. <tr>
  48. <td>序号</td>
  49. <td>用户名</td>
  50. <td>姓名</td>
  51. <td>留言</td>
  52. <td>时间</td>
  53. <td>操作</td>
  54. </tr>
  55. <tr>
  56. <?php
  57. $i=1;
  58. while($info=mysqli_fetch_array($result))//mysqli_fetch_array()从结果集中取得一行作为数字数组或关联数组
  59. //返回与读取行匹配的字符串数组。如果结果集中没有更多的行则返回 NULL。
  60. {?>
  61. <tr>
  62. <td><?php echo $i;?></td>
  63. <td><?php echo $info['username'];?></td>
  64. <td><?php echo $info['name'];?></td>
  65. <td><?php echo $info['speak'];?></td>
  66. <td><?php echo $info['createTime'];?></td>
  67. <td>
  68. <a href="编辑留言.php?id=<?php echo $info['id'];?>">编辑留言</a>
  69. <a href="javascript:del(<?php echo $info['id'];?>,'<?php echo $info['name'];?>')">删除留言</a>
  70. </tr>
  71. <?php
  72. $i++;
  73. }
  74. ?>
  75. </tr>
  76. </table>
  77. </div>
  78. <script>
  79. function del(id,name)
  80. {
  81. if(confirm('您确定要删除 '+name+' 的留言吗?'))
  82. {
  83. location.href='删除后端.php?id='+id+'&username='+name;
  84. }
  85. }
  86. </script>
  87. </body>
  88. </html>

##第一次写博客,写得不好多有见谅,希望对大家学习PHP有所帮助,如有疑问或者改进方法请留言   我这个代码是和会员注册管理相结合来写的我觉得不适合速成的同学来看。

网站建设定制开发 软件系统开发定制 定制软件开发 软件开发定制 定制app开发 app开发定制 app开发定制公司 电商商城定制开发 定制小程序开发 定制开发小程序 客户管理系统开发定制 定制网站 定制开发 crm开发定制 开发公司 小程序开发定制 定制软件 收款定制开发 企业网站定制开发 定制化开发 android系统定制开发 定制小程序开发费用 定制设计 专注app软件定制开发 软件开发定制定制 知名网站建设定制 软件定制开发供应商 应用系统定制开发 软件系统定制开发 企业管理系统定制开发 系统定制开发