Hi!
After you all gave me some good advice recently, I'm back for more :o)
On my web site, I want to display a 'log out' icon with some text
underneath, ("Log out"), which, when clicked, will end a session.
This is the simple code I'm using for the icon:
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?action=log_o ut">
<img border="0" src="images/logout.gif" width="74" height="74"><p
style="text-align: center">
This all works fine and, when clicked, the session is ended and the
user returns to my web site's home page.
Now's the complicated, (Well for me, anyway), bit; I only want to show
the 'log out' icon when the user is actually logged in.
So, I've been using isset to determine the session state:
<?php if (isset($_SESSIO N['user'])) {?>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?action=log_o ut">
<img border="0" src="images/greenround.PNG" width="74" height="74"><p
style="text-align: center">
<?php }?>
Now - this only partially works; yes, the icon is only shown when the
user is logged in - which is cool. However, when clicked it doesn't do
anything!
I think I should be escaping some code somewhere but I can't work it
out. And it's frustrating me!!
Any guidance on where this newbie is going wrong?
Thanks!
Rod.
After you all gave me some good advice recently, I'm back for more :o)
On my web site, I want to display a 'log out' icon with some text
underneath, ("Log out"), which, when clicked, will end a session.
This is the simple code I'm using for the icon:
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?action=log_o ut">
<img border="0" src="images/logout.gif" width="74" height="74"><p
style="text-align: center">
This all works fine and, when clicked, the session is ended and the
user returns to my web site's home page.
Now's the complicated, (Well for me, anyway), bit; I only want to show
the 'log out' icon when the user is actually logged in.
So, I've been using isset to determine the session state:
<?php if (isset($_SESSIO N['user'])) {?>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?action=log_o ut">
<img border="0" src="images/greenround.PNG" width="74" height="74"><p
style="text-align: center">
<?php }?>
Now - this only partially works; yes, the icon is only shown when the
user is logged in - which is cool. However, when clicked it doesn't do
anything!
I think I should be escaping some code somewhere but I can't work it
out. And it's frustrating me!!
Any guidance on where this newbie is going wrong?
Thanks!
Rod.
Comment