Hi all,
I have a login script, it works with 1st sql row ‘username’ & ‘password’, but it can’t login with 2nd or 3rd row ‘username’ & ‘password’. what is the problem ?
Thanks
index.php script is : [php]<?php
include(“config.php”);
session_start();
$error = “”;
if($_SERVER[“REQUEST_METHOD”] == “POST”)
{
// username and password sent from Form
$myusername=addslashes($_POST[‘username’]);
$mypassword= md5($_POST[‘password’]);
$myusername= htmlspecialchars($_POST[‘username’]);
$sql=“SELECT uid FROM user WHERE username=’$myusername’ and password=’$mypassword’”;
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
$active=$row[‘active’];
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1)
{
session_register(“myusername”);
$_SESSION[‘login_user’]=$myusername;
header(“location: dashboard.php”);
}
else
{
$error=“Your Login Name or Password is invalid”;
}
}
?>