Jump to content
MakeWebGames

Recommended Posts

Posted

Hi i am new to php and mccodes coding and the only way i really learn

is from experience or trial/error so some bugs i can fix and some

adjustments i can make

but whats got me stuck is i am trying to

make it so only user id 1 can take away or give admin so the other

admin of my game cannot give other people admin or take away from the

ones who already have it and if anyone besides id 1 tries to do it they

get a 403 error

can someone help me on how to do this please :rolleyes:

Posted

Can use in_array, and just add more to the array who you want to give access to.

<?php
include("./globals.php");
if (in_array($ir['userid'], array(1))) {
      //Script Here
} else {
      echo "You don't have access to this page.";
}
$h->endpage();
?>
Posted

thanks mario and thanks seanbobby

i think i'll try them both :P but seanbobby i already know what the if statement would be im just not sure where to put it that would be my first choice tho

and mario i have an idea of where to put ur's in but i am not for shure so i will try the way i think it might be

and i would add them under the user level function correct? if so ill post the function if u dont already have it for u guys to get a better idea

Posted

You can use this if statement,

if($ir['userid'] != 1) { echo 'And you are....'; $h->endpage(); exit; } // rest of script here no need for exit as using exit

OR

if($userid= 1) { echo 'And you are....'; $h->endpage(); } 
else
// rest of script

depends on which one you want... OH and find

function userlevelform()
{
global $db,$ir,$c,$h,$userid;

and add the if statment up there below the global line

and mario is LazyT ;)

  • 2 weeks later...

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.   Paste as plain text instead

  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.

×
×
  • Create New...