diff --git a/db/app_uoj233.sql b/db/app_uoj233.sql index 941019f..0ceb998 100644 --- a/db/app_uoj233.sql +++ b/db/app_uoj233.sql @@ -800,6 +800,7 @@ CREATE TABLE `user_info` ( `usergroup` char(1) NOT NULL DEFAULT 'U', `username` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL, `realname` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `school` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `usertype` varchar(250) NOT NULL DEFAULT 'student', `email` varchar(50) NOT NULL, `password` char(32) NOT NULL, diff --git a/web/app/controllers/super_manage.php b/web/app/controllers/super_manage.php index 7eb3b35..6581e9c 100644 --- a/web/app/controllers/super_manage.php +++ b/web/app/controllers/super_manage.php @@ -35,15 +35,22 @@ }, null ); + $register_form->addInput('new_school', 'text', '学校名称', '', + function ($new_school) { + return ''; + }, + null + ); $register_form->handle = function() { $new_username = $_POST['new_username']; $new_password = $_POST['new_password']; $new_realname = DB::escape($_POST['new_realname']); + $new_school = DB::escape($_POST['new_school']); $new_password = hash_hmac('md5', $new_password, getPasswordClientSalt()); $new_password = getPasswordToStore($new_password, $new_username); $svn_pw = uojRandString(10); - DB::query("insert into user_info (username, realname, password, svn_password, register_time, usergroup) values ('$new_username', '$new_realname', '$new_password', '$svn_pw', now(), 'U')"); + DB::query("insert into user_info (username, realname, school, password, svn_password, register_time, usergroup) values ('$new_username', '$new_realname', '$new_school', '$new_password', '$svn_pw', now(), 'U')"); }; $register_form->runAtServer(); @@ -105,6 +112,34 @@ }; $change_realname_form->runAtServer(); + $change_school_form = new UOJForm('change_school'); + $change_school_form->submit_button_config['align'] = 'compressed'; + $change_school_form->addInput('s_username', 'text', '用户名', '', + function ($s_username) { + if (!validateUsername($s_username)) { + return '用户名不合法'; + } + if (!queryUser($s_username)) { + return '用户不存在'; + } + return ''; + }, + null + ); + $change_school_form->addInput('s_school', 'text', '学校名称', '', + function ($s_school) { + return ''; + }, + null + ); + $change_school_form->handle = function() { + $s_username = $_POST['s_username']; + $s_school = DB::escape($_POST['s_school']); + + DB::query("update user_info set school = '$s_school' where username = '$s_username'"); + }; + $change_school_form->runAtServer(); + $user_form = new UOJForm('user'); $user_form->submit_button_config['align'] = 'compressed'; $user_form->addInput('username', 'text', '用户名', '', @@ -507,12 +542,13 @@ EOD; EOD; }; - $userlist_cols = array('username', 'usergroup', 'usertype', 'register_time'); + $userlist_cols = array('username', 'school', 'usergroup', 'usertype', 'register_time'); $userlist_config = array('page_len' => 20, 'table_classes' => array('table', 'table-bordered', 'table-hover', 'table-striped')); $userlist_header_row = << 用户名 + 学校 用户类别 注册时间 @@ -540,6 +576,7 @@ EOD; echo << ${hislink} + {$row['school']} {$row['usergroup']}, {$row['usertype']} {$row['register_time']} @@ -600,6 +637,8 @@ EOD; printHTML(); ?>

修改用户真实姓名

printHTML(); ?> +

修改用户学校名称

+ printHTML(); ?>

用户名单

diff --git a/web/app/controllers/user_info.php b/web/app/controllers/user_info.php index 64a7492..e4060f2 100644 --- a/web/app/controllers/user_info.php +++ b/web/app/controllers/user_info.php @@ -56,6 +56,12 @@ + +
  • + + +
  • +