Guys please help.. It always says "Sorry, cannot log you in. Wrong login information". Thank u..
<?php
session_start();
include "dbConfig.php";
if ($_GET["op"] == "login")
{
if (!$_POST["StudentID"] || !$_POST["password"])
{
die("You need to provide a username and password.");
}
$q = "SELECT * FROM `student` "
."WHERE `StudentID`='".$_POST["StudentID"]."' "
."AND `password`=password('".$_POST["password"]."') "
."LIMIT 1";
$r = mysql_query($q);
if ( $obj = @mysql_fetch_object($r) )
{
// Login good, create session variables
$_SESSION["FullName"] = $obj->FullName;
$_SESSION["valid_user"] = $_POST["StudentID"];
//$_SESSION["valid_time"] = time();
Header("Location: Main.php");
}
else
{
die("Sorry, could not log you in. Wrong login information.");
}
}
else
{
echo "<form action=\"?op=login\" method=\"POST\">";
echo "Username: <input name=\"StudentID\" size=\"15\"><br />";
echo "Password: <input type=\"password\" name=\"password\" size=\"8\"><br />";
echo "<input type=\"submit\" value=\"Login\">";
echo "</form>";
}
?>