after login i want to display logout and username. but here if i login again its showing login. please some help me
index.php
<?php
session_start();
$city=$_SESSION['city'];
$userl = $_SESSION['username1'];
<?php
if(!isset($userl) == '')
{ ?>
<div class="header_nav_left">Welcome <?php echo $userl; ?> | <a href="logout.php" id="clicklogin" title="Logout" onClick="NewWindow(this.href,'loginwindow','500','500','no','center');return false" onFocus="this.blur()">Logout</a></div>
<?php }
else
{ ?>
<div class="header_nav_left">Welcome Guest | <a href="login.php" id="clicklogin" title="Login" onClick="NewWindow(this.href,'loginwindow','500','500','no','center');return false" onFocus="this.blur()">Login</a></div>
<?php } ?>
login.php
session_start();
$business = $_GET['Business'];
$article = $_GET['article'];
$abusiness = $_GET['abusiness'];
$myusername = $_POST['username1'];
$mypassword = $_POST['password1'];
$are_you = $_POST['are_you'];
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql = "SELECT * FROM `register` WHERE Username='$myusername' AND Password='$mypassword' AND Activation=''";
$result = mysql_query($sql); //are_you_an='$are_you'
$r = mysql_fetch_array($result);
$count = mysql_num_rows($result);
if($count == 1)
{
if($r['Activation'] == '')
{
echo '<script>alert("A Confirmation '.$r['EmailId'].' has been sent to Email Please click on the Activation Link to Activate your Namshimoga Account");
window.location="login.php?Business=Business";</script>';
}
// If result matched $myusername and $mypassword, table row must be 1 row
elseif($r['are_you_an'] == 'Individual')
{
//if($r['are_you_an'] == 'Business')
$userl = $_SESSION['username1'];
$_SESSION['username1'] = $user1;
session_register("username1");
session_register("password1");
echo '<script>window.location="addarticle.php?userid='.$r['Id'].'";</script>';
}
elseif($r['are_you_an'] == 'Business,Individual' )
{
if($_GET['Business'] == 'Business')
{
echo '<script>window.location="addbusiness.php?userid='.$r['Id'].'";</script>';
}
// Register $myusername, $mypassword and redirect to file "login_success.php"
$userl = $_SESSION['username1'];
$_SESSION['username1'] = $user1;
session_register("username1");
session_register("password1");
echo '<script>window.location="addarticle.php?userid='.$r['Id'].'";</script>';
}
else
{
echo '<script>alert("Wrong Username or Password");
window.location="login.php?Business=Business";</script>';
}
}