Page 1 of 1

login

Posted: Thu Mar 22, 2012 1:00 am
by GaneshPrasad
<?php
include("connection.php");
if($_POST['submit'])
{
$myusername = $_POST['username'];
$mypassword = $_POST['password'];
$myadmin = $_POST['admin'];// ok
if($myusername && $mypassword && $myadmin)
{
$sql = mysql_query("select * from login");

while($getrows = mysql_fetch_array($sql))
{
$dbuser = $getrows['Username'];
$dbpass = $getrows['Password'];
$dbrole = $getrows['Role'];
}

if(($myusername == $dbuser) && ($mypassword == $dbpass) && ($dbrole-->"Admin"))
{
header("location:Home.php");
}

else if(($myusername == $dbuser) && ($mypassword == $dbpass) && ($dbrole-->"Member"))

{
header("location:Home.php");
}


//else
//{
//echo "Login Failed......";
//}


}


else
{
echo "username and password failed";
}
}

?>

Re: login

Posted: Thu Mar 22, 2012 5:19 am
by Celauran
Is there a question hiding in there somewhere? Also, please use syntax tags to clean up that mess of code.