0

我正在尝试保存会话,但它没有。刷新后它就像一个帖子一样消失。

这是我的脚本

if(isset($submitlogin)){
    //Query setup
    $loginquery = "SELECT 
                    UserID, 
                    Password 
                FROM 
                    Login 
                WHERE 
                    UserID='".mssql_real_escape_string($username)."' AND 
                    Password='".$password."'";
    $loginresult = mssql_query($loginquery);
    $countrows = mssql_num_rows($loginresult);

    if($countrows == 1){
        $_SESSION['username'] = $username;
        $_SESSION['password'] = $password;

    }
    if($countrows != 1){
        $login .= "<span style='color:red'>Login Failed</span>";
    }
}

s

ession
Session Support     enabled
Registered save handlers    files user sqlite
Registered serializer handlers  php php_binary wddx

Directive   Local Value Master Value
session.auto_start  Off Off
session.bug_compat_42   On  On
session.bug_compat_warn On  On
session.cache_expire    180 180
session.cache_limiter   nocache nocache
session.cookie_domain   no value    no value
session.cookie_httponly Off Off
session.cookie_lifetime 0   0
session.cookie_path /   /
session.cookie_secure   Off Off
session.entropy_file    no value    no value
session.entropy_length  0   0
session.gc_divisor  100 100
session.gc_maxlifetime  1440    1440
session.gc_probability  1   1
session.hash_bits_per_character 4   4
session.hash_function   0   0
session.name    PHPSESSID   PHPSESSID
session.referer_check   no value    no value
session.save_handler    files   files
session.save_path   C:/Users/ADMINI~1/AppData/Local/Temp/3  C:/Users/ADMINI~1/AppData/Local/Temp/3
session.serialize_handler   php php
session.use_cookies On  On
session.use_only_cookies    Off Off
session.use_trans_sid

0   0

它可以在我不使用 appserv 的笔记本电脑上运行。有谁知道解决方案?

4

1 回答 1

0

我相信约翰 C 有问题。
作为补充信息,您应该使用 else 而不是“if($countrows != 1)”。

于 2012-07-30T01:56:21.887 回答