Hi people
I would like to make a multi level and multi users login with following parameters:
1. status_session=0 user can SEE and CHANGE details of ALL CONTRIES status_session=1,2,3 and 4 users.
2. status_session=1 and a country_session=country user can SEE details of HIMSELF and of ANY COUNTRY, status_session=0,1,2 3 and 4 users, but only can SEE and CHANGE details of SAME countrie’s status_session=2 user.
3. status_session=2 and a country_session=country user can SEE details of HIMSELF and of ANY COUNTRY status_session=0,1,2, 3 and 4 users, but only can SEE and CHANGE details of SAME countrie’s status_session=3 user.
4. status_session=3 and a country_session=country user can SEE details of HIMSELF and of ANY COUNTRY, status_session=0,1,2 3, and 4 users, but only can SEE and CHANGE details of SAME countrie’s status_session=4 user.
5. status_session=4 and a country_session=country user can ONLY SEE details of himself and of ANY COUNRY, status_session=0,1,2,3 and 4 users.
I did the following code but does not work the way I want.
Quote:
<?session_start();
include_once "call_to_DB.inc.php";
if($name == "" or $username == "" or $password ==""){
header("location: index.php?erro=missing name, or username, or password.");
die();
} if ($name !="" and $username !="" and $password !=""){
$sql="select * from inter_agents where status_session='$status_session and name='$name' and username='$username' and password='$password' and INSTR(url, '".$_SERVER['HTTP_HOST']."') limit 1";
$result = mysql_db_query("DB NAME",$sql);
$num_regd=mysql_num_rows($result);
if ($num_regd==1) {
while ($regist=mysql_fetch_array($result)) {
$name=$regist['name'];
$agent_session=$regist['agent_session'];
$country_session=$regist['country'];
$_SESSION["stat_session"] = $regist['status_session'];
$_SESSION["cry_session"] = $country_session;
echo "$num_regd";
}
$admin_session=$id;
$state_session="1";
$name_session=$name;
$agent_session=$agent_session;
$country_session=$country_session;
session_register('admin_session');
session_register('state_session');
session_register('name_session');
session_register('agent_session');
ini_set("session.gc_maxlifetime","5400");
header("location: index2.php");
die();
} else {
$state_session="";
header("location: index.php?erro=Do not found register with your details");
die();
}
} else {
$state_session="";
header("location: index.php?erro=Do not found register with your details");
die();
}?>
|
Can somebody give me a hand here?
thanks a lot
Last edited by josil; 04-30-2010 at 12:19 PM..
Reason: Wrapping in code tags
|