Posted on: 04/15/04 03:56am
By: sornok
I am trying to do the following on a static page
?><?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
thx
staticpages and php problem
Posted on: 04/15/04 08:40am
By: Blaine
For anonymous users $_USER['uid'] is == 1
staticpages and php problem
Posted on: 04/15/04 01:48pm
By: diego
$_USER is a global variable, so to used it, first you have to check if it's declared on the code, like:
global $_USER;
staticpages and php problem
Posted on: 04/16/04 02:53am
By: Anonymous (sornok)
right on top of the code i posted ?