-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathusers.php
107 lines (93 loc) · 4.85 KB
/
users.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
session_start();
include_once("header.php");
?>
<table align="center" width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor='#B3B3B3' class='table table-striped table-bordered'>
<tr>
<td bgcolor="#EBEBEB"> 账号管理</td>
</tr>
<tr>
<td bgcolor="#FFFFFF">
<form action="" method="post" name="submitxiugai">
<?php $sqlzhanghu = "SELECT * FROM ".$qianzui."user where uid='$_SESSION[uid]'";
$result2 = mysqli_query($conn,$sqlzhanghu);
$row = mysqli_fetch_array($result2);
?>
<script language="javascript">
<!--
function linkok(url) {
question = confirm("数据即将清除,确认吗?");
if (question) {
window.location.href = url;
}
}
//-->
</script>
用户名:<?php echo $row['username'];
?> <!-- <a href="javascript:linkok('delete.php?uid=$_SESSION[uid]')">清除全部数据</a>(操作前请备份导出)--><br /><br />
注册时间:<?php echo date("Y-m-d H:i",$row['utime']);
?><br /><br />
电子邮箱 <input for="Email" name="email" id="email" value="<?php echo $row['email'];
?>"> <br /><br />
旧密码:<input type="password" name="jiupassword" id="jiupassword" size="18" maxlength="15" /> *(修改必须填写)<br /><br />
新密码:<input type="password" name="password" id="password" size="18" maxlength="15" /> *(最多15个字符) <br /><br />
授权用户密码:<input type="text" name="cpassword" id="cpassword" value="<?php echo $row['cpassword'];
?>" size="18" maxlength="15" /><br /><br />授权用户直接到 <a href="client.php">client页面</a> 用你的用户名和授权密码添加数据,只能添加,无法修改删除,密码留空则无效。<br /><br />
<input name="Submitxiugai" type="submit" value="提交" class="btn btn-default" />
<?php
if ($_POST['Submitxiugai']) {
$jiumima = md5($_POST['jiupassword']);
if ($jiumima == $row['password'] && $_POST['password']<>$_POST['jiupassword']) {
if ($_POST['password']<>"") {
$umima = md5($_POST['password']);
} else {
$umima = $jiumima;
}
$sql = "update ".$qianzui."user set password='$umima',cpassword='$_POST[cpassword]',email='$_POST[email]' where uid='$_SESSION[uid]'";
$query = mysqli_query($conn,$sql);
if ($query) {
if ($_POST['password'] == "") {
echo "<font color='green'>OK,修改成功!</font>";
} else {
echo "<font color='green'>OK,用户密码修改成功!需要重新登陆,马上为你跳转。。</font><meta http-equiv=refresh content='2; url=login.php'>";
}
} else {
echo "<font color='red'>出错啦,写入数据库时出错!</font>";
}
} else {
echo "<font color='red'>密码不能为空或旧密码错误或密码和原来一样!</font>";
exit();
}
}
?>
</form>
</td>
</tr>
</table>
<table align="center" width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor='#B3B3B3' class='table table-striped table-bordered'>
<tr>
<td bgcolor="#EBEBEB"> 清空全部数据</td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><form action="" method="post" name="submitdel">
密码:<input type="password" name="mimayanzheng" id="mimayanzheng" size="18" maxlength="15" /> (操作前请备份导出)<br /><br />
<input name="shangchushuju" type="submit" value="清除全部数据" class="btn btn-default" />
<?php
if ($_POST['shangchushuju']) {
$mmyanzheng = md5($_POST['mimayanzheng']);
if ($mmyanzheng == $row['password']) {
echo "<meta http-equiv=refresh content='2; url=delete.php?uid=".$_SESSION['uid'].")'>";
echo "<font color='green'>已全部删除成功!</font>";
} else {
echo "<font color='red'>密码错误!</font>";
}
}
?>
<br /><br />
</form>
</td>
</tr>
</table>
<?php
include_once("footer.php");
?>