应用系统定制开发php留言系统

应用系统定制开发连接数据库,connet.php:

  1. <meta charset="utf-8">
  2. <?php
  3. $conn=mysqli_connect("localhost","root","123456","ly")or die("应用系统定制开发连接数据库服务器失败!".mysqli_error());
  4. mysqli_query($conn,"set names utf8");
  5. ?>

登录页面Login.php:

  1. <html>
  2. <head>
  3. <title>登录</title>
  4. <meta charset="UTF-8">
  5. <link rel="stylesheet" type="text/css" href="./css/index1.css">
  6. <style>
  7. body{height:100%;}
  8. </style>
  9. </head>
  10. <body style="background: url(./images/1.png);">
  11. <div class="index_01">
  12. <table style="width: 100%;height:100%;" >
  13. <tr>
  14. <td align="center" >
  15. <table align="center" width=350 height=230; class="index_table" >
  16. <form method ="POST" action = "doloading.php" name="frmLogin">
  17. <tr align="center" style="font-size:25px;">
  18. <td colspan="2" style="font-size:35px;">用户登录</td>
  19. </tr>
  20. <tr>
  21. <td align="center" style="font-size:25px;">用户名</td>
  22. <td><input type="name" maxlength="16" name="uid" placeholder="应用系统定制开发请输入账号" style="width:180px;font-size:20px;border-radius: 8px; "></td>
  23. </tr>
  24. <tr>
  25. <td align="center" style="font-size:25px;">密 码</td>
  26. <td><input name="password" type="password" maxlength="16" placeholder="应用系统定制开发请输入密码" style="width:180px;font-size:20px;border-radius: 8px; "></td>
  27. </tr>
  28. <tr align="center">
  29. <td colspan="2">
  30. <input type="submit" name="denglu" value="登录" class="btn">
  31. <input type="reset" name="rs" value="重置" class="btn">
  32. </td>
  33. </tr>
  34. </form>
  35. </table>
  36. </td>
  37. </tr>
  38. </table>
  39. </div>
  40. </body>
  41. </html>

登录处理,doloading.php

  1. <meta charset="utf-8">
  2. <?php
  3. session_start();
  4. $uid=$_POST['uid'];
  5. $pwd=$_POST['password'];
  6. if($uid==""||$pwd=="")
  7. {
  8. echo "<script>alert('用户名或密码为空,请重新登录');location='Login.php';</script>";
  9. }else{
  10. include_once("connet.php");
  11. $sql="select * from user where uid='$uid' and upwd='$pwd' ";
  12. $result=mysqli_query($conn,$sql);
  13. $num=mysqli_num_rows($result);
  14. if($num!=0){
  15. echo "<script>alert('登录成功');location='show.php';</script>";
  16. $_SESSION['user']['islogin']=true;
  17. }else
  18. {
  19. echo "<script>alert('登录失败');location='Login.php';</script>";
  20. }
  21. }
  22. ?>

 

 

注册页面,regist.php

  1. <html>
  2. <head>
  3. <title>注册</title>
  4. <meta charset="UTF-8">
  5. <link rel="stylesheet" type="text/css" href="./css/index1.css">
  6. <style>
  7. body{height:100%;}
  8. </style>
  9. </head>
  10. <body style="background: url(./images/1.png)">
  11. <div class="index_01" >
  12. <table style="width: 100%;height:100%;" >
  13. <tr>
  14. <td align="center" >
  15. <form action="doregister.php " name="dl" method="post">
  16. <table align="center" width=350 height=230; style="font-family:宋体;font-size:25px;">
  17. <tr align="center">
  18. <td colspan="2" style="font-size:35px;">注册用户</td>
  19. </tr>
  20. <tr>
  21. <td align="center">用户名</td>
  22. <td>
  23. <input type="name" maxlength="20" name="id" placeholder="手机号/邮箱" style="width:180px;font-size:20px;border-radius: 8px; ">
  24. </td>
  25. </tr>
  26. <tr>
  27. <td align="center">密 码</td>
  28. <td >
  29. <input name="password" type="password" maxlength="16" placeholder="请输入密码" style="width:180px;font-size:20px;border-radius: 8px; ">
  30. </td>
  31. </tr>
  32. <tr>
  33. <td align="center">再次输入密码</td>
  34. <td>
  35. <input name="confirmPassword" type="password" maxlength="16" placeholder="请再次输入密码" style="width:180px;font-size:20px;border-radius: 8px; ">
  36. </td>
  37. </tr>
  38. <tr>
  39. <td colspan="2" align="center">
  40. <input type="submit" name="zu" value="注册" style="font-size:17px;border-radius:12px;" class="btn"/>
  41. <input type="reset" name="zu" value="重置" style="font-size:17px;border-radius: 12px;" class="btn">
  42. </td>
  43. </tr>
  44. </table>
  45. </form>
  46. </td>
  47. </tr>
  48. </table>
  49. </div>
  50. </body>
  51. <html>

