Simple login, not working as intended.
Posted: Sat May 07, 2005 2:02 pm
Hey, I worked on this website a long time ago and I want to show it to a job interview this Thursday. Thing is my login doesn't seem to work exactly how it should. Technically 'it works' but you get these header errors stating that the header already exists.
Can someone offer a remedy so I can show my site without these errors?
Here is my header.php code. If I remove the session_start();, then the errors go away but then you cannot login, or logout.
If I leave the session_start(); in. The login/logout pages work as intended but you get error messages on both the login/logout pages and a constant error message at the top of the webpage.
The username/password for this site is Matthew/12345. So use it to test out what I am talking about.
I hope somebody can help me out. Thanks.
Site>> http://www.matthewcorway.com/bolt3/systems.php (Use top right to login, notice the error at the top of the page.)
Can someone offer a remedy so I can show my site without these errors?
Here is my header.php code. If I remove the session_start();, then the errors go away but then you cannot login, or logout.
If I leave the session_start(); in. The login/logout pages work as intended but you get error messages on both the login/logout pages and a constant error message at the top of the webpage.
The username/password for this site is Matthew/12345. So use it to test out what I am talking about.
I hope somebody can help me out. Thanks.
Site>> http://www.matthewcorway.com/bolt3/systems.php (Use top right to login, notice the error at the top of the page.)
Code: Select all
<?
session_start();
$date=date('F d, Y');
print("<table width=\"778\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td width=\"622\"><table width=\"622\" height=\"185\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td height=\"19\" colspan=\"3\"><table width=\"622\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td background=\"http://www.matthewcorway.com/bolt3/siteimages/header-topleftbar.gif\" height=\"19\"><font color=\"#FFFFFF\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\"><div align=\"right\"><b>$date</b> </div></font></td>
</tr>
</table>
</td>
</tr>
<tr bgcolor=\"#9F9C7E\">
<td width=\"2\" height=\"166\"><img src=\"http://www.matthewcorway.com/bolt3/siteimages/header-barleft.gif\" width=\"2\"></td>
<td width=\"618\" bgcolor=\"#9F9C7E\"><div align=\"center\"><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\"><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"618\" height=\"166\">
<param name=\"movie\" value=\"http://www.matthewcorway.com/bolt3/topbanner.swf\">
<param name=\"quality\" value=\"high\">
<embed src=\"http://www.matthewcorway.com/bolt3/topbanner.swf\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"618\" height=\"166\"></embed></object></font></div></td>
<td width=\"2\"><img src=\"http://www.matthewcorway.com/bolt3/siteimages/header-barright.gif\" width=\"2\"></td>
</tr>
</table></td>
<td width=\"4\"><img src=\"http://www.matthewcorway.com/bolt3/siteimages/header-connecters.jpg\" width=\"4\"></td>
<td width=\"153\"><table width=\"152\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td colspan=\"3\"><img src=\"http://www.matthewcorway.com/bolt3/siteimages/header-toprightUP.jpg\" width=\"152\" height=\"19\"></td>
</tr>
<tr bgcolor=\"#9F9C7E\">
<td width=\"2\"><img src=\"http://www.matthewcorway.com/bolt3/siteimages/header-barleft.gif\" width=\"2\"></td>
<td width=\"149\">");
if (($_SESSION['logged'] == 1) || ($_COOKIE['logged'] == 1)){
print("<table width=\"148\" height=\"162\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#9F9C7E\">
<tr>
<td>");
$query = "SELECT * FROM members where username='".$_SESSION['user']."' OR username='".$_COOKIE['user']."'";
$mysql_stuff = mysql_query($query, $mysql_link);
while($roc = mysql_fetch_row($mysql_stuff)){
$usern = $roc[1];
$factionID = $roc[5];
$avatar = $roc[13];
$rubix = $roc[14];
$HP = $roc[24];
$HPtotal = $roc[25];
$MP = $roc[26];
}
$HPper = (($HP/$HPtotal) * 100);
$query = "SELECT * FROM factions where factionID='$factionID'";
$mysql_stuff = mysql_query($query, $mysql_link);
while($roc = mysql_fetch_row($mysql_stuff)){
$factionbanner = $roc[2];
}
print("<table width=\"144\" height=\"162\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#9F9C7E\">
<tr>
<td height=\"14\">
<div align=\"center\">
<table width=\"140\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td width=\"96\"><div align=\"center\"><img src=\"$factionbanner\" width=\"98\" height=\"12\"></div></td>
<td width=\"44\" bgcolor=\"#B3B08E\">
<div align=\"center\"><font color=\"#FFFFFF\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">edit</font></div></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td bgcolor=\"#DAD6B0\">
<div align=\"center\"><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\">");
if (($HPper > 0) && ($HPper < 11)){
print("<img src=\"http://www.matthewcorway.com/bolt3/siteimages/HP-10.gif\" width=\"100\" height=\"10\" alt=\"$HPper %\">");
} elseif (($HPper > 11) && ($HPper < 21)){
print("<img src=\"http://www.matthewcorway.com/bolt3/siteimages/HP-20.gif\" width=\"100\" height=\"10\" alt=\"$HPper %\">");
} elseif (($HPper > 21) && ($HPper < 31)){
print("<img src=\"http://www.matthewcorway.com/bolt3/siteimages/HP-30.gif\" width=\"100\" height=\"10\" alt=\"$HPper %\">");
} elseif (($HPper > 31) && ($HPper < 41)){
print("<img src=\"http://www.matthewcorway.com/bolt3/siteimages/HP-40.gif\" width=\"100\" height=\"10\" alt=\"$HPper %\">");
} elseif (($HPper > 41) && ($HPper < 51)){
print("<img src=\"http://www.matthewcorway.com/bolt3/siteimages/HP-50.gif\" width=\"100\" height=\"10\" alt=\"$HPper %\">");
} elseif (($HPper > 51) && ($HPper < 61)){
print("<img src=\"http://www.matthewcorway.com/bolt3/siteimages/HP-60.gif\" width=\"100\" height=\"10\" alt=\"$HPper %\">");
} elseif (($HPper > 61) && ($HPper < 71)){
print("<img src=\"http://www.matthewcorway.com/bolt3/siteimages/HP-70.gif\" width=\"100\" height=\"10\" alt=\"$HPper %\">");
} elseif (($HPper > 71) && ($HPper < 81)){
print("<img src=\"http://www.matthewcorway.com/bolt3/siteimages/HP-80.gif\" width=\"100\" height=\"10\" alt=\"$HPper %\">");
} elseif (($HPper > 81) && ($HPper < 91)){
print("<img src=\"http://www.matthewcorway.com/bolt3/siteimages/HP-90.gif\" width=\"100\" height=\"10\" alt=\"$HPper %\">");
} elseif ($HPper == 0){
print("<img src=\"http://www.matthewcorway.com/bolt3/siteimages/HP-0.gif\" width=\"100\" height=\"10\" alt=\"$HPper %\">");
} else {
print("<img src=\"http://www.matthewcorway.com/bolt3/siteimages/HP-100.gif\" width=\"100\" height=\"10\" alt=\"$HPper %\">");
}
print("</font></div></td>
</tr>
<tr>
<td height=\"2\" bgcolor=\"#DAD6B0\">
<div align=\"center\">
<table width=\"140\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td width=\"70\"><div align=\"center\"><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\">");
if ($MP == 1){
print("<img src=\"http://www.matthewcorway.com/bolt3/siteimages/MP-1.gif\" width=\"73\" height=\"16\">");
} elseif ($MP == 2){
print("<img src=\"http://www.matthewcorway.com/bolt3/siteimages/MP-2.gif\" width=\"73\" height=\"16\">");
} else {
print("<img src=\"http://www.matthewcorway.com/bolt3/siteimages/MP-3.gif\" width=\"73\" height=\"16\">");
}
print("</font></div></td>
<td width=\"70\"><div align=\"center\"><font size=\"2\" color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\"><img src=\"http://www.matthewcorway.com/bolt3/siteimages/rubixicon.gif\" width=\"16\" height=\"10\">
$rubix</font></div></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td height=\"60\" bgcolor=\"#9F9C7E\"> <div align=\"center\"><img src=\"$avatar\" width=\"140\" height=\"60\"></div></td>
</tr>
<tr>
<td bgcolor=\"#DAD6B0\">
<div align=\"center\"><font size=\"2\" color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\"><strong>$usern</strong><br>
</font></div></td>
</tr>
<tr>
<td height=\"18\" bgcolor=\"#DAD6B0\">
<div align=\"center\"><font size=\"2\" color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">view
submissions</font></div></td>
</tr>
<tr>
<form action=\"http://www.matthewcorway.com/bolt3/logout.php\" method=\"POST\" name=\"logout\">
<td height=\"18\" bgcolor=\"#B3B08E\">
<div align=\"center\"><font color=\"#FFFFFF\" size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\"><input type=\"hidden\" name=\"submitt\" value=\"logout\"><input type=\"hidden\" name=\"from\" value=\"$_SERVER[REQUEST_URI]\"><a href=\"javascript:document.logout.submit()\" onMouseOver=\"status=''; return true\"><img src=\"http://www.matthewcorway.com/bolt3/siteimages/logout.gif\" border=\"0\"></a></font></div>
</td>
</form>
</tr>
</table>
</td>
</tr>
</table>");
} else {
print("<table width=\"148\" height=\"162\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#9F9C7E\">
<tr>
<td>
<form action=\"http://www.matthewcorway.com/bolt3/login.php\" method=\"POST\">");
print("<font color=\"#FFFFFF\" size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\"><div align=\"center\">Username: <input type=\"text\" name=\"user\" class=\"form\"><br>
Password: <input type=\"password\" name=\"pass\" class=\"form\"><br>
Stay logged in? </font><input type=\"checkbox\" name=\"stay_logged\" class=\"form\"><br>
<input type=\"hidden\" name=\"from\" value=\"$_SERVER[REQUEST_URI]\"><br>
<input type=\"submit\" name=\"Submit\" value=\"Login\" class=\"submitbutton\"></div></form>
</td>
</tr>
</table>");
}
print("</td>
<td width=\"2\"><img src=\"http://www.matthewcorway.com/bolt3/siteimages/header-barright.gif\" width=\"2\" height=\"166\"></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan=\"3\"><table width=\"778\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td width=\"86\" background=\"http://www.matthewcorway.com/bolt3/siteimages/header-bottombar.gif\" height=\"19\">
<table width=\"778\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td width=\"100\">
<table>
<form action=\"http://www.matthewcorway.com/bolt3/systems.php\" method=\"GET\" name=\"systemsearch\">
<tr>
<td><select name=\"system_ID\" class=\"headerform\" value=\"system_ID\">
<option value=\"\" selected>Pick a System</option>");
$query = "SELECT * FROM systems";
$mysql_stuff = mysql_query($query, $mysql_link);
while($roc = mysql_fetch_row($mysql_stuff)){
$system_ID = $roc[0];
$system_name = $roc[1];
print("<option value=\"$system_ID\">$system_name</option>");
}
print("</select></td>
<td valign=\"middle\"><a href=\"javascript:document.systemsearch.submit()\" onMouseOver=\"status=''; return true\"><img src=\"http://www.matthewcorway.com/bolt3/siteimages/gobutton.gif\" border=\"0\"></a></td>
</tr>
</form>
</table>
</td>
<td><div align=\"center\"><font color=\"#FFFFFF\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\"><b><a class=\"header\" href=\"http://www.matthewcorway.com/bolt3/registration/page1.php\">Register</a> || Cartoons | <a class=\"header\" href=\"http://www.matthewcorway.com/bolt3/top250.php\">Top 250 Chart</a> | Extra | Links | About | Donate</b></font></div></td>
<td width=\"100\"><div align=\"right\"><table><form name=\"searchform\" action=\"http://www.matthewcorway.com/bolt3/search.php\" method=\"GET\"><tr><td><div align=\"right\"><input type=\"text\" value=\"Search by Game\" name=\"searchstring\" class=\"headerform\" onClick=\"javascript:document.all.searchform.searchstring.value=''\"></td><td valign=\"middle\"><a href=\"javascript:document.searchform.submit()\" onMouseOver=\"status=''; return true\"><img src=\"http://www.matthewcorway.com/bolt3/siteimages/gobutton.gif\" border=\"0\"></a></div></td></tr></form></table></div></td>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>
</table>");
?>