It is a login form with only username and password. It works well but i want my information to be case sensitive. For example my database username is : David and password :PooPoo. Although if i insert user name: daVid and password: PoOPOo it parse the form.
My code looks like this:
<?php 
    session_start();
    if (isset($_SESSION["manager"])) {
        header("location: index.php"); 
        exit();
    }
?>
<?php 
    if (isset($_POST["username"]) && isset($_POST["password"])) {
        $manager = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["username"]); 
        $password = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["password"]); 
        include "../storescripts/connect_to_mysql.php"; 
        $sql = mysql_query("SELECT id FROM admin WHERE username='$manager' AND password='$password' LIMIT 1"); // query the person
        $existCount = mysql_num_rows($sql); // count the row nums
        if ($existCount == 1) { // evaluate the count
             while($row = mysql_fetch_array($sql)){ 
                 $id = $row["id"];
             }
             $_SESSION["id"] = $id;
             $_SESSION["manager"] = $manager;
             $_SESSION["password"] = $password;
             header("location: index.php");
             exit();     
        }else{
            print '<script type="text/javascript">'; 
            print 'alert("wrong info")'; 
            print '</script>'; 
        }            
    }
?> 
My validation script
<script type="text/javascript" language="javascript"> 
    function validateMyForm ( ) { 
        var isValid = true;
        if ( document.adminlogin.username.value == "" ) { 
            alert ( "Please enter your username" ); 
            isValid = false;
        } else if ( document.adminlogin.password.value == "" ) { 
            alert ( "Please enter password" ); 
            isValid = false;            
        }
        return isValid;
    }
</script>
Where is my error please?
 
     
     
     
     
    