Jump to content

[PHP,HTML] login page detect more than 1 table


Recommended Posts

Hello, im a new user here. Im now working on a project called student attendance management sytem. I have doing all the necessary tables in database which is  admin, lecturer, student, parent, attendance and grade. Ok so im now working on a 1st page which is a login page.
Right now i have finished the coding and what im gonna ask u all is how to make sure that when i clicked 'login', it not only detect the admin table but all of other tables?

		<title> Login Form </title>

<form method='post' action='login.php'>
	<table width='400' border='5' align='center'>
		<td align='center'
		colspan='5'><h1>Login Form</h1></td>
		<td align='center'>Username:</td>
		<td><input type='text' name='username' /></td>
		<td align='center'>Password:</td>
		<td><input type='password' name='pass' /></td>
		<td colspan='5' align='center'><input type='submit' name='login' value='Log In' /></td>


	$username = $_POST['username'];
	$password = $_POST['pass'];
	$check_user = "select * from admin where username='$username' AND pass='$password'";
	$run = mysql_query($check_user);
	"<script>alert('You are logged in')</script>";
	else {
	echo "<script>alert('username or password is incorrect!')</script>";

Link to comment
Share on other sites

ok, just to make sure no problem will arise later bcoz of the tables. So, right now these are my initial tables.







If i delete those 4 users table and create a new one called users ( id, name, username, password, type_of_user), then wouldn't it be a problem later when : -


- the admin wanna asign course_id for the added lecturer

- the lecturer enter his/her course_id and the whole students in that course can be viewed

Link to comment
Share on other sites

you also don't need a user type dropdown on your login page, since you will know which type the user is when you authenticate them against this single user table that contains the type_of_user column.


the only place you would need a user type dropdown is you are allowing an administrator to assign a user type to other user(s).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.