Hey, I tried connecting to the database...i still get the same error.
I did revise my code tho. I got mad when it wouldn't work, and in my bored madness changed it around and made it nicer to read...lol
Here is my new code...and it still doesn't work:
<?php
//Include the connection variables for this page
require ("univvars.php");
//If script connects to MySQL-
if (mysql_connect($Host, $User, $Pass))
{
//then run this
if (mysql_select_db($DBName, $Link))
{
//define variables if database is selected
$Tablename = "test";
$Query = "SELECT * from $TableName WHERE Username='$Array[Username]' AND Password='$Array[Password]'";
$Result = mysql_query($Query, $Link);
$num = mysql_num_rows($Result);
//If the user has already Submitted his login info
if ($Submitted)
{
//If there is only 1 row that matches Username and password,
if ($num == "1")
{
//login, redirect you to the main page, and stop any other code the script is doing
print ("Login successful, redirecting you to main page...");
header ("Location: index.php");
exit;
}
else
{
//else there is more than 1 row, or less than 1 row. exit script and refuse login
print ("Login unsuccessful, please enter valid username/password combination!");
exit;
}
}
//if the user hasn't entered his login info
else
{
print ("<center><b>Login:</b><br>");
print ("<tabe border=1 width=\"25%\"><form action=\"login.php\" method=POST>");
print ("Username:<br>");
print ("<input type=text name=\"Array[Username]\">");
print ("<p>Password:<br>");
print ("<input type=password name=\"Array[Password]\"><br>");
print ("<input type=hidden name=\"Submitted\" value=\"TRUE\">");
print ("<br><input type=Submit name=\"Submit\" value=\"Submit\">");
}
}
//If the script could not connect to the database
else
{
print ("Could not open page. Please try again later. If problem persists, contact webmaster at soldier_of_rome@hotmail.com!");
}
}
//if the script could not connect to MySQL
else
{
print ("Could not open page. Please try again later. If problem persists, contact webmaster at soldier_of_rome@hotmail.com!");
}
?>
As you can see, I added comments, and got rid of Login(). (just trying functions of for size...)