Jump to content

welome $UserName how to?


brad12345

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.