Click to See Complete Forum and Search --> : [RESOLVED] sessions and cookies
ninjanutz
Aug 19th, 2005, 03:02 AM
right now i have a session that keeps users logged in for as long as they are on my page but i would like the counter to count each person once and not count me at all
wat can i do?
ninjanutz
Aug 20th, 2005, 04:35 PM
does anyone know?
PlaGuE
Aug 20th, 2005, 08:57 PM
have the counter check against your name...
ninjanutz
Aug 21st, 2005, 04:27 PM
nice sig lol should this be TRUE THEN and not ture?
yourlife = TURE THEN
visualAd
Aug 27th, 2005, 01:51 PM
By default, sessions are only saved per browser session and are removed when the user closes the browse.
However, you can set a separate cookie which will stay in the users cache until it is deleted. To set the cookie, use the set_cookie() (http://www.php.net/set_cookie) function:
set_cookie ('visited', '1', time() + (60 * 60 * 24 * 365 * 10));
Will set the cookie for 10 years. Before recording the visit, you can then check to ensure that the user has not already been recorded by checking for the presence of the cookie:
if (! isset($_COOKIE['visited'])) {
/* record visit, only if the cookie is present */
}
It is worth noting that the cookie is only on a per browser basis, therefore, if the user visits the site using a different browser or someone else visits your site using the same computer the visits will not be accurately recorded.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.