PHP 账号密码添加 记录 后台 添加修改删除账号密码 判断重复 查询是否存在
链接数据库 获取信息
判断按钮是否被单击 判断是否提交的账号重复 如果重复返回
1.conn.php 连接数据库 数据库字段创建好
<?php
$link=mysqli_connect('localhost','root','root','data') or die (print '错误');
mysqli_set_charset($link,'utf8');
?>
2 主界面
代码
<!doctype html>
<html lang="es">
<head>
<meta charset="utf8">
<title>HTML5</title>
<link rel="stylesheet" href="../css/styles.css" />
<style type="text/css">
</style>
<!-- <metacontent="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0"name="viewport">
/*添加账号代码*/-->
<!-- /*添加账号代码*/-->
</head>
<body>
<p>
<?php
require('../inc/conn.php');
require('../config/index.php');
$rs=mysqli_query($link,'select * from news order by id desc');
$list=mysqli_fetch_all($rs,MYSQLI_ASSOC);
$list1 = array();
$list1=$list;
?>
</p>
<!-- /*添加账号代码*/-->
<p>
添加账号:<a href = "JavaScript:void(0)" onclick = "openDialog()">请点这里</a>
批量添加账号:<a href = "JavaScript:void(0)" onclick = "openDialog1()">请点这里</a> </p>
<?php require './add.php'; require './pladd.php'; require './se.php'; require './see.php';?>
<!-- /*添加账号代码结束*/-->
<!-- /*下面是主页*/-->
<table>
<tr>
<th>编号</th> <th>账号</th> <th>备注</th> <th>时间</th>
<?php foreach($list1 as $rows): ?>
<tr>
<td><?php echo $rows['id']?></td>
<td><?php echo $rows['name']?></td>
<td><?php echo $rows['content']?></td>
<td><?php echo date('Y-m-d H:i:s',$rows['createtime']+'28800');
?></td>
<td><input type="button" value="修改" onclick="location.href='edit.php?id=<?php echo $rows['id']?>'"></td>
<td><input type="button" name="" value="删除" onclick="if(confirm('确定要删除吗')){location.href='./del.php?id=<?php echo $rows['id']?>'}"> </td>
</tr>
<?php endforeach; ?>
</tr>
</table>
</body>
<script type="text/javascript">
$(function(){