Gacha Posted May 8, 2004 Report Share Posted May 8, 2004 Nu uz win man sesijas gaja, bet uz Linuxa kaut ka nesanāk, itka jau viss bija uzlikt, bet nav ka vajag. Sesija pieregistrejas un itkaa ir /tmp direktorijaa, bet ar php es to nevaru dabut un redzeet! Varbut uz brousera neuzliekas kukijs? Bet itka kukiji ir ieslegti! Te phpinfo(): Session Support enabled Registered save handlers files user 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 gacha.no-ip.com gacha.no-ip.com 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.name PHPSESSID PHPSESSID session.referer_check no value no value session.save_handler files files session.save_path /tmp /tmp session.serialize_handler php php session.use_cookies On On session.use_only_cookies Off Off session.use_trans_sid Off Off Link to comment Share on other sites More sharing options...
Aleksejs Posted May 8, 2004 Report Share Posted May 8, 2004 (edited) Man atšķirās tikai: session.cookie_domain gacha.no-ip.com gacha.no-ip.com Man tas ir: no value no value Tā ka problēma visticamāk ir citur... Edited May 8, 2004 by Aleksejs Link to comment Share on other sites More sharing options...
Gacha Posted May 8, 2004 Author Report Share Posted May 8, 2004 Nu nez - es autorizacijai izmantoju sho f-ciju: function auth($user, $pass){ $pass = md5($pass . MD5); $expire = time(); $sql = mysql_query("Select * from users where user='$user' and pass='$pass' Limit 0, 1"); if (!$end = mysql_num_rows($sql) == 1){header("Location: index.php?page=login&do=0"); exit();}else{ $_SESSION = array(); session_destroy(); session_start(); $row = mysql_fetch_assoc($end); $_SESSION['auth'] = $row['user']; $_SESSION['expire'] = $expire; mysql_free_result($end); header("Location: index.php?page=system"); } Un tad ar sho parbaudu katra lapaa: function chek_auth(){ $expire = $_SESSION['expire']; $time = time() - 60 * SES_TIME; if (!isset($_SESSION['auth']) || $time > $expire){ $_SESSION = array(); session_destroy(); header("Location: index.php?page=login"); } Nu man liekas, ka ar kodu viss ir kartiba <_< Link to comment Share on other sites More sharing options...
Aleksejs Posted May 9, 2004 Report Share Posted May 9, 2004 Kas tas SES_TIME tāds? Vai tur navajag $SES_TIME ??? Link to comment Share on other sites More sharing options...
Gacha Posted May 9, 2004 Author Report Share Posted May 9, 2004 (edited) Nee nevajaga, jo taa ir defineta konstante. Nu es mēģināju debugot un koda vidu ieliku echo $_SESSION['auth'] . $_SESSION['expire']; un spiedu refresh. Un no 100 x man vienu reizi tie abi divi parādījās. Nesaprotu, to, ka sesija atrodas /tmp folderī bet php to nevar parādīt! Edited May 9, 2004 by Gacha Link to comment Share on other sites More sharing options...
Aleksejs Posted May 9, 2004 Report Share Posted May 9, 2004 (edited) Nu tev no sesiju vadības viedokļa vajadzētu būt vienaalga, kurā vietā fiziski uz diska tās sesijas glabājas. Vai tev ir session_start() ielikts faila sākumā??? Edited May 9, 2004 by Aleksejs Link to comment Share on other sites More sharing options...
Gacha Posted May 9, 2004 Author Report Share Posted May 9, 2004 (edited) Hmm, taa man shkjiet ari bus ta klluda, jo izveidoju mazu testa lapu un taja viss stradaja. Kur tieshi tad tas session_start() jaliek ? <_< Man ir index lapa un ieksh taas login un vel tiek inkludota funkciju lapa. Kur tad jaliek tas session start ? Zinu to, ka ja nebutu tas vis f-cijas, tad staradatu. Bet man vajag f-cijas Edited May 9, 2004 by Gacha Link to comment Share on other sites More sharing options...
Aleksejs Posted May 9, 2004 Report Share Posted May 9, 2004 http://lv.php.net/manual/en/function.session-start.php Note: If you are using cookie-based sessions, you must call session_start() before anything is outputted to the browser. session_start() jāizsauc, pirms tu sāc darboties ar sesijas mainīgajiem. Link to comment Share on other sites More sharing options...
Recommended Posts