| | |
Getting Username from login from
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
After the user has inputted their respective username and password, it will be validates and if the submitted information was true, they will redirected a page. Now, I just want to the the php code that captures the username and display it on the page. Like "Welcome BooBoy08 to here..". Please help.
Last edited by lordx78; Feb 20th, 2008 at 11:43 am.
"I might not be the BEST but I'm not like the REST!"
•
•
Join Date: May 2005
Posts: 514
Reputation:
Solved Threads: 19
Depends on your look up feature.
But general idea is:
But general idea is:
PHP Syntax (Toggle Plain Text)
<? $user=$HTTP_SERVER_VARS["PHP_AUTH_USER"]; ?> Welcome back <b> <?= $user ?>, We have missed you! <br><br>
Last edited by techniner; Feb 20th, 2008 at 12:07 pm.
When the user logs in, check if he's a valid user. If he's a valid user, add that username to a session variable. Use that session variable in the next page where you want to display his name. A small eg.
And this is page2.php
Hope that helps.
php Syntax (Toggle Plain Text)
<?php //page1.php session_start(); // check if the user is valid if (valid user){ $_SESSION['username']=$username; redirect to page2.php } else { //error message }
php Syntax (Toggle Plain Text)
<?php if(isset($_SESSION['username'])){ echo "Welcome ". $_SESSION['username']; } else { echo "Not logged in ! "; exit; }
Hope that helps.
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
Similar Threads
- Creating different username's for the same login (PHP)
- (Help Please) - Config Error: "Login failed for user 'STS-SYNMAC\userName (C#)
- (Please Help :o( ) Config Error: "Login failed for user 'STS-SYNMAC\userName'." (ASP.NET)
- Login problem (PHP)
- XP anf Novell Client Dual Login (Novell)
- Disabling Login for XP Pro OS (Windows NT / 2000 / XP)
Other Threads in the PHP Forum
- Previous Thread: Two functions to convert date
- Next Thread: page loading problem
| Thread Tools | Search this Thread |
.htaccess alerts apache api archive array autocomplete beginner binary broken cakephp checkbox class cms code convert cron curl database dataentry date display duplicates dynamic echo email emptydisplayvalue error errors execute explodefunction file files firstoptioninphpdroplist folder form forms function functions google hack href htaccess html htmlspecialchars image include insert ip javascript joomla keywords limit link login loop mail menu methods mlm multiple mysql network object oop paypal pdf php problem query radio random recursion recursive redirect remote script search securephp server sessions shot sms source space sql subscription syntax system table tutorial tutorials update upload url validator variable video web youtube






