Example #1
0
    $setsqlarr['last_login_ip'] = "从未";
    $setsqlarr['pwd_hash'] = randstr();
    $setsqlarr['pwd'] = md5($password . $setsqlarr['pwd_hash'] . $QS_pwdhash);
    if ($db->inserttable(table('admin'), $setsqlarr)) {
        //填写管理员日志
        write_log("后台添加用户名为" . $setsqlarr['admin_name'] . "的管理员", $_SESSION['admin_name'], 3);
        $link[0]['text'] = "返回列表";
        $link[0]['href'] = "?act=";
        adminmsg('添加成功!', 2, $link);
    } else {
        adminmsg('添加失败', 1);
    }
} elseif ($act == 'del_users') {
    check_token();
    $id = $_REQUEST['id'];
    if ($num = del_users($id, $_SESSION['admin_purview'])) {
        adminmsg("删除成功!共删除" . $num . "行", 2);
    } else {
        adminmsg("删除失败!", 0);
    }
} elseif ($act == 'edit_users') {
    get_token();
    $id = intval($_GET['id']);
    $account = get_admin_account($id);
    if ($account['admin_name'] == $_SESSION['admin_name'] || $_SESSION['admin_purview'] == "all") {
        $smarty->assign('account', $account);
        $smarty->assign('admin_purview', $_SESSION['admin_purview']);
        $smarty->display('users/admin_users_edit.htm');
    } else {
        adminmsg("参数错误!", 1);
    }
Example #2
0
if ($_GET['export'] and ($_GET['what'] == "data" or $_GET['what'] == "users")) {
	header("Content-Type: application/octet-stream");
	if ($_GET['what'] == "data") {
		header("Content-Disposition: attachment; filename=\"data@".date("Y-m-d").".txt\"");
		$data_content = get_file_content($data_filename);
	}
	if ($_GET['what'] == "users") {
		header("Content-Disposition: attachment; filename=\"users@".date("Y-m-d").".txt\"");
		$data_content = get_file_content($users_filename);
	}
	echo $data_content;
	die;
}

if ($_POST['delete']) {
	del_users($_POST['select']);
	header("Location: ".FILE);
}

if ($_GET['clean']) {
	clean_user($_GET['_user']);
	header("Location: ".FILE);
}

if ($styles_enabled) {
	if ($_GET['style'] and file_exists("styles/".$_GET['style'].".css")) $style_filename = $_GET['style'].".css";
		elseif ($_COOKIE['s_style'] and file_exists("styles/".$_COOKIE['s_style'].".css")) $style_filename = $_COOKIE['s_style'].".css";
	$current_style = substr($style_filename, 0, strpos($style_filename, ".css"));
	$current_path = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
	preg_match("/^https?:\/\/[^\/]+([^\?]*\/)[^\?]+\//i", $current_path, $matches);
	setcookie("s_style", $current_style, time()+7776000, $matches[1]);