Beginner here learning PHP by developing a fictional website.
I've reached a point where I'm trying to do something, but don't know how. I'm not even sure how to ask the question with the right terminology, so I'll just describe what I'm trying to do.
With my website, you basically login and are taken to a User's Control Panel that has several links to different pages. All you do is click a link, go to another page, and enter a bunch of data about yourself in all the text fields. You do that to all the pages and you're essentially done with everything this site can do.
This all works nicely w/ no problems. I currently have two fictional USERS with data saved to db. I also have one ADMIN-level userid/password saved to the database.
On to the problem:
When I login as ADMIN, I'm taken to the ADMIN's Control Panel. Using a:
Code: Select all
while($row = mysql_fetch_array($result))The problem:
When I click the button, I'm taken to the USER's control panel page, but I'm not seeing their data. The reason is because as a User, when I login - I'm passing on myusername as $_SESSION information and my code does queries based on myusername and $_SESSION data. But, when I link over from the ADMIN control panel, I'm not passing $_SESSION data and therefore I'm not recognized.
FYI: myusername is the user's e-mail address.
Here is the code on the USER's control panel that let's them see their data when they login:
Code: Select all
<?php session_start();
if ($_SESSION['myusername']) {
So, somehow I need to be able to come from the ADMIN side and see the USER's side as if I were them, but without loosing my admin status.
I realize this might be a tough one to help with, but does anyone have any samples they can paste or are there any links for me to read. Hard to find a solution when you don't know how to phrase the question for Google.
Thanks..