I have been trying different things with session and I think I didn't do it the right way or something. Anyway, here is my problem and please someone help me.
Example: I have 5 files. "login.html", "login.php", "message.html", "message.php", and "signal.php"
Now, "login.html" is just a simple form which send then user name and password to "login.php", then "login.php" will check for the valid users against the database (MySQL). I have all of that working. For the sake of the argument let's say the login name is "coolPHP" and the password is "verycoolPHP".
Now, I know that I need to use session somewhere in some of the files or maybe in all 5 files. There are 2 things I need to do. First problem, "message.html" is where I am at after "login.php" check for the password and send me there. So, now I am at "message.html". In "message.html" I have another form which I will send that form to "message.php" and that form will insert into the database. What I need is somehow "message.html" and "message.php" has the login name (coolPHP) all along. So, when I insert the form into the database I have "coolPHP" as the message sender. Because the database is some thing like this:
sender | coolPHP |
message | This is my message |
status | on |
Second, I have to have a signal which will check every 5 second or so to see if "coolPHP" is still at "message.html". If he go to another page other than "message.html". I have to send a signal "signal.php" and tell me that "coolPHP" has left the "message.html" page... and the same thing when he logon to "message.html", the "signal.php" has to tell me that "coolPHP" is on "message.html".
Sorry for the long message. Thanks for your help.
Chris
PS. Please give me as specific example as possible. Because I tried these step and it did work:
session_start(); //start session
session_register("$user"); //register the variable