-
Notifications
You must be signed in to change notification settings - Fork 1
/
useredit.php
67 lines (57 loc) · 1.61 KB
/
useredit.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
<?php
if(!$standalone){
include_once("../view/header.php");
include_once("../common.php");
}
if($_SERVER['REQUEST_METHOD'] == 'POST'){
$user=$_POST['user'];
if($authUser != $superAdmin)
die("没有权限修改");
//修改SVN密码
if(isset($_POST['chpw'])){
$password=myCrypt($_POST['password']);
}else{
$password=$redis->hGet('user:'.$user.':info', 'password');
}
//修改管理密码
if(isset($_POST['chadminpw'])){
$authpw=myCrypt($_POST['authpw']);
}else{
$authpw=$redis->hGet('user:'.$user.':info', 'authpw');
}
$username=$_POST['username'];
$department=$_POST['department'];
$contact=$_POST['contact'];
$redis->hMset('user:'.$user.':info',
array('username' => $username,
'password' => $password,
'department' => $department,
'contact' => $contact,
'authpw' => $authpw));
//解除管理权限
if(isset($_POST['deladmin'])){
$redis->hDel('user:'.$user.':info', 'authpw');
$redis->Del('user:'.$user.':ownproj');
$redis->Del('user:'.$user.':owngrp');
}
//所有用户集合
$redis->sAdd('user:all', $user);
//最新用户列表
$redis->lPush('user:last',$user);
echo <<<EOF
<script language="JavaScript">
window.location="/user.php?mod=edit&user=$user"
alert('修改已经提交。');
//
self.resizeTo(800,600);
window.close();
</script>
EOF;
}else{
$user=@$_GET['user'];
$username=$redis->hGet('user:'.$user.':info', 'username');
$password=$redis->hGet('user:'.$user.':info', 'password');
$department=$redis->hGet('user:'.$user.':info', 'department');
$contact=$redis->hGet('user:'.$user.':info', 'contact');
$authpw=$redis->hGet('user:'.$user.':info', 'authpw');
}