php
  • apache
  • session
  • 2012-07-30 95 views 0 likes 
    0

    我試圖保存會話,但它沒有。刷新後,它就像消息一樣消失。Appserv會話不保存

    這是我的腳本

    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>"; 
        } 
    } 
    

    小號

    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工作。有誰知道解決方案?

    +0

    你是否在早些時候調用['session_start()'](http://www.php.net/manual/en/function.session-start.php)? – 2012-07-30 01:25:06

    +0

    是的,我在另一個文件中使用它,我包括這個文件我相信它不是我的編碼,但我的設置可能是apache – 2012-07-30 02:45:00

    +0

    服務器故障排除更棘手 - 看看[這個問題]的一些答案(http: //stackoverflow.com/questions/155920/php-session-data-not-being-saved)看看你是否有類似的問題。 – 2012-07-30 02:57:29

    回答

    0

    我相信John C有問題。
    作爲一種補充信息,您應該使用else而不是「if($ countrows!= 1)」。

    相關問題