注册处理,doregist.php,往数据库添加数据

  1. <meta charset="utf-8">
  2. <?php
  3. $uid=$_POST['id'];
  4. $pwd=$_POST['password'];
  5. $confpwd=$_POST['confirmPassword'];
  6. //判断密码是否一致
  7. if($pwd!=$confpwd)
  8. {
  9. echo "<script>alert('密码不匹配,请重新输入');location='register.php';</script>";
  10. }
  11. //连接数据库进行查询
  12. include_once("connet.php");
  13. $sql1="select * from user ";
  14. $res=mysqli_query($conn,$sql1);
  15. //判断账户密码是否为空
  16. if($uid!=null&&$pwd!=null)
  17. {
  18. while($myrow=mysqli_fetch_object($res))
  19. {
  20. //判断账户是否与数据库中已有的账户一致
  21. if($uid!=$myrow->uid){
  22. $sql2="insert into user values('".$uid."','".$pwd."')";
  23. $res1=mysqli_query($conn,$sql2);
  24. if($res1){
  25. echo "<script>alert('注册成功');location='Login.php';</script>";
  26. }
  27. }else{
  28. echo "<script>alert('注册失败,该账号已被注册');location='register.php';</script>";
  29. }
  30. }
  31. }else{
  32. echo "<script>alert('注册失败,请输入账号和密码');location='register.php';</script>";
  33. }
  34. ?>

主页面,show.php:

  1. <?php
  2. header('Content-type: text/html; charset=UTF8');
  3. ?>
  4. <html>
  5. <head>
  6. <title>我的留言板.查看留言</title>
  7. <link rel="stylesheet" type="text/css" href="./css/index1.css">
  8. <link rel="stylesheet" type="text/css" href="./css/index2.css">
  9. </head>
  10. <body background="./images/7.jpg" style="background-size:cover;background-attachment: fixed;" >
  11. <center>
  12. <h2>我的留言板</h2>
  13. <input type = "button" value = "添加留言" onclick="location.href='authority.php'" class="button"/>
  14. <input type = "button" value = "查看留言" onclick="location.href='select.php'" class="button"/>
  15. <input type = "button" value = "登&nbsp;&nbsp;&nbsp;&nbsp;录" onclick="location.href='Login.php';" class="button"/>
  16. <input type = "button" value = "注&nbsp;&nbsp;&nbsp;&nbsp;册" onclick="location.href='register.php';" class="button"/>
  17. <hr width = "70%">
  18. </center>
  19. <?php
  20. include_once("connet.php");
  21. mysqli_query($conn,'set names utf8');
  22. $str = "select * from tbliuyan";
  23. $result = mysqli_query($conn,$str);
  24. while($myrow = mysqli_fetch_row($result)){
  25. ?>
  26. <div style="color:blue;border: 1px solid black;width: 700px;margin: 0 auto;height: 100px;">
  27. <div style="width: 80px;float: left;" ><img src="http://q1.qlogo.cn/g?b=qq&nk=<?php echo $myrow[4];?>&s=640" style="width: 80px;height: 80px;margin-top: 10px;">
  28. </div>
  29. <div style="width: 620px;margin-left: 120px;margin-top:15px;color: black;" >
  30. <span style="margin-top:60px;">名称:<?php echo $myrow[1];?></span><br>
  31. <span>ID:<?php echo $myrow[0];?></span><br>
  32. <span>标题:<?php echo $myrow[2];?></span><br>
  33. <span>内容:<?php echo $myrow[3];?></span>
  34. </div>
  35. </div>
  36. <?php
  37. }
  38. ?>
  39. <span class="STYLE2"style="margin-left: 1100px;"><?php
  40. $rows = mysqli_num_rows($result);
  41. echo "查询结果为:".$rows.'条记录';
  42. ?><a href="add.php">:继续添加</a></span>
  43. </body>
  44. </html>

 

 

添加一个权限,authority.php:

  1. <meta charset="utf-8">
  2. <?php
  3. session_start();
  4. if (isset($_SESSION['user']['islogin'])&&$_SESSION['user']['islogin']==true) {
  5. echo"<script>alert('欢迎访问该页面'); location='add.php';</script>";
  6. }else{
  7. echo"<script>alert('对不起,您无权访问,返回首页');location='show.php';</script>";
  8. }

