Very very weird problem..
Posted: Tue Jun 11, 2002 2:25 am
Hi, here's the situation..I've written a simple(at the moment) script that will create user accounts, and allow users to log in. As part of the layout I want to add a script that will give a logged in user links, or if not logged in a login box. The way the layout is set up, is I have two files which contain the layout that are included using php's include function on every page. The following is the code I have to check to see if the user is logged in and print out the info I want:
This is where it gets weird. If you access the file directly(i.e. viewing the actual file the code is in in your browser), it works without a hitch. However, if you access the file on a page it is being included on, it will echo out the form to login, even though it should be echoing out the Welcome message as it does if the file is accessed directly. I can't think of any reason for this to be happening and would appreciate any help. 
Code: Select all
<?php
if (isset($eslogin)) {
$luid = $esloginї'user'];
while (list ($name, $value) = each ($eslogin)) {
if ($name == user) {
$liuid = $value;
global $liuid;
}
}
}
if (isset($liuid)) {
echo "<center>";
echo "<font face=verdana size=1>Welcome, $liuid</font><br>";
echo "<a href='http://elf.pp-network.com/logout.php'>Logout</a>";
echo "</center>";
} else {
echo "<center>";
echo "<form name='register' action='execlogin.php' method='GET'>";
echo "<input type='text' size='15' value='Username' name='uid'><br>";
echo "<input type='text' size='15' value='Password' name='pass'><br>";
echo "<input type='submit' value='Login'>";
echo "</form>";
echo "</center>";
}
?>