|
-
Aug 19th, 2005, 03:02 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] sessions and cookies
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?
-
Aug 20th, 2005, 04:35 PM
#2
Thread Starter
Hyperactive Member
-
Aug 20th, 2005, 08:57 PM
#3
Hyperactive Member
Re: sessions and cookies
have the counter check against your name...
Without balance, there could only be chaos.
Without chaos, there could be no balance.
I live with karma. Eat with destiny. Dream of life without shackles....
Yet. If life had no consequences, life could not exist, nor could it flourish.
If at first you dont succeed.You're screwed.
C++/Java NOOB.
I aint a professional at PHP, but if i can help i will.
-
Aug 21st, 2005, 04:27 PM
#4
Thread Starter
Hyperactive Member
Re: sessions and cookies
nice sig lol should this be TRUE THEN and not ture?
yourlife = TURE THEN
-
Aug 27th, 2005, 01:51 PM
#5
Re: [RESOLVED] sessions and cookies
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() function:
PHP Code:
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:
PHP Code:
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|