login
Posted: Fri Dec 31, 2010 12:49 am
hi friends,,,,
now i am doing a simple login program with database application,,,here is my code--->
<html>
<body>
<div style='position:absolute;top:150px;left:780px'>
<table border='0'>
<form method=post action="<?php echo $_SERVER['PHP_SELF']; ?>">
<tr>
<td>User Name:<input type=text name=uname>
</tr>
<tr>
<td>Password: <input type=password name=pwd>
</tr>
<tr>
<td>
<center><input type=submit name=sub value=submit></center>
</td>
</tr>
</form>
</div>
</body>
</html>
<?php
if(isset($_POST['sub']))
{
$uname=$_POST['uname'];
$pwd=$_POST['pwd'];
$con=mysql_connect("localhost","root","");
mysql_select_db("my_db",$con);
$result=mysql_query("select * from logi where uname='$uname' and pwd='$pwd' ");
if($result)
{
echo "login sucess";
}
else
{
echo "loggin error";
}
}
?>
But it is not working ,,,if i gave anything as uname ,pwd it would show login success ,,,wat is the problem here,,,,,,,,,
now i am doing a simple login program with database application,,,here is my code--->
<html>
<body>
<div style='position:absolute;top:150px;left:780px'>
<table border='0'>
<form method=post action="<?php echo $_SERVER['PHP_SELF']; ?>">
<tr>
<td>User Name:<input type=text name=uname>
</tr>
<tr>
<td>Password: <input type=password name=pwd>
</tr>
<tr>
<td>
<center><input type=submit name=sub value=submit></center>
</td>
</tr>
</form>
</div>
</body>
</html>
<?php
if(isset($_POST['sub']))
{
$uname=$_POST['uname'];
$pwd=$_POST['pwd'];
$con=mysql_connect("localhost","root","");
mysql_select_db("my_db",$con);
$result=mysql_query("select * from logi where uname='$uname' and pwd='$pwd' ");
if($result)
{
echo "login sucess";
}
else
{
echo "loggin error";
}
}
?>
But it is not working ,,,if i gave anything as uname ,pwd it would show login success ,,,wat is the problem here,,,,,,,,,