Secure Login Script redirect based on login details

I’ve used this tutorial as base to create a login script:

http://www.wikihow.com/Create-a-Secure-Login-Script-in-PHP-and-MySQL#

Everything works just fine. Users can login, logout, etc. Now I’ve tried to add a function but can’t get this function to work.

In the table that stores the data (username, password, etc) after registration I’ve added an extra field “isAdmin”. This stores a simple “yes” or “no” value, to tell if the user that tries to login gets full administrator rights or not. On the registration page I’m able to submit this value, so after registration the value is succesfully stored. But after registration, in the login section, somehow this value isn’t returned the right way.

Basically, what I’m trying to achieve:

if (user_that_logs_in.isAdmin == “yes”) -> go to administrator_page.php
if (user_that_logs_in.isAdmin == “no”) -> go to regular_page.php

what do I need to adjust/add to get this function to work?

You didn’t put much information in about what your login form looks like, or what happens now when someone logs in.

It appears that rather than just a validation, you need to return a value.

Thank you. I’ve placed a link in my previous message, because it’s to much code to place here. That’s the code I use.

You could have your login function pull the admin value, and write it in the session variable.

Sponsor our Newsletter | Privacy Policy | Terms of Service