Could someone look this over and tell me what in the hell is wrong with it? I had it working perfectly and then I added sessions and now its gone caput.
I getting this error:
Warning: Supplied argument is not a valid MySQL result resource in /host/d/a/r/p/o/r/dark-storm14.port5.com/login.php on line 18
Plus I'm not sure that my Header() works.
Here it is:
<?php
session_start();
print ("");
print ("<head></head>");
print ("<body bgcolor=\"#000000\" text=\"#ffffff\">");
require ("univvars.php");
if (mysql_connect($Host, $User, $Pass))
{
if (mysql_select_db($DBName, $Link))
{
$Query = "SELECT Username, Rank, Money, Country from users WHERE Username='$Array[Username]' AND Password='$Array[Password]'";
$Result = mysql_query($Query, $Link);
$num = mysql_num_rows($Result);
if ($Submitted)
{
if ($num == 1)
{
$Rank = $Array[Rank];
$Money = $Array[Money];
$Country = $Array[Country];
session_register('Username');
session_register('Rank');
session_register('Money');
session_register('Country');
header("Location: index.php");
}
}
else
{
print ("<td><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\"></td>");
}
}
}
else
{
print ("Could not open page. Please try back later. If problem persists, contact webmaster at soldier_of_rome@hotmail.com.");
}
?>