Пример #1
0
include_once 'linkstart.php';
global $username;
global $password;
if (@$_POST['username'] and @$_POST['password']) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    if (!empty($username) and !empty($password)) {
        $user = get_user_by_name($username);
        if (!$user) {
            // echo '<HTML><HEAD><META HTTP-EQUIV="refresh" CONTENT="3;url=login.php"></HEAD><BODY>';
            header("location: login.php?action=err&mes=登录失败!用户不存在!请重试!");
            exit;
        } else {
            if ($user['password'] == hash_password($password)) {
                $_SESSION['userid'] = $user['userid'];
                header("location: userdetails.php?action=succ&mes=登录成功!欢迎回来:" . show_user_by_id($user['userid']));
                exit;
            } else {
                header("location: login.php?action=err&mes=登录失败!密码错误!请重试!");
                exit;
            }
        }
    } else {
        no_access();
    }
} else {
    no_access();
}
?>

Пример #2
0
global $username, $password, $email, $studentid;
if (@$_POST['username'] and @$_POST['password'] and @$_POST['confpassword'] and @$_POST['email'] and @$_POST['studentid']) {
    if (@$_POST['password'] != @$_POST['confpassword']) {
        header("location: register.php?action=err&mes=注册失败!两次密码输入不一致!");
        exit;
    }
    $username = $_POST['username'];
    $password = $_POST['password'];
    $email = $_POST['email'];
    $studentid = $_POST['studentid'];
    if (get_user_by_name($username)) {
        header("location: register.php?action=err&mes=注册失败!用户名已存在!");
        exit;
    } else {
        if (!is_numeric($studentid)) {
            header("location: register.php?action=err&mes=注册失败!学号不正确!");
            exit;
        } else {
            if (!add_user($username, $password, $email, $studentid)) {
                header("location: register.php?action=err&mes=注册失败!请检查其他信息!");
                exit;
            } else {
                $_SESSION['userid'] = get_user_by_name($username)['userid'];
                header("location: userdetails.php?action=succ&mes=注册成功!欢迎加入" . show_user_by_id($_SESSION['userid']));
                exit;
            }
        }
    }
} else {
    no_access('register.php');
}
Пример #3
0
function show_message_praise_user($message)
{
    if ($message['praisenumber'] == 0) {
        return;
    }
    foreach ($message['praiselist'] as $k => $val) {
        echo '                    <span class="label label-info">' . show_user_by_id($val['userid']) . '</span>
                  ';
    }
}