sessions

<?php

/*

http://php.net/manual/en/ref.session.php

sessions with cookies
------------------------
 - will transfer across full urls
 - will transfer acress full form urls
 - will not set SID
 - will not transfer across multiple domainnames

sessions without cookies
------------------------
 - will set SID
 - will transfer across multiple domainnames if the domain name is on the same server 
and $SID is manualy appended to the url
 - will transfer across full urls if $SID is appended to the url
 - will transfer across full form urls if $SID is appended to the form url

*/

 function mtime()
 {
  $mtime = microtime();
  $mtime = str_replace('.', '', $mtime);
  $mtime = explode(' ', $mtime);
  $mtime = $mtime[1] . $mtime[0];

  return($mtime);
 }

 if ( isset($HTTP_GET_VARS['PHPSESSID']) )
  session_id($HTTP_GET_VARS['PHPSESSID']);
 if ( isset($HTTP_POST_VARS['PHPSESSID']) )
  session_id($HTTP_POST_VARS['PHPSESSID']);

 if (!isset($HTTP_SESSION_VARS['SessionID']))
 {
  $SessionID = mtime();
  session_register('SessionID');
 }

 $PHPSESSID = session_id();
 $SID = "PHPSESSID=$PHPSESSID";

 //----

 echo "
 <a href='http://$SERVER_NAME/$PHP_SELF?$SID'>here </a>
 ";

?>

there ya go


-- 

 Chris Lee
 Mediawaveonline.com

 ph. 250.377.1095
 ph. 250.376.2690
 fx. 250.554.1120

 [EMAIL PROTECTED]


"Leo" <[EMAIL PROTECTED]> wrote in message 
98be7g$qnj$[EMAIL PROTECTED]">news:98be7g$qnj$[EMAIL PROTECTED]...

hi

i'm currently programming a php web application and i have the following 
problem: i need a login scheme; programmed a simple one. Whichever page the 
user reaches, in some i need their userid, for extra validation. so 
basically, i'm looking for a mechanism to share a variable between multiple 
pages, but as i don't always use forms, i think i can't use url-encoding 
with the a-tag to make the userid available for all scripts.
maybe there is support for logging users in, i don't know
anyone an idea?

tx
 
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to