HI!
I have problem with this php scripts.
I write this script for check db. It works correctly but, checks only first login and password.
...thank you for help.
I have problem with this php scripts.
I write this script for check db. It works correctly but, checks only first login and password.
...thank you for help.
Code:
<html>
<head>
</head>
<body>
<form method="post">
login:<input name="login" type="text" > <br /><br />
password:<input name="password" type="password" > <br /><br />
<input type="submit" value="ok!" name="button">
</form>
<?php
$db = mysql_connect("localhost","user","");
mysql_select_db("dbname",$db);
$button=$_POST['button'];
if($_POST['button']==true){
$login=$_POST['login'];
$password=$_POST['password'];
$query = "SELECT login, password FROM this";
$result = mysql_query($query) or die (mysql_error());
$res = mysql_fetch_array($result);
if ($res[0] == $login){
if($res[1] == $password) {echo "sucess";} /* or header */
else{echo "incorrect password?";}
}
else{echo "incorrect name";}
}
?>
</body>
</html>