Didn't really want to post the code, but here it is. Error reporting is set to E_ALL, and the header is near the bottom.
<?php
include("includes/common.php");
if(!checkuser())
{
header("Location: error.php?ec=1");
exit;
}
$title = "<a style=color:white href=menu.php>Main Menu</a> > Add Prize";
include("header.inc.php");
$count = isset($_POST['count']) ? $_POST['count'] : 1;
$submit = isset($_POST['submit']) ? $_POST['submit'] : false;
$winner = isset($_POST['winner']) ? $_POST['winner'] : array();
$bounty = isset($_POST['bounty']) ? $_POST['bounty'] : array();
$tmpbgcolor = $bgcolor1;
if(!$submit)
{
/* The page accessing this page has the choice of adding one prize or multiple
* The following deals with one
*/
if(!$count || $count == 1)
{
?>
Please fill out the following information to add a Prize to the database:
<table border="0" cellspacing="5" cellpadding="5" align="center">
<form action="add.php" method="post">
<tr>
<td>Winner</td>
<td><input type="Text" name="winner[]" size="15"></td>
</tr>
<tr>
<td>Bounty</td>
<td><input type="text" name="bounty[]" size="15"></td>
</tr>
<tr>
<td>Prox</td>
<td><input type="checkbox" name="prox[]"></td>
</tr>
<tr>
<td colspan="2" align="CENTER"><input type="submit" name="submit" value="Add"></td>
</tr>
</form>
</table>
<?php
/* More then one prize */
} else {
?>
Please fill out the following information to add the Prize(s) to the database:
<table border="0" align="center" cellspacing="2" cellpadding="2" width="50%">
<form action="add.php" method="post">
<tr>
<td width="33%" align=center><b>Winner</b></td>
<td width="33%" align=center><b>Bounty</b></td>
<td width="33%" align=center><b>Prox</b></td>
</tr>
<?php
for($i = 0; $i < $count; $i++)
{
?>
<tr bgcolor="<?php echo $tmpbgcolor; ?>">
<td width="33%" align=center><input size="15" type="text" name="winner[]" value=""></td>
<td width="33%" align=center><input size="15" type="text" name="bounty[]" value=""></td>
<td width="33%" align=center><input type="checkbox" name="prox[]"></td>
</tr>
<?php
/* $bgcolor1 and $bgcolor2 is include()'d */
$tmpbgcolor = ($tmpbgcolor == $bgcolor1) ? $bgcolor2 : $bgcolor1;
}
?>
<tr>
<td colspan="3" align="center"><input type="submit" name="submit" value="Add"></td>
</tr>
</form>
</table>
<?php
}
} else {
if(empty($winner) || empty($bounty))
{
header("Location: error.php?ec=3");
exit;
}
$db = new MySQL;
$db->connect($host, $user, $pass, $name, 1);
$date = date("Y-m-d");
for ($x=0; $x<sizeof($winner); $x++)
{
if(empty($winner[$x]) || empty($bounty[$x])) continue;
$tprox = ifOn($prox[$x], 1, 0); /* If $prox[$x] is on, return 1, else, return 0 */
$db->query("INSERT INTO PrizeDB (`Name`, `Bounty`, `Prox`, `Date`, `Host`, `id`) VALUES ('$winner[$x]', '$bounty[$x]', '$tprox', '$date', '".$userinfo['username']."', '')");
$hl[] = $db->insertId; /* Adds the ID to the array, used below */
}
/*Below is the code I would remove when testing, the problem part */
/* ----------------- */
$hl = implode("|", $hl);
header("Location: view.php?hl=$hl"); /* Sends the $hl array seperated by | to the view page to know which prizes to highlight */
exit;
/* ------------------*/
}
include("footer.inc.php");
?>
The ugly column names are not mine, I hate useing them, but this is a Web-Interface for another program. The Forum messed up some of my formatting, sorry about that.