定制app开发基于php的简单图书管理系统 ,登录,注册,退出登录,数据库增删改查 ,建立sessioon ,建立mysql数据库。

目录


一.建立MySQL数据库

1.定制app开发我使用的是xampp,定制app开发在浏览器地址栏输入http://localhost//phpmyadmin

注意:定制app开发端口号默认是80端口,也就是http://localhost:80//phpmyadmin,定制app开发如果你改了你的端口号注意更改

2.定制app开发点击新建数据库(库名是itcast52)两个表明,book52(定制app开发增删改查用)user52(定制app开发登录注册用)

定制app开发以下是数据库的文件,定制app开发建立一个记事本,把代码粘贴上去,点击保存,把后缀从text改成sql,然后在数据库建立一个itcast52数据库,在数据库里面导入sql文件即可(数据库就完毕了)

  1. -- phpMyAdmin SQL Dump
  2. -- version 3.5.2.2
  3. -- http://www.phpmyadmin.net
  4. --
  5. -- 主机: 127.0.0.1
  6. -- 生成日期: 2022 年 05 月 16 日 05:24
  7. -- 服务器版本: 5.5.27
  8. -- PHP 版本: 5.4.7
  9. SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
  10. SET time_zone = "+00:00";
  11. /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  12. /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  13. /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  14. /*!40101 SET NAMES utf8 */;
  15. --
  16. -- 数据库: `itcast52`
  17. --
  18. -- --------------------------------------------------------
  19. --
  20. -- 表的结构 `book52`
  21. --
  22. CREATE TABLE IF NOT EXISTS `book52` (
  23. `id` varchar(20) NOT NULL,
  24. `name` varchar(20) CHARACTER SET utf8 COLLATE utf8_estonian_ci NOT NULL,
  25. `price` varchar(20) NOT NULL,
  26. `data` varchar(20) NOT NULL,
  27. `type` varchar(20) NOT NULL
  28. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  29. --
  30. -- 转存表中的数据 `book52`
  31. --
  32. INSERT INTO `book52` (`id`, `name`, `price`, `data`, `type`) VALUES
  33. ('003', 'csdn', '55', '2025-11-6', '数据库设计'),
  34. ('012', '雕塑', '17777', '20255-5-6', '雕塑'),
  35. ('066', '固化剂', '255', '2001-09-06', '添加剂'),
  36. ('3119050152', '张修博', '999999', '2000-01-12', '人');
  37. -- --------------------------------------------------------
  38. --
  39. -- 表的结构 `user52`
  40. --
  41. CREATE TABLE IF NOT EXISTS `user52` (
  42. `account` char(100) NOT NULL,
  43. `username` char(100) NOT NULL,
  44. `sex` char(100) NOT NULL,
  45. `age` char(100) NOT NULL,
  46. `address` char(100) NOT NULL,
  47. `mail` char(100) NOT NULL,
  48. `password` char(100) NOT NULL,
  49. `number` char(100) NOT NULL
  50. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  51. --
  52. -- 转存表中的数据 `user52`
  53. --
  54. INSERT INTO `user52` (`account`, `username`, `sex`, `age`, `address`, `mail`, `password`, `number`) VALUES
  55. ('3119050152', '张修博', '男', '21', '河南商丘', '3119050152@qq.com', '3119050152', '3119050152');
  56. /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  57. /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  58. /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

二.链接数据库文件(conn.php)

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>conn文件</title>
  6. </head>
  7. <body>
  8. <?php
  9. $mysql_server_name = 'localhost'; //改成自己的mysql数据库服务器
  10. $mysql_username = 'root'; //改成自己的mysql数据库用户名
  11. $mysql_password = ''; //改成自己的mysql数据库密码
  12. $mysql_database = 'itcast52'; //改成自己的mysql数据库名
  13. $conn=mysqli_connect($mysql_server_name,$mysql_username,$mysql_password,$mysql_database); //连接数据库
  14. //连接数据库错误提示
  15. mysqli_query($conn, 'set names utf8');
  16. mysqli_query($conn, 'set character set utf8');
  17. if (mysqli_connect_errno($conn))
  18. {
  19. die("连接 MySQL 失败: " . mysqli_connect_error());
  20. }
  21. ?>
  22. </body>
  23. </html>

三.前端登录页面(log.php)

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>无标题文档</title>
  6. </head>
  7. <style type="text/css">
  8. #aaa{width: 300px;
  9. height: 30px;}
  10. </style>
  11. <body>
  12. <center>
  13. <h2>登录界面</h2>
  14. <form method="POST" action="log_ok.php">
  15. 账号 :<input id="aaa" type="text" name="uname" placeholder="用户名" />
  16. <br /><br/>
  17. 密码 :<input id="aaa"type="password" name="pwd" placeholder="密码" />
  18. <br />
  19. <input type="submit" >
  20. <input type="reset"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="register.php">注册账号</a>
  21. </form>
  22. </center>
  23. </body>
  24. </html>

四.登录实现页面(log_ok.php)

  1. <?php
  2. //------文件编码格式,为了显示中文--------
  3. header("content-type:text/html; charest=UTF-8");
  4. //-------收受web的传值-------
  5. $uname=$_POST["uname"];
  6. $pwd=$_POST["pwd"];
  7. //-----链接mysql数据库---
  8. include("conn.php");
  9. //----免除一些警告-------
  10. error_reporting(0);
  11. //-------启动session------
  12. session_start();
  13. //判断$uname与$pwd是否为空值-->true 返回上一步-->false 执行数据库查询,并且给session赋值
  14. if(!($uname && $pwd)){
  15. echo"<script>alert('输入的账号或密码为空!请重新输入账号和密码');history.go(-1);</script>";
  16. }else{
  17. $sqlstr ="SELECT * FROM user52 WHERE (account='$uname') AND (password='$pwd')";
  18. $result = $conn->query($sqlstr);
  19. }
  20. if($result->num_rows > 0){
  21. $_SESSION["user"]=$uname;
  22. echo"<script>alert('登录成功,即将转到主页面');location='index1.php'</script>";
  23. }else{
  24. echo"<script>alert('密码或者账号错误,登录失败,请重新输入账号和密码');history.go(-1);</script>";
  25. }
  26. ?>

五.前端注册页面(register.php)

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>无标题文档</title>
  6. </head>
  7. <style type="text/css">
  8. .aaa{width: 300px;
  9. height: 30px;}
  10. </style>
  11. <style type="text/javascript">
  12. </style>
  13. <body>
  14. <?php
  15. $a=mt_rand(333333,999999999);
  16. ?>
  17. <center>
  18. <h2>注册界面</h2>
  19. <form method="post" name="from1" action="register_ok.php"><!-- 在数据库中id是自动增长列 -->
  20. 账号: <input name="id" class="aaa" type="text" value="<?php echo"$a";?>"><br/><br/>
  21. 姓名: <input class="aaa" type="text" name="username"><br/><br/>
  22. 性别: <input class="aaa" type="text" name="sex"><br/><br/>
  23. 年龄: <input class="aaa" type="text" name="age"><br/><br/>
  24. 地址: <input class="aaa" type="text" name="address"><br/><br/>
  25. 邮箱: <input class="aaa" type="text" name="mail"><br/><br/>
  26. 密码: <input class="aaa" type="text" name="password"><br/><br/>
  27. 确认 密码: <input class="aaa" type="text" name="repsw"><br/><br/>
  28. 手机号: <input class="aaa"type="text" name="number"><br/><br/>
  29. <input type="reset"name="reset" value="重置">
  30. <input type="submit"name="submit" value="注册" onClick="myfunction">
  31. &nbsp;&nbsp; <a href="log.php"><< 返回上一页</a>
  32. <a href="register.php">点击注册</a>
  33. </form>
  34. </body>
  35. </html>

六.注册实现界面(register_ok.php)

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>无标题文档</title>
  6. </head>
  7. </body>
  8. <body>
  9. <?php
  10. include_once("conn.php");
  11. header("content-type:text/html; charest=UTF-8");//文件编码格式
  12. session_start();
  13. $id=$_POST['id'];
  14. $username=$_POST['username'];
  15. $sex=$_POST['sex'];
  16. $age=$_POST['age'];
  17. $address=$_POST['address'];
  18. $mail=$_POST['mail'];
  19. $password=$_POST['password'];
  20. $repsw=$_POST['repsw'];
  21. $number=$_POST['number'];
  22. if(!($id and $username and $sex and $age and $address and $mail and $password and $number and $repsw )){
  23. echo"<script>alert('输入值不许为空');history.go(-1);</script>";
  24. }else{
  25. if(!($repsw==$password)){
  26. echo"<script>alert('两次密码不一致');history.go(-1);</script>";
  27. }else{
  28. $sql = "SELECT * FROM user52 WHERE (account='$id')";//在数据库中找相应信息!
  29. $res = $conn->query($sql);
  30. //判断结果集的记录数是否大于0
  31. if ($res->num_rows > 0){
  32. echo"<script>alert('已经有相同账号,请您换个账号进行注册');history.go(-1);</script>";
  33. }else{
  34. $_SESSION['user']=$id;
  35. $sqlstr1="insert into user52 values('".$id."','".$username."','".$sex."','".$age."','".$address."','".$mail."','".$password."','".$number."')";
  36. //执行sql insert语句 把用post引用的变量接入到register中
  37. $result = mysqli_query($conn,$sqlstr1);//承接结果集
  38. if($result){
  39. echo"<script>alert('注册成功');location='index1.php'</script>";
  40. }else{
  41. echo"<script>alert('注册失败');history.go(-1);</script>";
  42. }
  43. }
  44. }
  45. }
  46. ?>
  47. </body>
  48. </html>

七.主页面(index1.php)增删改查中的 查

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>图书管理系统</title>
  6. </head>
  7. <body>
  8. <?php
  9. error_reporting(0);
  10. session_start();
  11. include("conn.php");
  12. ?>
  13. <center>
  14. <table width="799" height="247" border="1" cellpadding="0" cellspacing="0">
  15. <tr>
  16. <td height="220" background="1.jpg">&nbsp;</td>
  17. </tr>
  18. <tr>
  19. <td>
  20. <table width="100%" height="27" border="1" cellpadding="0" cellspacing="0">
  21. <tr bgcolor="#9791C2">
  22. <td width="149" align="center" valign="middle"><b>
  23. <?php
  24. echo date("Y-m-d")."";
  25. ?>
  26. </b></td>
  27. <td width="130" align="center" valign="middle"><a href="index1.php" class="s">浏览目录</a></td>
  28. <td width="130" align="center" valign="middle"><a href="index_ok.php" class="s">添加图书</a></td>
  29. <td width="130" align="center" valign="middle"><a href="index-select.php" class="s">简单查询</a></td>
  30. <td width="130" align="center" valign="middle"><a href="update1.php" class="s">删除图书</a></td>
  31. <td width="130" align="center" valign="middle"><a href="delete.php" class="s">修改图书</a></td>
  32. <td width="130" align="center" valign="middle"><a href="back.php" class="s">退出系统</a></td>
  33. <td width="130" align="center" valign="middle"><a href="index1.php" class="s"><?php if(!($_SESSION['user']))
  34. echo'session为空';
  35. else{
  36. echo"欢迎 :";
  37. echo $_SESSION['user'];
  38. } ?></a></td>
  39. </tr>
  40. </table>
  41. </td>
  42. </tr>
  43. </table>
  44. <table width="799" border="0" cellpadding="0" cellspacing="0">
  45. <tr>
  46. <tr align="center" valign="middle">
  47. <?php
  48. include_once("conn.php");
  49. ?>
  50. <table width="52.5%" border="1" cellpadding="0" cellspacing="0">
  51. <tr bgcolor="#F7E0A3">
  52. <td width="3%" height="25" class="top" align="center">id</td>
  53. <td width="10%" class="top" align="center">图书名称</td>
  54. <td width="10%" class="top" align="center">价格</td>
  55. <td width="10%" class="top" align="center">出版日期</td>
  56. <td width="5%" class="top" align="center">类型</td>
  57. </tr>
  58. <?php
  59. $result = mysqli_query($conn,"select * from book52 ");
  60. /*$sums = mysqli_num_rows($result);
  61. echo $nums;*/
  62. while($myrows = mysqli_fetch_array($result)){
  63. ?>
  64. <tr>
  65. <td align="center"><span class="STYLE2"><?php echo $myrows['id'];?></span></td>
  66. <td align="center"><span class="STYLE2"><?php echo $myrows['name'];?></span></td>
  67. <td align="center"><span class="STYLE2"><?php echo $myrows['price'];?></span></td>
  68. <td align="center"><span class="STYLE2"><?php echo $myrows['data'];?></span></td>
  69. <td align="center"><span class="STYLE2"><?php echo $myrows['type'];?></span></td>
  70. </tr>
  71. <?php
  72. }
  73. ?>
  74. </table>
  75. </tr>
  76. </tr>
  77. </table>
  78. </center>
  79. <?php
  80. $sum = mysqli_num_rows($result);
  81. echo $sum;
  82. ?>
  83. </body>
  84. </html>

八.添加图书(index_ok.php)增删改查中的 增

这个代码包含了实现的代码!

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>添加数据</title>
  6. </head>
  7. <body>
  8. <?php
  9. error_reporting(0);
  10. session_start();
  11. include("conn.php");
  12. ?>
  13. <center>
  14. <table width="799" height="247" border="1" cellpadding="0" cellspacing="0">
  15. <tr>
  16. <td height="220" background="1.jpg">&nbsp;</td>
  17. </tr>
  18. <tr>
  19. <td>
  20. <table width="100%" height="27" border="1" cellpadding="0" cellspacing="0">
  21. <tr bgcolor="#9791C2">
  22. <td width="149" align="center" valign="middle">
  23. <b>
  24. <?php
  25. echo date("Y-m-d")."";
  26. ?>
  27. </b>
  28. </td>
  29. <td width="130" align="center" valign="middle"><a href="index1.php" class="s">浏览目录</a></td>
  30. <td width="130" align="center" valign="middle"><a href="index_ok.php" class="s">添加图书</a></td>
  31. <td width="130" align="center" valign="middle"><a href="index-select.php" class="s">简单查询</a></td>
  32. <td width="130" align="center" valign="middle"><a href="back.php" class="s">退出系统</a></td>
  33. <td width="130" align="center" valign="middle"><a href="index1.php" class="s"><?php if(!($_SESSION['user']))
  34. echo'session为空';
  35. else{
  36. echo"欢迎 :";
  37. echo $_SESSION['user'];
  38. } ?></a></td>
  39. </tr>
  40. </table>
  41. </td>
  42. </tr>
  43. </table>
  44. <form method="post" name="form1" action="index_ok.php">
  45. 编号 : <input type="text" name="id" ></input><br/><br/>
  46. 姓名 : <input type="text" name="name"></input><br/><br/>
  47. 价格 : <input type="text" name="price"></input><br/><br/>
  48. 日期 : <input type="text" name="data"></input><br/><br/>
  49. 类型 : <input type="text" name="type"></input><br/><br/>
  50. <input type="reset" name="5" value="重置"></input>
  51. <input type="submit" name="6" value="提交"></input>
  52. </form>
  53. <?php
  54. error_reporting(0);
  55. header("content-type:text/html; charest=UTF-8");//文件编码格式
  56. include_once("conn.php");//连接数据库文件
  57. $a=$_POST["id"];
  58. $b=$_POST["name"];
  59. $c=$_POST["price"];
  60. $d=$_POST["data"];
  61. $e=$_POST["type"];
  62. //把input中的namejie
  63. if(!($a and $b and $c and $d and $e)){
  64. echo"<script>alter('输入值不许为空');history.go(-1);</script>";//判断变量名是否为空值
  65. }else{
  66. $sqlstr1="insert into book52 values('".$a."','".$b."','".$c."','".$d."','".$e."')";
  67. //执行sql insert语句 把用post引用的变量接入到bookable中
  68. $result = mysqli_query($conn,$sqlstr1);//承接结果集
  69. if($result){
  70. echo"<script>alter('添加成功');location='index1.php'</script>";
  71. }else{
  72. echo"<script>alter('添加失败');history.go(-1);</script>";
  73. }
  74. }
  75. ?>
  76. </center>
  77. </body>
  78. </html>

九.修改和删除页面(index-select.php)

这个页面包含了两个功能  修改 和  删除  但是 功能实现 在另外两个页面里

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>简单查询</title>
  6. </head>
  7. <body>
  8. <?php
  9. error_reporting(0);
  10. session_start();
  11. include("conn.php");
  12. ?>
  13. <center>
  14. <table width="799" height="247" border="1" cellpadding="0" cellspacing="0">
  15. <tr>
  16. <td height="220" background="1.jpg">&nbsp;</td>
  17. </tr>
  18. <tr>
  19. <td>
  20. <table width="100%" height="27" border="1" cellpadding="0" cellspacing="0">
  21. <tr bgcolor="#9791C2">
  22. <td width="149" align="center" valign="middle"><b>
  23. <?php
  24. echo date("Y-m-d")."";
  25. ?>
  26. </b></td>
  27. <td width="130" align="center" valign="middle"><a href="index1.php" class="s">浏览目录</a></td>
  28. <td width="130" align="center" valign="middle"><a href="index_ok.php" class="s">添加图书</a></td>
  29. <td width="130" align="center" valign="middle"><a href="index-select.php" class="s">简单查询</a></td>
  30. <td width="130" align="center" valign="middle"><a href="back.php" class="s">退出系统</a></td>
  31. <td width="130" align="center" valign="middle"><a href="index1.php" class="s"><?php if(!($_SESSION['user']))
  32. echo'session为空';
  33. else{
  34. echo"欢迎 :";
  35. echo $_SESSION['user'];
  36. } ?></a></td>
  37. </tr>
  38. </table>
  39. </td>
  40. </tr>
  41. </table>
  42. <table width="799" border="0" cellpadding="0" cellspacing="0">
  43. <tr>
  44. <tr align="center" valign="middle">
  45. <?php
  46. include_once("conn.php");
  47. ?>
  48. <table width="52.5%" border="1" cellpadding="0" cellspacing="0">
  49. <tr bgcolor="#F7E0A3">
  50. <td width="3%" height="25" class="top" align="center">id</td>
  51. <td width="10%" class="top" align="center">图书名称</td>
  52. <td width="10%" class="top" align="center">价格</td>
  53. <td width="10%" class="top" align="center">出版日期</td>
  54. <td width="5%" class="top" align="center">类型</td>
  55. <td width="5%" class="top" align="center">芜湖</td>
  56. </tr>
  57. <?php
  58. header("content-type:text/html; charest=UTF-8");//文件编码格式
  59. include_once("conn.php");//连接数据库文件
  60. $sqlstr="select * from book52 order by id ";//通过把sql语句放到变量值中 来执行php
  61. $result = mysqli_query($conn,$sqlstr);//承接结果集 一般来说结果集之后会被用在循环中例如index_ok.php ,或者遍历输出数据库中的值例如index1.php
  62. while($rows= mysqli_fetch_row($result)){
  63. ?>
  64. <tr>
  65. <td align="center"><span class="m_td"><?php echo $rows[0];?></span></td>
  66. <td align="center"><span class="m_td"><?php echo $rows[1];?></span></td>
  67. <td align="center"><span class="m_td"><?php echo $rows[2];?></span></td>
  68. <td align="center"><span class="m_td"><?php echo $rows[3];?></span></td>
  69. <td align="center"><span class="m_td"><?php echo $rows[4];?></span></td>
  70. <td align="center" class="m_td">
  71. <a href =update.php?action=update&id=<?php echo $rows[0]?>>修改</a>/
  72. <a href =delete.php?action=delete&id=<?php echo $rows[0]?>>删除</td>
  73. </tr>
  74. <?php
  75. }
  76. ?>
  77. </table>
  78. </tr>
  79. </tr>
  80. </table>
  81. </center>
  82. </body>
  83. </html>

十.修改图书(update.php)

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>更改文档</title>
  6. </head>
  7. <body>
  8. <?php
  9. error_reporting(0);
  10. include_once("conn.php");//连接数据库文件
  11. if($_GET['action']=="update"){
  12. $sqlstr="select * from book52 where id =".$_GET['id']; //".$_GET['id'];没看懂
  13. $result = mysqli_query($conn,$sqlstr);//承接结果集 一般来说结果集之后会被用在循环中例如index_ok.php ,或者遍历输出数据库中的值例如index1.php
  14. $rows = mysqli_fetch_row($result); //枚举数组
  15. ?>
  16. <form method="post" name="intForm" action="update_ok.php">
  17. 姓名 : <input type="text" name="name" value="<?php echo $rows[1]; ?>"></input><br/><br/>
  18. 价格 : <input type="text" name="price" value="<?php echo $rows[2]; ?>"></input><br/><br/>
  19. 日期 : <input type="text" name="data" value="<?php echo $rows[3]; ?>"></input><br/><br/>
  20. 类型 : <input type="text" name="type" value="<?php echo $rows[4]; ?>"></input><br/><br/>
  21. <input type="hidden" name="action"value="update"></input>
  22. <input type="hidden" name="id" value="<?php echo $rows[0] ?>"></input>
  23. <input type="reset" name="Reset" value="重置">
  24. <input type="submit" name="Submit" value="提交">
  25. </form>
  26. <?php
  27. }
  28. ?>
  29. </body>
  30. </html>

十一.修改成功页面(update_ok.php)

这个项目的实现是 地址栏传参数,不会的同学可以去看下资料就差不多会了

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>无标题文档</title>
  6. </head>
  7. <body>
  8. <!doctype html>
  9. <html>
  10. <head>
  11. <meta charset="utf-8">
  12. <title>更新数据</title>
  13. </head>
  14. <body>
  15. <?php
  16. header("Content-type:text/html; charest=UTF-8");//编码方式
  17. include_once("conn.php");//连接数据库
  18. $a=$_POST["id"];
  19. $b=$_POST["name"];
  20. $c=$_POST["price"];
  21. $d=$_POST["data"];
  22. $e=$_POST["type"];
  23. if($_POST['action'] == "update"){
  24. if(!( $b and $c and $d and $e)){
  25. echo "输入不允许为空"; //返回上一页 或者使用alert
  26. }else{
  27. $sqlstr="update book52 set name='".$b."',price='".$c."',data='".$d."',type='".$e."' where id=".$a; //定义更新语句
  28. //如果查询所有后面属性可以省略,一一对应
  29. $result = mysqli_query($conn,$sqlstr);
  30. if($result){
  31. echo"修改成功,点击<a href='index1.php'>这里</a>查看";
  32. }else{
  33. echo"修改失败.<br>$sqlstr";
  34. }
  35. }
  36. }
  37. ?>
  38. </body>
  39. </html>
  40. </body>
  41. </html>

十二.删除页面(delete.php)

包含了删除的功能

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>无标题文档</title>
  6. </head>
  7. <body>
  8. <?php
  9. header("Content-type:text/html; charest=UTF-8");//编码方式
  10. // 处理删除操作的页面
  11. include_once("conn.php");
  12. if($_GET['action']=="delete"){
  13. $sqlstr1="delete from book52 where id =".$_GET['id'];
  14. $result=mysqli_query($conn,$sqlstr1);
  15. if($result){
  16. echo"删除成功";
  17. }else{
  18. echo"删除失败";
  19. }
  20. }
  21. ?>
  22. </body>
  23. </html>

十三.退出系统(back.php)

这个代码就是清除的值,并且返回到登陆页面

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>无标题文档</title>
  6. </head>
  7. <body>
  8. <?php
  9. session_start();
  10. session_unset();
  11. session_destroy();
  12. echo"<script>alert('您已经退出系统,请重新登录');location='log.php'</script>";
  13. ?>
  14. </body>
  15. </html>

总结:由于仅仅是实现了该有的功能,所以页面不是太美观,有时间的同学可以仔细改一下,如果同学们有什么问题或者我写错了什么,可以在评论区发言,我看到会回复的,共同学习!勉励!!

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