Re: sharing variables
| From: | Chris Lee | Date: | Fri, 09 Mar 2001 18:57:09 +0000 |
| Subject: | Re: sharing variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-43206@lists.php.net to get a copy of this message | ||
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
lee@mediawaveonline.com
"Leo" <leodebeo@hotmail.com> wrote in message news:98be7g$qnj$1@toye.p.sourceforge.net...
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: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net