Jump to content


Photo

Please help with Session [level]


  • Please log in to reply
1 reply to this topic

#1 mascotoc

mascotoc
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 10 March 2006 - 10:37 PM

Hello Guys,

My programmer left suddenly and I need help urgently as i am not a programmer.
I am using a simple logincheck.php file and I want to grant access to User level with '2' and '5'
my current following script is working perfectly if the user level is '2'. BUT how do i add '5'

i.e. I want to give access to user whos level is either 2 or 5 rest all levels will be denied.

<?php

session_start();
if(!isset($HTTP_SESSION_VARS['level'])){
  header("Location: http://www.website.com/login/error.php");
} else {
  if($HTTP_SESSION_VARS['level'] != 2){
    header("Location: http://www.website.com/login/error.php");

  }
}
?>
This code works perfectly... but how do i add
($HTTP_SESSION_VARS['level'] != 5)

I tried using AND & OR .. but its giving error.

I want something like

if($HTTP_SESSION_VARS['level'] != 2) OR if($HTTP_SESSION_VARS['level'] != 5)


#2 joecooper

joecooper
  • Members
  • PipPipPip
  • Advanced Member
  • 358 posts

Posted 10 March 2006 - 11:21 PM

if($HTTP_SESSION_VARS['level'] != 2) || ($HTTP_SESSION_VARS['level'] != 5){

// code to run

}

this will work, there is other ways but this is all you need
Signature:
[/a]
[a href="http://www.planet-so...=1999&lngWId=8" target="_blank"]EzLogin 1.0[/a]
[a href="http://www.essexracers.com" target="_blank"]Essexracers.com[/a]
Msn Messenger: joe@joeyjoe.co.uk




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users