How to pass parameters after login?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
GiaTuan
Forum Newbie
Posts: 14
Joined: Sat Oct 01, 2011 1:19 am

How to pass parameters after login?

Post 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.
Gopesh
Forum Contributor
Posts: 143
Joined: Fri Dec 24, 2010 12:48 am
Location: India

Re: How to pass parameters after login?

Post 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..
GiaTuan
Forum Newbie
Posts: 14
Joined: Sat Oct 01, 2011 1:19 am

Re: How to pass parameters after login?

Post 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
Gopesh
Forum Contributor
Posts: 143
Joined: Fri Dec 24, 2010 12:48 am
Location: India

Re: How to pass parameters after login?

Post 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 .
User avatar
egg82
Forum Contributor
Posts: 156
Joined: Sat Oct 01, 2011 9:29 pm
Location: Colorado, USA

Re: How to pass parameters after login?

Post 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
Post Reply