php session.use_trans_sid

4 Cevap php

PHP'nin session.use_trans_id anlamı ve kullanımı hakkında net değilim.

Çevrimiçi belgelere, diyor:

the run-time option session.use_trans_sid are enabled, relative URIs will be changed to contain the session id automatically. Does this mean it will ALWAYS add the session id? Or only when cookies are not working?

Otomatik javascript window.location veya ajax aramaları katacak?

Ayrıca, php.ini dosyasında, diyor:

trans sid support is disabled by default.
Use of trans sid may risk your users security.
Use this option with caution.
 - User may send URL contains active session ID
   to other person via. email/irc/etc.
 - URL that contains active session ID may be stored
   in publically accessible computer.
 - User may access your site with the same session ID
   always using URL stored in browser's history or bookmarks.
 http://php.net/session.use-trans-sid

Kafam karıştı, çevrimiçi docs söyledi Unless you are using PHP 4.2.0 or later, you need to enable it manually. Peki neden varsayılan olarak devre dışı olacaktır? (Ben php 5 kullanıyorum).

Ayrıca, bu özellik çerezleri devre ile kullanıcı idare GEREKLİ değil mi?

4 Cevap

"Does this mean it will ALWAYS add the session id? Or only when cookies are not working?"

  • Çerezleri çalışmıyor sadece. Ayrıca, her iki session.use_trans_sid ve session.use_cookies 1 ise, o zaman session.use_only_cookies karar verir: 1 URL yeniden yazma devre dışı bırakır. Bkz this nice article.

"Will it automatically add it to javascript's window.location or ajax calls?"

  • PHP Ajax ne olduğunu bilmiyor No, sadece kendi sayfa çıktı tamponunda literal URL'leri (herhangi bir linked komut kısa sürede bir kodlanmış URL gibi oturumu kıracak nasıl not yazılarak Siteye).

"Unless you are using PHP 4.2.0 or later, you need to enable it manually"

  • Yani (gerçekten kafa karıştırıcı) demek recompiling PHP < 4.2. PHP5 için, sadece (php.ini alıntı nedenlerle) in the config devre dışı bırakılır.

"Also, isn't this feature NECESSARY to handle users with cookies disabled?"

  • Evet, öyle. (Sakat kullanılabilirlik ve cömert ticaret-off ile bazı çok özel durum için özel bazı JavaScript + PHP çözüm sağlamak sürece.)

Eğer "use_trans_sid" etkinleştirmek eğer session id URL her şey takılır. Bir ajax isteği olur ama o bağlı olacağını düşünüyorum ne IAM emin değil.

Ve evet kullanıcı devre dışı çerezleri olduğunda trans_sid gerekiyor, ama güvensiz onun tür (birisi düşünmek ekranda arayan ve session id yazıyor mi? :-)).

Bu gidebilirsiniz:

if(isset($_COOKIE['session_name'])){
            ini_set("session.use_trans_sid",false);
            session_start();
            ///////////////////
            //any hard tracking code or hard work goes here
            // like $_SESSION['msisdn']="9455366212";
            ///////////////////
            $_SESSION['cookie_support']=1;
}else{
            ini_set("session.use_trans_sid",true);
            session_start();
            $_SESSION['cookie_support']=0;
}

if user try to login then check first for $_SESSION['cookie_support']; try to avoid any sensitive interactions with cookie_support=0

Risk birisi sid ile bağlantı verebilir ve giriş için bu linki kullanabilirsiniz olacak ve onları içeri açmış aktif oturumu olurdu olduğunu