Hi I'm a newbie and I have an idea to use session on my site. Once the user's logged in, the username and password will be stored in session.The user should then able to access to all the pages on my site.
session_start();
session register("username","password");
$session=session_id();
print("welcome to my site! Please select your destination:
<a href=links.php?$session>Links</a>
<a href=download.php?$session>Download</a>
");
If the user tried to access directly to certain page,say links.php by typing the appropriate url, he/she will be asked to login first. How am I going to accomplish this?
Is it neccessary to embed the $session variable in the url links.php? What'd happen if I changed the above url from
links.php?$session to only links.php ?
What's the difference between
links.php?$session and
links.php?SID=$session
Could anyone please give me some hints? Helps and comments are very appreciated.Thank you very much.