简体   繁体   中英

Appserv session does not save

I am trying to save sessions but it doesnt. After refreshing it just disappears just like a post.

This is my script

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

It does work on my laptop, where I do not use appserv. Does anyone know the solution?

I believe John C got the problem.
As a complementary information, you should use else instead of "if($countrows != 1)".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM