Click here to Skip to main content
15,893,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<?php
if(isset($_POST['submit']) {
ob_start();
$id=$_POST['id'];
$pswd=$_POST['pswd'];

$sql="SELECT * FROM admin WHERE id=........."
$query=mysql_query($sql);
$count=mysql_num_rows($query);
if($count==1) {
header('location: admin/index.php');
} else {
$sql="SELECT * FROM user WHERE id=........."
$query=mysql_query($sql);
$count=mysql_num_rows($query);
if($count==1) {
header('location: user/index.php');
} else {
echo 'Invalid id-password combination';
}
}
}
?>

is any errors on this code???

What I have tried:

help me pleaseeeeeeeeeeeeeeeee
Posted
Updated 26-Jan-17 20:34pm
Comments
Mohibur Rashid 27-Jan-17 2:01am    
create a common log in form and store user type information in separate table or separate column. This comment is based on your title. I didn't bother to read your source code

We should be asking you this
Quote:
is any errors on this code???
Anyway, there is no need to have separate tables for admin and user, what you need is a role table.
check out Role Based Access Control in PHP[^]
 
Share this answer
 
I would also recommend to start using MYSQLI or PDO just to be safe.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900