Welcome to Geeklog, Anonymous Tuesday, November 26 2024 @ 09:09 am EST

Geeklog Forums

How to create a Log-In / Log-Out Double Link


Status: offline

vbgunz

Forum User
Full Member
Registered: 01/24/03
Posts: 169
Can someone be kind enough to help me out with this task? I am trying to put *one* login / logout link in the header file... It doesn't look right having them both together... [ login : logout ] and leaving either one of them in their doesn't work if I remove the user functions block... I would like to put in one link that will double as a login *and* logout link... If you're logged out it should say login and if you're logged in it should say logout... Can someone help me make this happen? Thanks for any feedback on this Smile
Victor B. Gonzalez -
http://aeonserv.com
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany

How's your German? ;-) There's a thread over at geeklog.info explaining how to do that.

The solution is pretty simple, actually, and relies on the fact that you can use PHP in header.thtml:

Text Formatted Code
<?php
  if ($_USER['uid'] > 1) {
    print '<a href="' . $_CONF['site_url'] . '/users.php?mode=logout">Logout</a>';
  } else {
    print '<a href="' . $_CONF['site_url'] . '/users.php?mode=login">Login</a>';
  }
?>

bye, Dirk

 Quote

Status: offline

vbgunz

Forum User
Full Member
Registered: 01/24/03
Posts: 169
Perfect, thank you so much for the snippet... I actually went to the link you provided using babelfish to translate and I've got to to say... very cool, thank you very much for this Smile---Victor B. Gonzalez
Victor B. Gonzalez -
http://aeonserv.com
 Quote

sh0ck

Anonymous
blah
I'm trying to create static pages where only members have access.... and I cant do it for one simple reason. Whatever form of PHP i put in, just a simple wont work. This is the error i recieve:
Text Formatted Code



Parse error: parse error in /var/www/staticpages/index.php(78) : eval()'d code on line 1



 


If somebody finds out how to fix it I'd really appreciate it.
 Quote

Status: offline

r_f_o_t

Forum User
Full Member
Registered: 07/30/03
Posts: 241
Location:Illinois
Quote by sh0ck: I'm trying to create static pages where only members have access.... and I cant do it for one simple reason. Whatever form of PHP i put in, just a simple wont work.


Try here in the FAQ.

HTH,

Chuck
Too many hands on my time.
 Quote

sh0ck

Anonymous
thanks. I got it working Big Grin
 Quote

All times are EST. The time is now 09:09 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content