brad12345 Posted June 24, 2008 Share Posted June 24, 2008 hi all i have $CustID as my username varialble and would like to display the "welcome $CustID" after user has logged on How do i do this do i use sessions somehow this is some example code from the "loginSuccess.php" page <?php include ('serverConnect.inc.php'); $_SESSION['CustID'] = 1; if(!isset($_SESSION['CustID'])){ header("location:login.php"); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="stylesheet.css" /></head> <title>Untitled Document</title> </head> <body> <div id="wrap"> <div class="header"></div> <div class="headerSpacer"><a href="index.php">Home</a> | <?php if(!isset($_SESSION['CustID'])) { echo "<a href='login.php'>Login</a>"; } if(isset($_SESSION['CustID'])) { echo "<a href='logout.php'>Logout</a>"; } echo "$CustID"; ?> </div> <div class="content"> Login Successful! </div> <div class="bottom"></div> </div> </body> </html> Link to comment https://forums.phpfreaks.com/topic/111639-welome-username-how-to/ Share on other sites More sharing options...
s_ainley87 Posted June 24, 2008 Share Posted June 24, 2008 <?php if(!isset($_SESSION['CustID'])) { echo "<a href='login.php'>Login</a>"; } if(isset($_SESSION['CustID'])) { echo "<a href='logout.php'>Logout</a>"; //say hello to the member echo "Welcome $CustID"; } echo "$CustID"; ?> Link to comment https://forums.phpfreaks.com/topic/111639-welome-username-how-to/#findComment-573073 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.