Here is Example to create login page in PHP
<?php
$username=$_POST['username'];
$pass=$_POST['password'];
$con=mysql_connect("localhost","root","");
if(!$con)
{
die('connection failed:'.mysql_error());
}
mysql_select_db("database_name",$con);
$result=mysql_query("select user,password from login_table where user='$username' AND password='$pass'");
$row=mysql_fetch_array($result);
if($row["user"]==$username && $row["password"]==$pass)
{
echo "you are validated user and your login accepted";
}
else
{
echo "sorry, invalid login id or password, try again ! ! !";
}
?>
<?php
$username=$_POST['username'];
$pass=$_POST['password'];
$con=mysql_connect("localhost","root","");
if(!$con)
{
die('connection failed:'.mysql_error());
}
mysql_select_db("database_name",$con);
$result=mysql_query("select user,password from login_table where user='$username' AND password='$pass'");
$row=mysql_fetch_array($result);
if($row["user"]==$username && $row["password"]==$pass)
{
echo "you are validated user and your login accepted";
}
else
{
echo "sorry, invalid login id or password, try again ! ! !";
}
?>
Comments
Post a Comment