I am getting a severe headache with this. I cannot figure out why it is denying everyone! It says wrong username. I wrote most of it myself but it still doesnt work. Can someone take a look at it and let me know what this newbie (Trying to go pro) is doing wrong? Thanks! My code is posted below. Just the important parts. Thanks!
Chad
---Login.php----
<?php
include("header.inc");
?>
<?php
function print_form() {
?>
<tr>
<td width="100%" height="551" colspan="2" valign="top">
<table border="0" width="100%" height="396" cellspacing="0" cellpadding="0">
<tr>
<td width="1%" bgcolor="#CC0000" rowspan="3" height="396"> </td>
<td width="98%" valign="top" height="198">
<form method="POST" action="login.php">
<table border="0" width="100%" height="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" height="17" colspan="2" bgcolor="#FFFFCC">
<p align="center"><b><font size="4">:: Login ::</font></b></td>
</tr>
<tr>
<td width="100%" height="8" colspan="2" bgcolor="#FFFFCC"><b>To
Login you need to choose your business name to the left then
you type in the Username and Password. It is CaSe
SenSative</b></td>
</tr>
<tr>
<td width="38%" height="320" rowspan="3" valign="top" bgcolor="#3399FF"><br>
<select size="23" name="businessname1">
<?php
$db = mysql_connect("localhost");
mysql_select_db("saintparis", $db);
$sql = "select * from general";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
printf("<option value='%s'>%s</option>\n",$row["bus_name"],$row["bus_name"]);
}
?>
</select></td>
<td width="62%" height="1" bgcolor="#66CCFF"><b>Username:<input type="text" name="username1" size="36"></b></td>
</tr>
<tr>
<td width="62%" height="1" bgcolor="#66CCFF"><b>Password:<input type="password" name="password1" size="37"></b></td>
</tr>
<tr>
<td width="62%" height="316" valign="top" bgcolor="#FFFFCC"><input type="submit" value="Login" name="submitlogin"></td>
</tr>
</table>
</form>
<p>
</td>
<td width="1%" bgcolor="#CC0000" rowspan="3" height="396"> </td>
</tr>
<tr>
<td width="98%" valign="top" height="7" bgcolor="#CC0000"> </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
<?php
}
if(isset($submitlogin)):
if(!$db = mysql_connect("localhost")):
print("<h1>Can't Connect to the DB!</h1>\n");
else:
mysql_select_db("saintparis", $db);
endif;
$sql = "select * from general where bus_name = '$businessname1'";
$result = mysql_query($sql);
$row_count = mysql_num_rows($result);
if('$username1' != $row["username"]):
?>
<h3>Wrong User Name! Try Again</h3>
<?
print_form();
else:
$row = mysql_fetch_array($result);
if('password1' != $row["password"]):
?>
<h3>Incorrect Password! Try Again</h3>
<?
print_form();
else:
After that else: is all my actual page stuff... and the endif's and all that are set correctly. It has to be in the part I showed. Thank you very much who can figure this one out! I know someone can...cause you guys/gals are the best!
----End Login.php----