0

Hi, I'm trying to display certain links if user is logged in, else display other links. Everything works great except for log out link. I have a php script inside a php script and its not working. I was wondering if anyone has a solution. Here is the else part of the script where the log out link will be displayed. Thanks.

else {echo
		'<ol id="links">
		<li><a href="home.php">Home</a></li>
		<li><a href="account.php">Account</a></li>
		<li>Forum</li>
		<li><a href="<?php  echo $logoutAction ?>">Log out</a></li>
		</ol>';}
?>

Edited by nav33n: For easy readability, wrap your code in [code][/code] tags.

3
Contributors
7
Replies
8
Views
7 Years
Discussion Span
Last Post by phpbeginners
0

as I can see in your code remove the "<?php echo $logoutAction ?>"
just put only $logoutAction because you are in the echo() command.
you are trying to echo a php tags.

Edited by phpbeginners: n/a

0

Thanks, I see what your saying but it's still not working, I keep getting an Object Not Found error.

0

anyways i am using this code as login page...

test1.htm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 
 </HEAD>

 <BODY>
 <form name="form" action="test1.php" method="post" onSubmit="return verify()">
<table width="200" border="0">
 <tr>
   <td>Enter Your ID : </td>
   <td><input type="text" name="adminuser"><br></td>
 </tr>
 <tr>
   <td>Enter Your Password : </td>
   <td><input type="password" name="adminpass"><br></td>
 </tr>
  <tr>
   <td><INPUT class="button" type="submit" name="submit" value="Submit"></td>
   <td> </td>
 </tr>
</table>

</form>

 <script>
function verify(){
       var ret = true;
       var f = document.forms[0].elements;
	   var a=0;
       for(var i = 0; i < f.length; i++){
               if(f[i].value == "") {
                       a++;
 
				}
		}
		if(a>0)
				{
				alert("Username and Password must be filled");
				ret = ret && false;
				}
       return ret;
}
</script>
 </BODY>
</HTML>

and this page as processpage..
test1.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 </HEAD>

 <BODY>
<?php
$adminuser = $_POST['adminuser'];
$adminpass=$_POST['adminpass'];

if(($adminuser=="admin") && ($adminpass=="manoj")){	
	echo "Logged In Scesfully!<br><ol id='links'> <li><a href='home.php'>Home</a></li> <li><a href='account.php'>Account</a></li> <li>Forum</li> <li><a href='$logoutAction'>Log out</a></li> </ol>";}
else if(($adminuser || $adminpass)==NULL) echo "Logged out Sucessfully!";
else echo "Invalid Usename or Password";
?>
</BODY>
</HTML>

and it is working good on my machine... just check it.. I am sure you will like it...

ave a nice day.. :)

0

Awsome!! Works great, thank you. I didn't think of the surrounding periods, that did it.

0

Awsome!! Works great, thank you. I didn't think of the surrounding periods, that did it.

okidokidok! :icon_cheesygrin:

Edited by phpbeginners: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.