How to send PHPSESSID to URL?

I am trying to send PHPSESSID via an HTTP GET variable for a client without cookie.

I saw this in various drupal implementations where it is ?PHPSESSIONID=123ABCadded to each link, but how can I specify this in PHP and is there a way to change the GET parameter so that it can be? token = 123ABC, or even sent via HTTP POST?

The standard LAMP stack that runs the Zend environment.

Thanks!

+6
source share
4 answers

Use of cookies or not configured by these PHP parameters:

, cookie , .
PHP , cookie , , .


GET cookie, session.use_trans_sid, ( , , defaut, cookie - GET).

, PHP GET , ... cookie, , cookie, .
, cookie, , , , , - : - (


, session.name, ( "" "PHPSESSID", )


. : -)

+9

PHPSESSID session_name() session.name php.ini( ini_set()).

cookieless- session.use_trans_sid php.ini - , - , , URL- , , URL-.

+1

:

if ($_REQUEST['token'])
  session_id($_REQUEST['token']);
session_start();

print("foo=".$_SESSION['foo']++."<br />".
      "<a href={$PHP_SELF}?token=".session_id().">link</a><br />");
print("<form method=POST>".
      "<input type=hidden name=token value=".session_id()." />".
      "<input type=submit /></form>");
+1
  • , .
  • , .
  • The user should not have access to the home page without going through the login page.
0
source

All Articles