bluegman991 Posted September 26, 2009 Posted September 26, 2009 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: Quote
seanybob Posted September 26, 2009 Posted September 26, 2009 You need this if statement: if($ir['userid']!=1){die("403 error.");} Quote
CrazyT Posted September 26, 2009 Posted September 26, 2009 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(); ?> Quote
bluegman991 Posted September 26, 2009 Author Posted September 26, 2009 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 Quote
Danny696 Posted September 26, 2009 Posted September 26, 2009 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 ;) Quote
bluegman991 Posted September 27, 2009 Author Posted September 27, 2009 thx guys i wanted to make it id 1 was the only one that could edit admin positions but other admin could edit other staff positions but this is good enuf thx again ;) Quote
Agon Posted October 12, 2009 Posted October 12, 2009 How would I do this to include a second user id? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.