login page issue
Posted: Tue Aug 11, 2009 12:36 am
i am facing a problem i want to login my page by giving user name and password i am using this code but this is ot working properly kindly help me in this regard if any one knows th in advance
Code: Select all
<Html>
<head>
<title>Insert Record</title>
</head>
<body>
<h1>insert Record</h1>
<form method="POST" action=log.php>
name <input type="text1" name=text1>
<br/><br/>
password <input type="text" name=text2>
<br/><br/>
<br/><input type="submit">
<br/><br/><br/>
</body>
</form>
</html>
Code: Select all
<?php
$A=$_REQUEST["text1"];
$B=$_REQUEST["text2"];
$conn=mysql_connect('localhost','root','server') or die("Error connection server");
$db=mysql_select_db("login",$conn) or die("error connecting database");
echo "connection mysql<br/>";
$sql="select * from log where name='$_A' and pwd='$B'";
echo "connection mysql<br/>";
$res=mysql_query($sql) or die(mysql_error());
echo "connection mysql<br/>";
if($res!=null)
{
echo "good";
}
else
{
echo "invalid user name or password";
}
?>