SRB Posted March 27, 2014 Posted March 27, 2014 Ok, so this code is pretty basic and if someone required more from it, it could be extended a fair amount, but here goes a simple script (That surprisingly hasn't been posted before) Query You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. switch.php You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Link You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. How to use? It's pretty simple. If ID 1 is an admin account and you would like ID 43 to be able to run both (admin and player accounts), you just need make `staff_id` = 43 for `userid` = 1; You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Why use this? If, like me, you dislike staff using their main account to play AND be staff, this works as they do not need to remember 2 different log in's (Hell, they don't even need access to password on staff account!) This also makes it harder for players to yell the normal "Staff are cheating - secretary is number 1 in all stats!" etc Potential updates for people; - IP Logging - Require Auth code (4 digit pin like banks maybe?) - Function to block certain pages for staff (Preferences etc); (Hint: IF (`staff_id` > 0) ...) Anyway, as I said, basic. Does what it says on the tin though. 1 Quote
KyleMassacre Posted March 27, 2014 Posted March 27, 2014 Nice post Offc. Barbrady, I never even thought of something like that Quote
SRB Posted March 27, 2014 Author Posted March 27, 2014 Might be worth noting that you can set the staff level by giving the user_level to the staff account. I know some won't see it straight from the code, so figured I'd set that straight :) Quote
Samurai Legend Posted March 27, 2014 Posted March 27, 2014 Hello Guest, thanks for the share! This is great just added it to my website. +1 It's much quicker for me to change to my Test Account. Quote
benlucraft Posted April 20, 2014 Posted April 20, 2014 Where do I paste the link : $sql = "SELECT `userid`, `username` FROM `users` WHERE (`userid` = '{$ir['staff_id']}' OR `staff_id` = '{$ir['userid']}') LIMIT 1"; $run = mysql_query($sql); if (mysql_num_rows($run) == 1) { $info = mysql_fetch_assoc($run); echo '<a href="switch.php">Switch to ' . htmlentities($info['username'], ENT_QUOTES, "UTF-8") . '</a>'; } I tried putting it in staff panel but got a line error? Quote
Newbie Posted April 21, 2014 Posted April 21, 2014 mtg had something like this pretty nice addition good job and thanks :) 1 Quote
SRB Posted April 21, 2014 Author Posted April 21, 2014 Where do I paste the link : $sql = "SELECT `userid`, `username` FROM `users` WHERE (`userid` = '{$ir['staff_id']}' OR `staff_id` = '{$ir['userid']}') LIMIT 1"; $run = mysql_query($sql); if (mysql_num_rows($run) == 1) { $info = mysql_fetch_assoc($run); echo '<a href="switch.php">Switch to ' . htmlentities($info['username'], ENT_QUOTES, "UTF-8") . '</a>'; } I tried putting it in staff panel but got a line error? The error is due to your implementation. Have you closed the echo/print on the line above it and opened it again below it? 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.