Tuesday, March 15, 2011

PHP SID not showing

Hi, I cannot get my SID working ...

<?php
session_start();
// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';?>

does not show up SID number but session_id is working not sure if I am missing something. THnks

From stackoverflow
  • It says... boolean true what next...

  • page 1:

    <?php
        session_start();
        // why use it in a url?
        echo session_id();
        echo '<br /><a href=page2.php target=_blank>page 2</a>';
    ?>
    

    page 2:

    <?php
        session_start();
        // page 2
        echo session_id();
        echo '<br> <br> on page 2 ';
    ?>
    
  • You need to have session.use_trans_sid enabled to have PHP accept a session ID passed by either GET or POST.

  • The SID constant will show an empty string if a a cookie with the name of session.name has been detected by PHP. See the manual page. That means, that SID will contain a useful string only before the session cookie has been sent to the browser.

    That also means that if a browser refuses cookies the SID constant will work. Provided that seesion.use_trans_id is enabled, as Gumbo said.

  • Where possible, avoid passing session identifiers in URLs; for cases where this is needed (e.g. where the client rejects the session cookie), let the built-in URL rewriting routines alter the HTML.

    Passing session identifiers around in URLs means that you're exposing implementation detail in URLs. Purist views aside, this can lead to practical problems with users copy-pasting and sharing URLs which contain session information, inadvertently exposing their sessions to friends, or anyone else they share the URL with.

  • convert mp4 to mp3

0 comments:

Post a Comment