Ok, i've made the changes as suggested and a couple more but the crazy thing is still logging in everyone regardless of a correct username/password combo.
- To find my actual form, i've put it up on my test site:
www.ucalgary.ca/~myuen
Here's what i've got now. I really hope you can help me out because this really shouldn't be THAT hard of a problem:
CONNECTS TO DATABASE (called dblib.inc)
<?PHP
$link;
function connectToDB()
{
global $link;
$db="ldspracticedb";
$link=mysql_connect("localhost");
if(! $link)
die ("Couldn't connect to MySQL");
mysql_select_db($db, $link)
or die ("Couldn't open the $db database: ".mysql_error());
}
connectToDB();
?>
LOGIN CHECK (logincheck.php)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<head>
<title>Login check</title>
</head>
<body>
<?PHP
include("dblib.inc"); //starts database connection
/**************************************************************************************
This prints out the user input on the screen
**************************************************************************************/
foreach ($HTTP_POST_VARS as $key=>$val)
if (gettype($val) == "array")
{
print "$key:<BR>\n";
foreach ($val as $two_dim_value)
print ".....$two_dim_value<BR>";
}
else
{
print "$key: $val (From the form)<BR>\n";
}
print "<HR>";
$query = "SELECT * FROM clients WHERE CUserName = '$CUserName' && CPassword = '$CPassword'";
$result = mysql_query($query);
if(!$result)
{
die("Invalid Username/combo. Try again." .mysql_error());
}
else
{
print "Thanks for logging in.";
}
mysql_close($link);
?>
</body>