-1

hey m making a project n m stuck n a problem. there are different employees that can login. i have employee table in database but am confused that how can i assign each employye the url that which page page will open when a certain employee logs in.

3
Contributors
6
Replies
7
Views
5 Years
Discussion Span
Last Post by mikulucky
0

Have a column in the employee table which say the type of employee they are, for example, doctor, nurse, domestic and so on.

Then when they log in see what type they are and do a switch statement for each on with a header redirect to the page that you want them to go to.

2

I hate to sound negative, but this seems to be on a similar theme to many other threads you've started recently. You ask for help but do not post any code that could help a contributor answer your questions.

How's this for an idea?
Search the forum for what you need. I remember answering a few of these questions over the last couple of months, as I'm sure others have done. That would be far more constructive than posting a new thread every time you get stuck on a minor issue.

0

i have written this code to check if there are only two types of users but its not working.

$employee = mysql_fetch_assoc($result);
      $_SESSION['SESS_EMP_ID'] = $employee['employee_id'];
      $_SESSION['SESS_NAME'] = $employee['employee_name'];
	  $_SESSION['SESS__dept']=$employee['department_id'];
	  $_SESSION['SESS_rank']=$employee['rank'];
      
      session_write_close();
	  if 
	  ($_SESSION['SESS_rank']==employee.rank("admin")
	  {
	  
	  
      header("location: administrator.php");
      exit();
	  }
	  else
	  {
	  header ("location: Shift_incharge.php");
	  
	  exit();
	  }
	else
	 {
      //Login failed
	  
      header("location: loginFailed.php");
      exit();
    }
  }else {
    die("Query failed");
  }
0

Ok first, have you made sure that there is a session_start(); at the top of the script?

If this is the whole script, where is this query your doing, there might be something wrong with that?

On this IF Statement your missing a bracket at the end. It should be:

if ($_SESSION['SESS_rank']==employee.rank("admin"))

Also what is this??? employee.rank("admin") Also you have extra brackets in your IF/ELSE blocks so this will mess things up. Also I think you need to read the manual on IF control statements, as you have one conditional and all the rest are ELSE, which means that only the first ELSE will ever get triggered. Here is the manual for it PHP.net Surprise!

The next problem is that the code formatting is a mess, I hope your IDE is creating this, if so, then get a new IDE.


Finally.......

I hate to sound negative, but this seems to be on a similar theme

You seem to be programming way above your ability, hence the simple mistakes of control statements. Along with the fact that you only past your problem, saying solve this or debug it for me. You hardly ever seem to provide errors, and all the code snippets you do provide seem to be to make a whole application. I hope your not charging someone for this application.

1

Yeah I realise that yOur a student. But you don't seem to grasp the basics. And you should not need help at every step. You should solve problems yourself, the major part of being a programmer is to problem solve. Not to ask for help as soon as your stuck.

Edited by mikulucky: Early post

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.