Page 1 of 1

How to pass parameters after login?

Posted: Sat Oct 22, 2011 9:38 am
by GiaTuan
I am doing a login page using session.I did login.php:

Code: Select all

session_star ();
session_register ('userid');
$ _SESSION ['Userid] = $ row [username];
header ('welcome.php');
in welcome:

Code: Select all

session_star ();
if (isset ($ _SESSION ['userid'])) echo "welcome". $ _SESSION ['userid']
it goes to 'welcome.php' good.And has 'welcome <user>'.I created main.php->include 'login.php' in the right of 'main.php.I know how to use document.getElementById (). style.visibility to hide the table.How to: After logging in Left.php or any php can print out: welcome <user>?And i want a link 'Loguot' near '<user>' as: welcome GiaTuan Loguot
After pressing 'loguot' the table of 'login.php' will appear and the word 'welcome <user> logout' will hide
I tried the code of 'welcome.php' but not.

Re: How to pass parameters after login?

Posted: Sat Oct 22, 2011 10:16 am
by Gopesh
Check this link viewtopic.php?f=1&t=129885 for login.Don't use session_register,read this http://php.net/manual/en/function.session-register.php. use session_start() instead of session_star()[hope that it came by mistake when typing].Hope it helps u..

Re: How to pass parameters after login?

Posted: Sun Oct 23, 2011 8:26 am
by GiaTuan
sorry, my mistake is session_start ();.I tried once before and it worked.I read your link.So,I just read the session and echo $ _SESSION ['username'] in main.php.Logout only session_destroy ()why use md5 ()?If not, it still works?
I install mysql local

Re: How to pass parameters after login?

Posted: Sun Oct 23, 2011 10:45 am
by Gopesh
Hi,md5() hashing is used to secure passwords. check this http://www.php.net/manual/en/faq.passwo ... s.fasthash.For logout process we need to remove the session variables,session_destroy() handles it .

Re: How to pass parameters after login?

Posted: Mon Oct 24, 2011 10:58 am
by egg82
session_star ();
$ _SESSION ['Userid] = $ row [username];

should be

session_start();
$_SESSION ['Userid'] = $row["username"];

Not sure if you fixed it on your end, but that will kill your code