Hello all I have spent all day looking through here and trying t ofigure out sessions and cookies. No I am confused...
Here is what I have.
PHP Session support is enabled on my server.
On the top of all my main pages not the includes I have this.
<?
session_start();
Print "Username is: " . $_COOKIE['UserName'] . "<BR>". chr(13);
Print "UserID is: " . $_COOKIE['UserID'] . "<BR>" . chr(13);
?>
I copied the above from another post in these forums.
From what I have gathered that is using a cookie and not a session.
Here is what I would like. I close out my browser go back to my website and now the Username and UserID are blank....I want to store a cookie so I know the user has come back. To show who is online. No need to logon each time the user comes back.
Here is how I give them the information for Username and userID.
<?
session_start();
setcookie("UserName",$logon);
setcookie("UserID",$email);
Print "Username is: " . $_COOKIE['UserName'] . "<BR>". chr(13);
Print "UserID is: " . $_COOKIE['UserID'] . "<BR>" . chr(13);
?>
This is on the LOGON page and the registerconfirm page.
What am I doing wrong how to I set it the other way? Am I trying to use sessions????
A side not since this is my first time messing with cookies what should I use for each individual cookie to identify them???? WOuld it be user name password?
Any sugestions to point me in the right direction would be appreciated.
I have read the following article with some hlp from it.
http://www.developers-resources.com/stories/02/10/15/9335730
If someone can get me a starting point I can hopefully work my way through this.
Thanks again.
Attila
OOOppps forgot something can I use an include or require once to an external PHP file for my cookie information?