TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Advanced PHP Programming (http://www.talkphp.com/advanced-php-programming/)
-   -   Is this possible (http://www.talkphp.com/advanced-php-programming/3529-possible.html)

codefreek 10-26-2008 02:13 PM

Is this possible
 
is it possible to append a ip to a session on your website?

lets say i have 3 guests who is on my websites browsing and we have their ip can we append the 3 ip's to 3 different sessions?
or at least append all to one session like a guest session.

thank you in advance,
--->Codefreek

Wildhoney 10-26-2008 08:15 PM

Do you mean something like this, where all users share the same session ID if they're guests? It is possible, but I don't any reason why you would want to do that.

php Code:
$szGuestSessionId = md5('TALKPHP_GUEST_SESSION');

if (!$pUser->hasLoggedIn())
{
    session_id($szGuestSessionId);
}

If they are guests, you should read the data from a class. For example:

php Code:
public function getUsername()
{
    if (isset($_SESSION['username']))
    {
        return $_SESSION['username'];
    }
   
    return 'Guest';
}

kjarli 10-31-2008 03:13 PM

Don't use sessionid. You can also store their data in the database, create a mixture of cookies, useragent hashed and ip and create your own protected sessions.


All times are GMT. The time now is 12:12 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0