<?php
if(isset($_POST['button']))
{
$user_name=$_POST['user_name'];
$pass=$_POST['pass'];
include('connect.php');
//echo md5('pass');
$query1="select user_id from profile where user_name=\"$user_name\" and pass=MD5(\"$pass\")";
//echo $query1;
$result1=mysql_query($query1);
if(mysql_num_rows($result1)>0)
{
echo "You are logged in";
//redirect
//session start
}
else
{
echo "Wrong username and password please try again.";
}
}
?>
<form id="form1" name="form1" method="post" action="login.php">
<p>Username
<label>
<input type="text" name="user_name" id="textfield" />
</label>
</p>
<p>Password
<label>
<input type="password" name="pass" id="textfield2" />
</label>
</p>
<p>
<label>
<input type="submit" name="button" id="button" value="Login" />
</label>
</p>
</form>
Simple login using php
No comments:
Post a Comment