Welcome to Geeklog, Anonymous Friday, March 29 2024 @ 01:38 am EDT

Geeklog Forums

staticpages and php problem


Status: offline

sornok

Forum User
Newbie
Registered: 03/04/04
Posts: 9
I am trying to do the following on a static page

Text Formatted Code
?><?php if ($_USER['uid']>=2) {echo $_USER['uid']; echo '<a href="/usersettings.php?mode=edit">';} else {echo $_USER['uid']; echo '<a href="/users.php?mode=new">';}?>press here</a>
 


what I want to do is to check if the current user is a member or not and create the appropriate link for him , ie if its a member to create a link to edit his/her profile and if its a guest to create a link to go to the registration page

the page is centerblock and it is at the top of the page - homepage only - not wrapped in a block

my first question is, what is the value of $_USER['uid'] when a user is not logged in ? although I use an echo to type it, this echo does nothing...

the main problem is that this piece of code works only when it is not shown as a centerblock (as a simple static page) and always with the problem of my first question

if there is another way to do all this i would be curious to know Smile

thx
 Quote

Status: offline

Blaine

Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
For anonymous users $_USER['uid'] is == 1
Geeklog components by PortalParts -- www.portalparts.com
 Quote

Status: offline

diego

Forum User
Newbie
Registered: 04/15/04
Posts: 7
caffeinated
$_USER is a global variable, so to used it, first you have to check if it's declared on the code, like:
global $_USER;
[]'s
diego
 Quote

sornok

Anonymous
right on top of the code i posted ?
 Quote

All times are EDT. The time is now 01:38 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