Hi, I need help. I've been looking all around and i have not found a appropriate solution for my question.

Here it is. I've a database table which has the field "username" and "password" and within the "username" field, there would be users like "admin","cashiers" etc. I would like to generate a login page using php that actually detects what are the users logged in as.

additional info: I'm using Flash, php and MySQL. So i would just need the solution to how am i to detect.

Thanks alot!!

Recommended Answers

All 3 Replies

Sql Query!

For more show me some work or effort,

I'm sorry for the brief not conceise question. First time ever to post on forums.So let me try to be a lil more detailed.

MySQL database has 3 fields.

|| userid (auto increment) || username || password ||
|| 01 || admin || password ||
|| 02 || cashier || money ||

so far, my php codes only allows me to login via admin. I'm trying to create an array to store database records to allow me to check what are the users log in as ( "admin" or "cashier" ).

if ($_POST['sendRequest'] == "log_user_in") {

     $username = $_POST['username'];
     $password = $_POST['password'];
     $sql = mysql_query("SELECT * FROM cms_admin WHERE username='$username' AND password='$password'"); 
     $login_check = mysql_num_rows($sql);
     if($login_check > 0 && $username == 'admin'){ 
           print "return_msg=admin_all_good";
//return_msg would be read by actioncripting in Flash
     } 
	 else if ($login_check > 0 && $username == 'cashier'){ 
           print "return_msg=cashier_all_good";
		   
	 else {
	       print "return_msg=no_good";
	 }
}

help?

solved. haha. just elseif and indentation of my actionscripting.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.