Jump to content
MakeWebGames

Admin View As


boionfire81

Recommended Posts

I'm trying to make it possible to switch between user accounts to view the game as another member other than the super admin/logged in userid. 

 

I created this form: 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

In globals & sglobals I have:

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

It's placed right below the

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

It has 0 effect on which user info is being pulled. What am I missing? 

  • Like 1
Link to comment
Share on other sites

so you want to switch from being staff to becoming a regular member but be able to go back to being staff once finished ??

using the same user account

 

you could do this 

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

just alter the RENAME ME.php to anyname your new file is gping to be called

 

Edited by Uridium
i have fat fingers
Link to comment
Share on other sites

Trying a new way:

Main struggle part is globals

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

The server recognizes the $_SESSION['switch_to'] variable, and will echo it. But it still has me logged in and shows me as the admin.

 

 

And decided to make a staff page which is:

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

What I'm trying to do is view as a specific member. 

What I'm trying to do is view as a specific member. 

 

Nevermind, found it. I'm switch from $ir to $user and the $user variable was still pulling the $_SESSION['userid']

Link to comment
Share on other sites

17 hours ago, boionfire81 said:

Trying a new way:

Main struggle part is globals

if(isset($_SESSION['switch_to']) && !empty($_SESSION['switch_to'])){ if($_SESSION['switch_to'] == 1 && $_SESSION['userid'] == 1){ $_SESSION['switch_to'] = ""; $userid=$_SESSION['userid']; }elseif($_SESSION['switch_to'] == 1 && $_SESSION['userid'] != 1){ $_SESSION['switch_to'] = ""; $userid=$_SESSION['userid']; }else{ $userid=$_SESSION['switch_to']; } }else{ $userid=$_SESSION['userid']; }

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Pretty sure you can replace that clusterfug of code with this:

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Link to comment
Share on other sites

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