添加页面,add.php

  1. <?php
  2. header('Content-type: text/html; charset=UTF8');
  3. ?>
  4. <html>
  5. <head>
  6. <link rel="stylesheet" type="text/css" href="./css/index1.css">
  7. <title>我的留言板.添加留言</title>
  8. </head>
  9. <body background="./images/7.jpg" style="background-size:cover;" >
  10. <center>
  11. <h2>我的留言板</h2>
  12. <input type = "button" value = "修改留言" onclick="location.href='update.php'" class="button"/>
  13. <input type = "button" value = "删除留言" onclick="location.href='del.php'" class="button"/>
  14. <input type = "button" value = "退出登录" onclick="location.href='logout.php'" class="button"/>
  15. <hr width = "70%">
  16. </center>
  17. <div class="k1">
  18. <form action = "doAdd.php" method = "post">
  19. <h1>添加留言
  20. </h1>
  21. <label>
  22. <span>用户名称:</span>
  23. <input type="text" name="author" />
  24. </label>
  25. <label>
  26. <span>主题:</span>
  27. <input type="text" name="title"/>
  28. </label>
  29. <label>
  30. <span>内容 :</span>
  31. <textarea name="content"></textarea>
  32. </label>
  33. <label>
  34. <span>QQ:</span>
  35. <input type="text" name="qq"/>
  36. </label>
  37. <div style="margin-left:125px">
  38. <input type="submit" value="提交留言" class="submit">
  39. <input type = "reset" value = "重置" class="reset">
  40. </div>
  41. </div>
  42. </form>
  43. </body>
  44. </html>

添加处理,doAdd.php:

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>添加留言</title>
  6. </head>
  7. <body>
  8. <?php
  9. session_start();
  10. include_once("connet.php");
  11. if (isset($_POST['author'],$_POST['title'],$_POST['content'],$_POST['qq'])) {
  12. if ( !($_POST['author']&&$_POST['title']&&$_POST['content']&&$_POST['qq'])) {
  13. echo "输入数据不允许为空,单击<a href='javascript:onclick=history.go(-1)'>这里</a>返回";
  14. }else{
  15. $str="insert into tbliuyan values(NULL,'".$_POST['author']."','".$_POST['title']."','".$_POST['content']."','".$_POST['qq']."')";
  16. $result=mysqli_query($conn, $str);
  17. if($result){
  18. echo "留言添加添加成功,点击<a href='show.php'>查看</a>";
  19. }else{
  20. echo "<script>alert('添加失败');history.go(-1);</script>";
  21. }
  22. }
  23. }else{
  24. echo "<script>alert('添加失败');history.go(-1);</script>";
  25. }
  26. ?>
  27. </body>
  28. </html>

 

 

更新页面。update.php:

  1. <?php
  2. header('Content-type: text/html; charset=UTF8');
  3. ?>
  4. <html>
  5. <head>
  6. <link rel="stylesheet" type="text/css" href="./css/index1.css">
  7. <title>我的留言板.添加留言</title>
  8. </head>
  9. <body background="./images/7.jpg" style="background-size:cover;" >
  10. <center>
  11. <h2>我的留言板</h2>
  12. <input type = "button" value = "查看留言" onclick="location.href='show.php'" class="button"/>
  13. <input type = "button" value = "退出登陆" onclick="location.href='index.php'" class="button"/>
  14. <hr width = "70%">
  15. </center>
  16. <div class="k1">
  17. <form action = "doupdate.php" method = "post">
  18. <h1>更改信息
  19. <span>根据qq号更改信息</span>
  20. </h1>
  21. <label>
  22. <span>用户名称:</span>
  23. <input type="text" name="author" />
  24. </label>
  25. <label>
  26. <span>主题:</span>
  27. <input type="text" name="title" />
  28. </label>
  29. <label>
  30. <span>内容 :</span>
  31. <textarea name="content" ></textarea>
  32. </label>
  33. <label>
  34. <span>ID:</span>
  35. <input type="text" name="tid" />
  36. </label>
  37. <div style="margin-left:125px">
  38. <input type="submit" value="修改留言" class="submit">
  39. <input type = "reset" value = "重置" class="reset">
  40. </div>
  41. </div>
  42. </form>
  43. </body>
  44. </html>

更新处理,doupdate.php:

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>修改留言</title>
  6. </head>
  7. <body>
  8. <?php
  9. include_once("connet.php");
  10. if (!($_POST['author']&&$_POST['title']&&$_POST['content']&&$_POST['tid'])) {
  11. echo "输入数据不允许为空,单击<a href='javascript:onclick=history.go(-1)'>这里</a>返回";
  12. }else{
  13. $str="update tbliuyan set username='".$_POST['author']."',title='".$_POST['title']."',message='".$_POST['content']."' where id=".$_POST['tid'];
  14. $result=mysqli_query($conn, $str);
  15. if($result){
  16. echo "留言更新添加成功,点击<a href='show.php'>查看</a>";
  17. }else{
  18. echo "<script>alert('更新失败');history.go(-1);</script>";
  19. }
  20. }
  21. ?>
  22. </body>
  23. </html>

 

 

