Example #1
0
require_once '../include/user.class.php';
session_start();
$action = $_POST["action"];
if ($action == "save") {
    $username = $_POST["username"];
    $userpass = $_POST["password"];
    if (function_exists("imagejpeg")) {
        if (empty($_SESSION['captcha']) || trim(strtolower($_POST['capcode'])) != $_SESSION['captcha']) {
            ShowMsg("验证码错误,请重新输入");
            exit;
        }
    }
    $userdata = new User();
    $existuser = $userdata->ExistUserPassword($username, $userpass);
    if ($existuser == 1) {
        $userinfo = $userdata->GetUserByName($username);
        session_start();
        $_SESSION["adminid"] = $userinfo->uid;
        header("location:index.php");
    } else {
        ShowMsg("用户名或密码错误");
        exit;
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>用户登录</title>
Example #2
0
 public function checkuser()
 {
     $username = trim($this->input->get('txtUsername'));
     if (empty($username)) {
         echo 'false';
         return;
     }
     $user = User::GetUserByName($username);
     echo $user == null ? 'true' : 'false';
     return;
 }