Page 1 of 1

usermanagement?

Posted: Wed Dec 21, 2005 7:29 pm
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...!!!///

Posted: Wed Dec 21, 2005 7:50 pm
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'];

Posted: Wed Dec 21, 2005 9:10 pm
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();