删除页面,del.php

  1. <?php
  2. header('Content-type: text/html; charset=UTF8');
  3. ?>
  4. <html>
  5. <head>
  6. <link rel="stylesheet" type="text/css" href="./css/index1.css">
  7. <title>我的留言板.查询留言</title>
  8. </head>
  9. <body background="./images/7.jpg" style="background-size:cover;" >
  10. <center>
  11. <h2>我的留言板</h2>
  12. <input type = "button" value = "修改留言" onclick="location.href='update.php'" class="button"/>
  13. <input type = "button" value = "查看留言" onclick="location.href='show.php'" class="button"/>
  14. <input type = "button" value = "退出登录" onclick="location.href='index.php'" class="button"/>
  15. <hr width = "70%">
  16. </center>
  17. <div class="k1">
  18. <form action = "dodel.php" method = "post">
  19. <h1>删除留言
  20. <span>根据ID删除留言</span>
  21. </h1>
  22. <label>
  23. <span>ID:</span>
  24. <input type="text" name="id"/>
  25. </label>
  26. <div style="margin-left:125px">
  27. <input type="submit" value="删除留言" class="submit">
  28. <input type = "reset" value = "重置" class="reset">
  29. </div>
  30. </form>
  31. </div>
  32. </body>
  33. </html>

删除处理,dodel.php:

  1. <meta charset="utf-8">
  2. <?php
  3. include_once("connet.php");
  4. $id = $_POST['id'];
  5. if(isset($_POST['id']))
  6. {
  7. if($_POST['id'])
  8. {
  9. $sql="delete from tbliuyan where id ='".$_POST['id']."' ";
  10. $res=mysqli_query($conn,$sql);
  11. if($res){
  12. echo "<script>alert('删除成功,返回首页');location='show.php';</script>";
  13. }
  14. else{
  15. echo "<script>alert('删除失败');location='show.php'</script>";
  16. }
  17. }
  18. else
  19. {
  20. echo "<script>alert('数据为空,不能允许删除');location='del.php';</script>";
  21. }
  22. }
  23. ?>

 

 

查找页面.select.php:

  1. <?php
  2. header('Content-type: text/html; charset=UTF8');
  3. ?>
  4. <html>
  5. <head>
  6. <link rel="stylesheet" type="text/css" href="./css/index1.css">
  7. <title>我的留言板.查询留言</title>
  8. </head>
  9. <body background="./images/7.jpg" style="background-size:cover;" >
  10. <center>
  11. <h2>我的留言板</h2>
  12. <input type = "button" value = "返回首页" onclick="location.href='show.php'" class="button"/>
  13. <input type = "button" value = "退出登录" onclick="location.href='logout.php'" class="button"/>
  14. <hr width = "70%">
  15. </center>
  16. <div class="k1">
  17. <form action = "doselect.php" method = "post">
  18. <h1>查看留言
  19. <span>根据qq号查看留言</span>
  20. </h1>
  21. <label>
  22. <span>QQ:</span>
  23. <input type="text" name="qq"/>
  24. </label>
  25. <div style="margin-left:125px">
  26. <input type="submit" value="查看留言" class="submit">
  27. <input type = "reset" value = "重置" class="reset">
  28. </div>
  29. </form>
  30. </div>
  31. </body>
  32. </html>

查找处理,doselect.php:

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Document</title>
  6. </head>
  7. <body>
  8. <?php
  9. if (isset($_POST['qq'])) {
  10. include_once("connet.php");
  11. mysqli_query($conn,'set names utf8');
  12. $str = "select * from tbliuyan where qq=".$_POST['qq'];
  13. $result = mysqli_query($conn,$str);
  14. while($myrow = mysqli_fetch_row($result)){
  15. ?>
  16. <div style="color:blue;border: 1px solid black;width: 700px;margin: 0 auto;height: 100px;">
  17. <div style="width: 80px;float: left;" ><img src="http://q1.qlogo.cn/g?b=qq&nk=<?php echo $myrow[4];?>&s=640" style="width: 80px;height: 80px;margin-top: 10px;">
  18. </div>
  19. <div style="width: 620px;margin-left: 120px;margin-top:15px;color: black;" >
  20. <span style="margin- top:60px;">名称:<?php echo $myrow[1];?></span><br>
  21. <span>ID:<?php echo $myrow[0];?></span><br>
  22. <span>标题:<?php echo $myrow[2];?></span><br>
  23. <span>内容:<?php echo $myrow[3];?></span>
  24. </div>
  25. </div>
  26. <?php
  27. }
  28. }
  29. ?>
  30. </body>
  31. </html>

创建注销登录,logout.php:

  1. <meta charset="utf-8">
  2. <?php
  3. session_start();
  4. $_SESSION=array();
  5. setcookie(session_name(),null,time()-1,'/');
  6. echo"<script>alert('退出成功');location='show.php';</script>";
  7. session_destroy();

 

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