Jump to content

if statement not working


zhshero
 Share

Recommended Posts

what i'm trying to do, is have it so a staff member can mange users

i came up with these, but it dosn't show on the page :S

 

if ( isadmin ( $_SESSION['user_id'] ) ):
?>
<br />
It seems that you're an admin. You may <a href="manage_users.php" title="manage users">manage users</a> or <a href="admin_settings.php" title="edit site settings">edit site settings</a>.
<?	
if ( ismod ( $_SESSION['user_id'] ) ):
?>
<br />
It seems that you're an mod. You may <a href="manage_users.php" title="manage users">manage users</a>.
<?php
endif;
?>

Link to comment
Share on other sites

The structure is invalid.

 

<?php
function isadmin() { return false; }
function ismod() { return false; }

if (isadmin($_SESSION['user_id'])) :
?>
<br />
It seems that you're an admin. You may <a href="manage_users.php" title="manage users">manage users</a> or <a href="admin_settings.php" title="edit site settings">edit site settings</a>.
<?	
elseif (ismod($_SESSION['user_id'])):
?>
<br />
It seems that you're an mod. You may <a href="manage_users.php" title="manage users">manage users</a>.
<?php
else :
echo "none of the above . .";
endif;
?>

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.