[Solved] User/Admin login in PHP


Could you try this out?

$conn = mysql_connect ("localhost", "root","");
mysql_select_db("a_blub",$conn);

$result = mysql_query("SELECT password FROM user WHERE username="".mysql_real_escape_string($_POST["theusername'])."' LIMIT 1", $conn);

$row = mysql_fetch_assoc($result);

if ($_POST['thepassword'] == $row['password']) {
    if ($row['admin'] == 1) {
        header("Location: hit-counter.php");
        exit;
    } else {
        header("Location: index_loginsuccesful.php");
        exit;
    }
} else {
    header("Location: index_loginfailed.php");
    exit;
}

2

solved User/Admin login in PHP