Jump to content

if statement not working


zhshero

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
https://forums.phpfreaks.com/topic/219023-if-statement-not-working/
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;
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.