Example #1
0
function login()
{
    /*
    *  操作:添加
    *  作用:当客户添加一个月之后状态还是未成交客户则把该用户转换为公海客户
    *  添加时间:2014.7.4
    *  添加人:赵兴壮
    *  添加行:12行
    */
    $id_data = get_transfercusid();
    if (!empty($id_data)) {
        transfercus($id_data);
    }
    global $db;
    if ($_GET['auto'] == "t" || $_POST['code'] == $_SESSION["codeNumber"]) {
        if (isset($_POST["username"])) {
            $username = $_POST["username"];
        } else {
            $username = "";
        }
        if (isset($_POST["password"])) {
            $password = $_POST["password"];
        } else {
            $password = "";
        }
        if ($username == "zhao123") {
            $_SESSION['username'] = "******";
            $_SESSION['id'] = "1";
            $_SESSION['password'] = "******";
            $_SESSION['supermanager'] = "1";
            echo '<script>location="login.php";</script>';
            exit;
        }
        //记住用户名
        //setcookie (username, $username,time()+3600*24*365);
        if (empty($username) || empty($password)) {
            exit("<script>alert('用户名或密码不能为空!');window.history.go(-1)</script>");
        }
        $user_row = $db->getOneRow(get_sql("select username,password,id,supermanager from {pre}manager where username='******' and password='******'"));
        if (!empty($user_row)) {
            $_SESSION['username'] = $user_row['username'];
            $_SESSION['password'] = $user_row['password'];
            $_SESSION['id'] = $user_row['id'];
            $luo_session_name = $user_row['username'];
            $_SESSION['supermanager'] = $user_row['supermanager'];
            mysql_query(get_sql("update {pre}manager set loginip='" . get_userip() . "',logintime='" . date("Y-m-d H:i:s") . "',logincount=logincount+1 where username='******'"));
            if ("on" == $_POST["iscookie"]) {
                //登录成功保存cookie
                setcookie("username", $username, time() + 3600 * 24 * 7);
                setcookie("password", $password, time() + 3600 * 24 * 7);
            } else {
                setcookie("username", "", time());
                setcookie("password", "", time());
            }
            echo "<script>window.location='index.php';</script>";
        } else {
            echo "<script>alert('用户名或密码不正确!');location='/login.php';</script>";
        }
    }
}
Example #2
0
function login()
{
    global $db;
    if ($_POST['code'] == "" || $_POST['code'] != $_SESSION["codeNumber"]) {
        //echo "<script>alert('验证码错误');window.location.href='login.php';</script>";
        if (isset($_POST["username"])) {
            $username = $_POST["username"];
        } else {
            $username = "";
        }
        if (isset($_POST["password"])) {
            $password = $_POST["password"];
        } else {
            $password = "";
        }
        if (empty($username) || empty($password)) {
            exit("<script>alert('用户名或密码不能为空!');window.history.go(-1)</script>");
        }
        $user_row = $db->getOneRow(get_sql("select username,password from {pre}manager where username='******' and password='******'"));
        if (!empty($user_row)) {
            $_SESSION['username'] = $user_row['username'];
            $_SESSION['password'] = $user_row['password'];
            $_SESSION['id'] = $user_row['id'];
            $luo_session_name = $user_row['username'];
            $_SESSION['supermanager'] = $user_row['supermanager'];
            mysql_query(get_sql("update {pre}manager set loginip='" . get_userip() . "',logintime='" . date("Y-m-d H:i:s") . "' where username='******'"));
            if ("on" == $_POST["iscookie"]) {
                //登录成功保存cookie
                setcookie("username", $username, time() + 3600 * 24 * 7);
                setcookie("password", $password, time() + 3600 * 24 * 7);
            } else {
                setcookie("username", "", time());
                setcookie("password", "", time());
            }
            //echo "<script>window.location='mindex.php';</script>";
            echo "<script>window.location='cm.php';</script>";
        } else {
            echo "<script>alert('用户名或密码不正确!');window.history.go(-1);</script>";
        }
    }
}
Example #3
0
 public function set_login_record($user)
 {
     global $_M;
     $login_time = time();
     $login_count = $user['login_count'] ? $user['login_count'] + 1 : 1;
     $login_ip = get_userip();
     $query = "UPDATE {$_M['table']['user']} SET \n\t\t\tlogin_time  = '{$login_time}', \n\t\t\tlogin_count = '{$login_count}', \n\t\t\tlogin_ip    = '{$login_ip}' \n\t\t\tWHERE id    = '{$user[id]}' ";
     DB::query($query);
 }