The below code is good example of verify the Entered user login credential with the Database valid user dable, if its matching mean create the session and redirect that user to the valid page else ask to enter the valid login credential.
<?php include("../config.php"); //Know more about config.php $type=$_POST['type']; //HTML Text Box Value $uname=$_POST['uname']; //HTML Text Box Value $pwd=$_POST['pwd']; $query=mysql_query("SELECT * FROM `adminlogin`"); // else we can directly put the user name and password in query while($re=mysql_fetch_array($query)) { if($uname==$re['uname'] && $pwd==$re['pwd']) { { //valid user session_start(); $_SESSION['admin']=$uname; $flag=1; header("location:success.php"); exit; } } else { $flag=0; } } if($flag==0) { include ("index.php"); echo "<center> </BR> <B>"."Invalid User "; } ?>
0 comments:
Post a Comment