I will register a session after checking that username and password is valid by method <?php session_register(username); ?> If in my php.ini file register_globals are on then on any page of my website if i use <?ph echo ("Session is registered as : $username"); ?> it will show the username of the user loged in like "admin" but if in my php.ini file register_globals are off then it register the session butwhen i try to use <?ph echo ("Session is registered as : $username"); ?> it will not show the "admin" or the username of the user that is logged in. i want to show "welcome User" to my pages and i want this with register_global off. Plz help me how can i solve my problem
Don't use session_register(). Do: $_SESSION['username'] = 'Admin'; PHP: And in your next page: echo ("Session is registered as :". $_SESSION['username']); PHP:
If I use $_session['username'] = 'Admin' ; Then is it do the same function of registraing the session , I use session_register() for registrating my session. Is this $_session[] is also used for registrating session. The second thing is the user is not alway admin , the username is one that the user use at login page. If user use admin then i want to register my session "admin" if user enter username "baba" then i want to register my session "baba". How can i do that.
Seems too obvious but is this all you need?: echo "Session is registered as : {$_SESSION['username']}"; PHP: