usermanagement?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
joecrack
Forum Commoner
Posts: 99
Joined: Mon Oct 31, 2005 9:17 pm

usermanagement?

Post by joecrack »

i think this will be a very simple prob for you guys :roll:
i define a variable on one page, that includes another page.
on the included page i want to have a if function with that variable.
i tried it with $GET.... buts that didnt work...!!!///
Last edited by joecrack on Wed Dec 21, 2005 11:06 pm, edited 1 time in total.
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

You should use sessions.

Code: Select all

//PAGE 1

session_start();

$myVar = 'Hello World';

$_SESSION['MY_VAR'] = $myVar;

//Page 2

session_start();

echo $_SESSION['MY_VAR'];
joecrack
Forum Commoner
Posts: 99
Joined: Mon Oct 31, 2005 9:17 pm

Post by joecrack »

yeah nice works pretty good - but it didnt really solve my prob.
okey its about a usermanagement:

Code: Select all

function namere ($session) {
	$result = mysql_query("SELECT Authorisation FROM AdminUser
                    WHERE UserSession = '".$session."'") or mysql_error();
    	$username = mysql_fetch_array($result);

	if($username['Authorisation']<=$_SESSION['page']){
		echo "Do what you wanna";

	}
		elseif($username['Authorisation']>$_SESSION['page']){
			echo "Not authorised";
		}
and the normal page for wich the user has to authorise, perhaps like this:

Code: Select all

error_reporting(E_ALL);
session_start();
include("connect.inc.php");
include("usermanagment.inc.php");

namere(session_id());
$_SESSION['page'] = 1;
But if i log me in as a user that has authorisation number 2 and $_SESSION['page'] = 1 it still tells me
"Do what you wanna"?? Even when i am logged out ??? my logout works with a session_destroy();
Post Reply