Jump to content
MakeWebGames

[Staff] Switch accounts


SRB

Recommended Posts

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.

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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