项目第一次版本提交
This commit is contained in:
100
admin/cha.php
Normal file
100
admin/cha.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* 查看会员
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 开启session
|
||||
*/
|
||||
session_start();
|
||||
|
||||
/**
|
||||
* 开启判断是否登陆
|
||||
*/
|
||||
if (empty($_SESSION['admin']['isLogin'])) {
|
||||
header("Location:../admin.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* 包含数据库配置
|
||||
*/
|
||||
include '../config/config.inc.php';
|
||||
|
||||
|
||||
/**
|
||||
* 查寻传入的用户数据
|
||||
*/
|
||||
if (isset($_GET['action']) && $_GET['action'] == "cha") {
|
||||
$stmt = $pdo->prepare('SELECT id,username,password,integral,sex,email, ip,zc_time FROM u_users where id= ?');
|
||||
$stmt->execute(array($_GET['id']));
|
||||
if ($stmt->rowCount() > 0) {
|
||||
list($id, $username, $password, $integral, $sex, $email, $ip, $zc_time) = $stmt->fetch(PDO::FETCH_NUM);
|
||||
//格式化注册时间
|
||||
$zc_time = date('Y-m-d', $zc_time);
|
||||
} else {
|
||||
echo "<script>alert('数据不存在!');window.location.href = 'index.php?page=" . $_GET['page'] . "';</script>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>查看会员</title>
|
||||
</head>
|
||||
|
||||
<style>
|
||||
.inputdiv {
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 200px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
select {
|
||||
margin-top: 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body style="border: 1px solid #000000">
|
||||
|
||||
<?php include 'header.php' ?>
|
||||
<div style="clear: both; padding: 10px;border-bottom: 1px solid;">
|
||||
<p>当前位置:---------查看会员</p>
|
||||
</div>
|
||||
<div style="padding: 10px">
|
||||
<input type="hidden" name="id" value="<?php echo $id; ?>">
|
||||
<div class="inputdiv">
|
||||
用 户 名:<input type="text" value="<?php echo $username; ?>"><br/>
|
||||
密 码:<input type="text" value="<?php echo $password; ?>"><br/>
|
||||
邮 箱:<input type="text" value="<?php echo $email; ?>"><br/>
|
||||
积 分:<input type="text" value="<?php echo $integral; ?>"><br/>
|
||||
性 别:
|
||||
<select class="form-control">
|
||||
<option <?php if ($sex == 1) { ?> selected="selected" <?php } ?> value="1">男</option>
|
||||
<option <?php if ($sex == 0) { ?> selected="selected" <?php } ?> value="0">女</option>
|
||||
</select>
|
||||
<br/>
|
||||
注册时间:<input type="text" name="password" value="<?php echo $zc_time; ?>"><br/>
|
||||
登陆ip:<input type="text" name="email" value="<?php echo $ip; ?>"><br/>
|
||||
</div>
|
||||
|
||||
<div style=" padding-top: 5px;">
|
||||
<input type="button" onclick="window.location.href = 'index.php?page=<?php echo $_GET['page']; ?>'"
|
||||
value="返回列表">
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
39
admin/header.php
Normal file
39
admin/header.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* 公用头部
|
||||
*/
|
||||
?>
|
||||
|
||||
<style>
|
||||
* {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.navleft {
|
||||
float: left;
|
||||
padding: 10px 0px 0px 10px;
|
||||
}
|
||||
|
||||
.navright {
|
||||
padding: 10px 10px 0px 10px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
<div class="navleft">
|
||||
<a href="ser.php">查询会员</a>
|
||||
</div>
|
||||
|
||||
<div class="navright">
|
||||
<a href="#">当前人员:<span style="color: red;"><?php echo $_SESSION['admin']['username']; ?><span></a>
|
||||
<a href="loginout.php">退出登录</a>
|
||||
</div>
|
||||
|
||||
|
||||
209
admin/index.php
Normal file
209
admin/index.php
Normal file
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
/**
|
||||
* 会员管理
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 开启session
|
||||
*/
|
||||
session_start();
|
||||
|
||||
/**
|
||||
* 开启判断是否登陆
|
||||
*/
|
||||
if (empty($_SESSION['admin']['isLogin'])) {
|
||||
header("Location:../admin.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* 包含数据库配置
|
||||
*/
|
||||
include '../config/config.inc.php';
|
||||
|
||||
|
||||
/**
|
||||
* 定义空查询语句
|
||||
*/
|
||||
$code = '';
|
||||
|
||||
|
||||
/**
|
||||
* 接受查询条件参参数 无条件 则忽略
|
||||
*/
|
||||
if (isset($_GET['action'])) {
|
||||
if ($_GET['action'] == 'ser') {
|
||||
$code = empty($_GET['username']) ? "" : " and username='{$_GET['username']}'";
|
||||
$code .= empty($_GET['email']) ? "" : " and email='{$_GET['email']}'";
|
||||
$code .= empty($_GET['sex']) ? "" : " and sex='{$_GET['sex']}'";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除操作
|
||||
*/
|
||||
if (isset($_GET['action'])) {
|
||||
if ($_GET['action'] == "del") {
|
||||
|
||||
if (!empty($_POST['id'])) {
|
||||
//多选删除
|
||||
$sql = "delete from u_users where id in (" . implode(',', $_POST['id']) . ") ";
|
||||
$row = $pdo->exec($sql);
|
||||
if ($row && $row > 0) {
|
||||
$sql = "delete from u_crows where uid in (" . implode(',', $_POST['id']) . ") ";
|
||||
$row = $pdo->exec($sql);
|
||||
echo "<script>alert('删除数据成功');window.location.href = 'index.php';</script>";
|
||||
} else {
|
||||
echo "<script>alert('删除数据失败');window.location.href = 'index.php';</script>";
|
||||
}
|
||||
} elseif (empty($_POST['id']) && !empty($_GET['id'])) {
|
||||
//单个删除
|
||||
$sql = "delete from u_users where id='{$_GET['id']}' ";
|
||||
$row = $pdo->exec($sql);
|
||||
if ($row && $row > 0) {
|
||||
$sql = "delete from u_crows where uid='{$_GET['id']}' ";
|
||||
$row = $pdo->exec($sql);
|
||||
echo "<script>alert('删除数据成功');window.location.href = 'index.php?page=" . $_GET['page'] . "';</script>";
|
||||
} else {
|
||||
echo "<script>alert('删除数据失败');window.location.href = 'index.php?page=" . $_GET['page'] . "';</script>";
|
||||
}
|
||||
} else {
|
||||
echo "<script>alert('系统判定误操作');window.location.href = 'index.php?page=" . $_GET['page'] . "';</script>";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询会员总数
|
||||
*/
|
||||
$sqll = "select * from u_users WHERE 1=1 {$code}";
|
||||
$zong = $pdo->query($sqll)->rowCount();
|
||||
|
||||
|
||||
/**
|
||||
* 定义每页显示多少条
|
||||
*/
|
||||
$num = 5;
|
||||
|
||||
|
||||
/**
|
||||
* 引入完美分页类
|
||||
*/
|
||||
include "../inclode/page.class.php";
|
||||
|
||||
/**
|
||||
* 构建分页对象
|
||||
*/
|
||||
$page = new Page($zong, $num);
|
||||
|
||||
/**
|
||||
*查询数据
|
||||
*/
|
||||
$sql = "select id,username,integral,zc_time,sex from u_users WHERE 1=1 $code ORDER BY id DESC {$page->limit} ";
|
||||
|
||||
/**
|
||||
*获取数据
|
||||
*/
|
||||
$res = $pdo->query($sql);
|
||||
?>
|
||||
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>会员管理</title>
|
||||
</head>
|
||||
<body style="border: 1px solid #000000">
|
||||
|
||||
<style>
|
||||
.am-fr {
|
||||
float: right;
|
||||
margin-right: 40px;
|
||||
}
|
||||
|
||||
.am-fr ul {
|
||||
text-align: right;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
||||
}
|
||||
|
||||
.am-fr ul li {
|
||||
list-style: none;
|
||||
float: left;
|
||||
line-height: 25px;
|
||||
padding: 0 5px;
|
||||
|
||||
}
|
||||
|
||||
.am-fr ul .am-active a {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php include 'header.php' ?>
|
||||
<div style="clear: both; padding: 10px;">
|
||||
<p>当前位置:---------会员管理</p>
|
||||
</div>
|
||||
<div class="body">
|
||||
|
||||
<form action="?action=del&page=<?php echo $page->page; ?>" method="post">
|
||||
<table style="text-align: center;width: 100%;" border="1">
|
||||
|
||||
<tr>
|
||||
<th>选择</th>
|
||||
<th>用户名</th>
|
||||
<th>注册时间</th>
|
||||
<th>积分</th>
|
||||
<th>性别</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
|
||||
|
||||
<?php
|
||||
while (list($id, $username, $integral, $zc_time, $sex) = $res->fetch(PDO::FETCH_NUM)) {
|
||||
$sex = ($sex == 0) ? '女' : '男';
|
||||
|
||||
$zc_time = date('Y-m-d', $zc_time);
|
||||
echo '<tr>';
|
||||
echo "<td><input type = 'checkbox' name = 'id[]' value = '$id' ></td >";
|
||||
echo "<td>$username </td >";
|
||||
echo "<td>$zc_time</td >";
|
||||
echo "<td>$integral</td >";
|
||||
echo "<td>$sex</td >";
|
||||
echo "<td> ";
|
||||
echo "<a href='xiu.php?action=xiu&id=$id&page=$page->page'> 修改</a>---";
|
||||
echo "<a href='cha.php?action=cha&id=$id&page=$page->page'>查看</a>---";
|
||||
echo "<a onclick='return confirm(\"确认删除这条数据吗?\")' href='index.php?action=del&id=$id&page=$page->page'>删除</a>";
|
||||
echo "</td >";
|
||||
echo "</tr>";
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<tr>
|
||||
<td><input onclick='return confirm("确认删除这些数据吗?")' type='submit' name='dosubmit' value='删除 '></td>
|
||||
<td colspan='17' align='center'> <?php echo $page->fpage(0, 1, 2, 3, 4, 5, 6); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<div class="cent" style="width: 100px; height: 200px; display: none; background: red;"></div>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
35
admin/loginout.php
Normal file
35
admin/loginout.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 退出登陆
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 开启session
|
||||
*/
|
||||
session_start();
|
||||
|
||||
/**
|
||||
* 开启取出用户名
|
||||
*/
|
||||
$username = $_SESSION['admin']['username'];
|
||||
|
||||
/**
|
||||
* 清空session
|
||||
*/
|
||||
$_SESSION['admin'] = array();
|
||||
|
||||
|
||||
//if (isset($_COOKIE[session_name()])) {
|
||||
// setcookie(session_name(), '', time() - 42000, '/');
|
||||
//}
|
||||
//
|
||||
//session_destroy();
|
||||
|
||||
/**
|
||||
* 判断是否登陆 无session 跳转到登陆 并做退出标记
|
||||
*/
|
||||
if (empty($_SESSION['user']['isUserLogin'])) {
|
||||
header("Location:../admin.php?action=out");
|
||||
}
|
||||
|
||||
94
admin/ser.php
Normal file
94
admin/ser.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* 开启session
|
||||
*/
|
||||
session_start();
|
||||
|
||||
/**
|
||||
* 开启判断是否登陆
|
||||
*/
|
||||
if (empty($_SESSION['admin']['isLogin'])) {
|
||||
header("Location:../admin.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* 包含数据库配置
|
||||
*/
|
||||
include '../config/config.inc.php';
|
||||
|
||||
/**
|
||||
* 编辑数据库配置
|
||||
*/
|
||||
if (isset($_POST['btn'])) {
|
||||
$username = empty($_POST['username']) ? "" : "&username=" . $_POST['username'] . "";
|
||||
$email = empty($_POST['email']) ? "" : "&email=" . $_POST['email'] . "";
|
||||
$sex = empty($_POST['sex']) ? "" : "&sex=" . $_POST['sex'] . "";
|
||||
header("Location:index.php?action=ser{$username}{$email}{$sex}");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>查询会员</title>
|
||||
</head>
|
||||
<style>
|
||||
.inputdiv {
|
||||
padding-top: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body style="border: 1px solid #000000">
|
||||
|
||||
<?php include 'header.php' ?>
|
||||
<div style="clear: both; padding: 10px;border-bottom: 1px solid;">
|
||||
<p>当前位置: <a href="index.php">订单列表</a>>查询订单</p>
|
||||
</div>
|
||||
<div style="padding: 10px">
|
||||
<form action="" method="post">
|
||||
<div style="width: 400px; height: 450px;padding: 10px; float: left;">
|
||||
<div class="inputdiv">
|
||||
按照用户名查询:<input type="text" name="username" value=""><br/>
|
||||
</div>
|
||||
<div class="inputdiv">
|
||||
按照邮箱查询:<input type="text" name="email" value=""><br/>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="inputdiv">
|
||||
按照用户性别查询:
|
||||
<select name="sex">
|
||||
<option value=''>点我选择</option>
|
||||
<option value='0'>女</option>
|
||||
<option value='1'>男</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div style=" padding-top: 15px;">
|
||||
<input type="submit" name="btn" value="点击查询">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="float: left;width: 300px; text-align: center;">
|
||||
<h3>查询须知</h3>
|
||||
<p style="text-align:center; ">查询的时候请注意查询条件</p>
|
||||
<p style="text-align:center; ">查询的时候请注意查询条件</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div style="clear: both"></div>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
103
admin/xiu.php
Normal file
103
admin/xiu.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/**
|
||||
* 修改会员
|
||||
*/
|
||||
|
||||
/**
|
||||
* 开启session
|
||||
*/
|
||||
session_start();
|
||||
|
||||
/**
|
||||
* 开启判断是否登陆
|
||||
*/
|
||||
if (empty($_SESSION['admin']['isLogin'])) {
|
||||
header("Location:../admin.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* 包含数据库配置
|
||||
*/
|
||||
include '../config/config.inc.php';
|
||||
|
||||
|
||||
/**
|
||||
* 根据传入的id 查询出将要修改的用户信息
|
||||
*/
|
||||
if (isset($_GET['action']) && $_GET['action'] == "xiu") {
|
||||
$stmt = $pdo->prepare('SELECT id,username,password,integral,sex,email FROM u_users where id= ?');
|
||||
$stmt->execute(array($_GET['id']));
|
||||
if ($stmt->rowCount() > 0) {
|
||||
list($id, $username, $password, $integral, $sex, $email) = $stmt->fetch(PDO::FETCH_NUM);
|
||||
} else {
|
||||
echo "<script>alert('数据不存在!');window.location.href = 'index.php';</script>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用户修改操作
|
||||
*/
|
||||
if (isset($_POST['btn'])) {
|
||||
$stmt = $pdo->prepare('UPDATE u_users SET username= ? ,password= ? ,integral= ? , sex=?, email=? WHERE id=?');
|
||||
$stmt->execute(array($_POST['username'], $_POST['password'], $_POST['integral'], $_POST['sex'], $_POST['email'], $_POST['id']));
|
||||
if ($stmt->rowCount() > 0) {
|
||||
echo "<script>alert('修改会员成功');window.location.href = 'index.php?page=" . $_GET['page'] . "';</script>";
|
||||
} else {
|
||||
echo "<script>alert('修改会员失败')</script>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>修改会员</title>
|
||||
</head>
|
||||
<style>
|
||||
.inputdiv {
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 200px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
select {
|
||||
margin-top: 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body style="border: 1px solid #000000">
|
||||
|
||||
<?php include 'header.php' ?>
|
||||
<div style="clear: both; padding: 10px;border-bottom: 1px solid;">
|
||||
<p>当前位置:---------修改会员</p>
|
||||
</div>
|
||||
<div style="padding: 10px">
|
||||
<form action="" method="post">
|
||||
<input type="hidden" name="id" value="<?php echo $id; ?>">
|
||||
<div class="inputdiv">
|
||||
用户名:<input type="text" name="username" value="<?php echo $username; ?>"><br/>
|
||||
密 码:<input type="text" name="password" value="<?php echo $password; ?>"><br/>
|
||||
邮 箱:<input type="text" name="email" value="<?php echo $email; ?>"><br/>
|
||||
积 分:<input type="text" name="integral" value="<?php echo $integral; ?>"><br/>
|
||||
性 别:
|
||||
<select class="form-control" name="sex">
|
||||
<option <?php if ($sex == 1) { ?> selected="selected" <?php } ?> value="1">男</option>
|
||||
<option <?php if ($sex == 0) { ?> selected="selected" <?php } ?> value="0">女</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style=" padding-top: 5px;"><input type="submit" name="btn" value="确定修改"></div>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user