I have been looking at this code for hours and I can't find what I have done wrong. Its says parse error on line 359..which is the very last line...please help!
<?php
if(!isset($mainfile)) { include("mainfile.php"); }
if (!isset($config)) { include("config.php"); }
include ('header.php');
include("conn.php3");
include("login.php3");
include("config.ini");
include("funcs.php3");
?>
<head>
</head>
<body bgcolor="#FFFFFF">
<center>
<table border=0 cellspacing=0 cellpadding=0 bgcolor="#FFFFFF" width="80%"><tr><td>
<table border=0 cellspacing=0 cellpadding=4 bgcolor="#FFFFFF" width="100%">
<?
function unitbidding() {
if(isset($bid_button)) {
if(isset($bid_button)) {
$num_bids = $num_bids + 1;
}
// tests is person is bidding against him/herself
if($seller == "$cookie[1]") {
echo "<tr><td>You cannot bid against yourself. Shill bidding is against
auction rules.</td></tr></table></td></tr></table>";
die();
}
// tests for only numbers in new bid
if(!eregi("([0-9-]$)",$bid)) {
echo "<tr><td>Your bid must be a number.
<br><i>Example: 1.00 for one-dollar.</i></td></tr>
</table></td></tr></table>";
die();
}
// tests if the new bid is less than the old bid
if($bid <= $start_bid) {
echo "<tr><td>Your bid cannot be less than or equal to the starting bid.
Please use the back button on your browser to make a higher
bid.</td></tr></table></td></tr></table>";
die();
}
if($old_bid == NULL) { stop; }
elseif($bid <= $old_bid) {
echo "<tr><td>Your bid cannot be less than or equal to the current bid.
Please use the back button on your browser to make a higher
bid.</td></tr></table></td></tr></table>";
die();
}
if($old_bid == 0) {
echo "Something's fishy around here, this case should never happend.
</td></tr></table></td></tr></table>";
die();
}
$new = $increment + $old_bid;
if(isset($bid_button)) {
if($bid != $new) {
echo "<tr><td>Your bid must be incremented by the amount shown
(\$$increment). Use the back button on your browser to enter a new
bid.</td></tr></table></td></tr></table>";
die();
}
}
$query = mysql_query("select current_bid_uid from products where(pid = '$pid')");
list($cuid) = mysql_fetch_row($query);
$query = mysql_query("select uname,email from users where(uid = '$cuid')");
while(list($uname,$email) = mysql_fetch_row($query)) {
if($uname == "$cookie[1]") {
echo "<tr><td>You already have the highest current bid. There is no need
to bid against yourself. Please use the back button on your browser to
select another product.</td></tr></table></td></tr></table>";
die();
}
}
$query = mysql_query("select uid from users where(uname = '$store_user_cookie')");
list($userid) = mysql_fetch_row($query);
if(isset($bid_button)) {
$pay1 = mysql_query("select paymentmethod, unit_bid from products where pid = $pid");
if(mysql_num_rows($pay1)==1) {
$setinfo = mysql_fetch_array($pay1);
$pm=$setinfo[paymentmethod];
$unit_bid=$setinfo[unit_bid];}
$pay0 = mysql_query("select payid, payamount, payname, conversion from paymethods WHERE payid = $pm");
if(mysql_num_rows($pay0)==1) {
$setinfo = mysql_fetch_array($pay0);
$payid=$setinfo[payid];
$payamount=$setinfo[payamount];
$payname=$setinfo[payname];
$conversion=$setinfo[conversion];}
$place = $old_bid + $increment;
$current_bid = $place*$conversion;
$query = mysql_query("update products set num_bids = '$num_bids' where (pid = '$pid')");
$query = mysql_query("update products set unit_bid = '$bid' where (pid = '$pid')");
$query = mysql_query("update products set current_bid_uid = '$userid' where (pid = '$pid')");
$query = mysql_query("update products set current_bid = '$current_bid' where (pid = '$pid')");
$query = mysql_query("update products set paymentmethod = '$paymentmethod' where (pid = '$pid')");
echo "<tr><td>Thank you for your submission.</td></tr></table></td></tr></table>";
die();
}
}
$result = mysql_query("select name,
category,
description,
quantity,
start_bid,
current_bid,
num_bids,
location,
country,
DATE_FORMAT(starts,'%W, %M %D, %Y'),
DATE_FORMAT(ends,'%W, %M %D, %Y'),
starts,
ends,
seller,
payment,
picture,
featured,
pid,
increment,
forum,
thread,
paymethods1,
paymethods2,
paymethods3,
combo,
paymentmethod,
payname1,
payname2,
payname3
unit_bid from products where(pid = '$pid')");
while(list($name,$category,$description,$quantity,$start_bid, $current_bid,$num_bids,$location, $country,$starts,$ends,$alt_starts,$alt_ends,$seller,$payment,$picture,$featured,$pid,$increment,$forum,$thread,$paymethods1,$paymethods2,$paymethods3,$combo,$paymentmethod,$payname1,$payname2,$payname3,$unit_bid)
= mysql_fetch_row($result)){
if($num_bids == '0') {
$num_bids = '-';
}
$cat = urlencode($category);
echo "<tr bgcolor=\"$main_color\"><td colspan=5 valign=top align=center><font size=2
face=Verdana,Arial,Helvetica color=#FFFFFF>$name Item
#$pid</font></td></tr>
<tr bgcolor=#FFFFFF><td colspan=5 valign=top align=center>
<a href=\"view.php3?category=$cat\">$category </td></tr>";
// get the necessary month, day, year, to feed to mktime (start & end time)
$smonth = substr("$alt_starts",5,-12);
$sday = substr("$alt_starts",8,-9);
$syear = substr("$alt_starts",0,4);
$emonth = substr("$alt_ends",5,-12);
$eday = substr("$alt_ends",8,-9);
$eyear = substr("$alt_ends",0,4);
// determine if the date is valid
if(mktime(0,0,0,date("m"),date("d"),date("Y")) < mktime(0,0,0,$smonth,$sday,$syear) ||
mktime(0,0,0,date("m"),date("d"),date("Y")) >= mktime(0,0,0,$emonth,$eday,$eyear)) {
echo "</table></td></tr></table><font size=+2>This product is not
up for auction now.</font>";
die();
}
echo "<tr><td align=center colspan=1>Starting
Bid: <td><td>$start_bid</td><td>#
bids: </td><td>$num_bids</td></tr>";
// date subtraction -- took 2 days for me to get it just right 🙂
$diff =mktime(0,0,0,$emonth,$eday,$eyear) -
mktime(0,0,0,date("m"),date("d"),date("Y"));
$difference = abs($diff/86400);
$query = mysql_query("select forum, thread from products where pid = '$pid'");
if(mysql_num_rows($query)==1) {
$setinfo = mysql_fetch_array($query);
$forum=$setinfo[forum];
$thread=$setinfo[thread];}
if($forum == "Y") { $fanswer = "<a href=http://www.easyrewards.com/read.php?f=4&i=1&t=$thread>yes</a>";}
if($forum == "N") { $fanswer = "no"; }
echo "
<tr><td align=center colspan=2>
Quantity: </td><td>$quantity</td>
<td>Forum?</td><td>$fanswer</td></tr>
<tr><td align=center colspan=2>Time Left: </td><td>
~$difference days
</td>
<td>Location: </td><td>$location</td>
</tr>
<tr><td align=center colspan=2>Starts: </td><td>$starts</td></tr>
<tr><td align=center colspan=2>Ends: </td><td>$ends</td></tr>
<tr><td align=center colspan=2>Seller: </td><td>";
$query = mysql_query("select uid from users where(uname = '$cookie[1]')");
while(list($uid) = mysql_fetch_row($query)) {
echo "<form method=post action=\"$PHP_SELF\">
<input type=hidden name=\"current_bid_uid\" value=\"$uid\">";
}
// resolve uid into more useful username
$query = mysql_query("select uname,email from users where(uid = '$seller')");
while(list($uname,$email) = mysql_fetch_row($query)) {
echo " <a href=\"user.php?op=userinfo&uname=$uname\">$uname</a> <font size=1>(<a href=\"mailto:$email\">email seller</a></font>) </td></tr>
<input type=hidden name=\"seller\" value=\"$uname\">";
}
echo "<tr><td align=center>Payment<br>Shipping</td><td colspan=3>$payment</td></tr>
<input type=hidden name=\"start_bid\" value=\"$start_bid\">
<tr bgcolor=\"$main_color\"><td colspan=5 valign=top align=center>
<a target=\"description\"><font size=2 face=Verdana,Arial,Helvetica color=#FFFFFF>DESCRIPTION</font></a></td></tr>
<tr><td colspan=5 valign=top align=center><blockquote>$description</blockquote></td></tr>
<tr bgcolor=\"$main_color\"><td colspan=5 valign=top align=center>
<a target=\"bidding\"><font size=2
face=Verdana,Arial,Helvetica color=#FFFFFF>BIDDING</font></a></td></tr>
<tr><td colspan=4 valign=top>$name (Item
#$pid)</td></tr>
<tr><td colspan=4 valign=top>
<!-- Bidding Table -->
<table border=0>
<tr><td>Quantity you are bidding for
<select name=\"quantity\">";
$select = mysql_query("select num_bids,quantity from products where(pid = '$pid')");
$select = mysql_fetch_row($select);
for($i=1; $i<=$select[1]; $i++) {
echo "<option value=\"$i\">$i</option></select><p>Accepted Payment Methods<br>(<i>please choose one</i>)<br><select name=\"paymentmethod\">";
}
if($paymethods1 == "") {echo "";}
if($paymethods1 != "") {
$pay0 = mysql_query("select payid, payamount, payname, conversion from paymethods WHERE payid = $paymethods1");
while(list($payid, $payamount, $payname, $conversion) = mysql_fetch_row($pay0))
echo "<option value=\"$payid\">$payamount $payname ($conversion cash)</option>"; }
if($paymethods2 == "") {echo ""; }
if ($paymethods2 != "") {
$pay0 = mysql_query("select payid, payamount, payname, conversion from paymethods WHERE payid = $paymethods2");
while(list($payid, $payamount, $payname, $conversion) = mysql_fetch_row($pay0))
echo "<option value=\"$payid\">$payamount $payname ($conversion cash)</option>"; }
if($paymethods3 == "") {echo ""; }
if ($paymethods3 != "") {
$pay0 = mysql_query("select payid, payamount, payname, conversion from paymethods WHERE payid = $paymethods3");
while(list($payid, $payamount, $payname, $conversion) = mysql_fetch_row($pay0))
echo "<option value=\"$payid\">$payamount $payname ($conversion cash)</option>"; }
echo "</select></td></tr><input type=hidden name=\"num_bids\" value=\"$num_bids\"><tr><td><br>";
$pay1 = mysql_query("select paymentmethod, unit_bid from products where pid = $pid");
if(mysql_num_rows($pay1)==1) {
$setinfo = mysql_fetch_array($pay1);
$pm=$setinfo[paymentmethod];
$unit_bid=$setinfo[unit_bid];}
if($current_bid == 0) { $current_bid = "0";
echo "There are no bids on this item yet."; }
if($current_bid == NULL) {$current_bid = "0";
echo "There are no bids on this item yet."; }
else { if($pm == "") { $pm = "";}
else {$pay0 = mysql_query("select payid, payamount, payname, conversion from paymethods WHERE payid = $pm");
if(mysql_num_rows($pay0)==1) {
$setinfo=mysql_fetch_array($pay0);
$payid=$setinfo[payid];
$payamount=$setinfo[payamount];
$payname=$setinfo[payname];
$conversion=$setinfo[conversion];
}
$coo = $unit_bid$payamount;
$current_bid = $unit_bid$conversion;
echo "<i>Current bid is $coo $payname/$current_bid cash ($unit_bid units)</i>";
}
}
$newvalue = $increment + $unit_bid;
$pay1 = mysql_query("select paymentmethod from products WHERE pid = $pid");
while(list($paymentmethod) = mysql_fetch_row($pay1))
$pay0 = mysql_query("select payid, payamount, payname, conversion from paymethods WHERE payid = $paymentmethod");
if(mysql_num_rows($pay0)==1) {
$setinfo = mysql_fetch_array($pay0);
$payid=$setinfo[payid];
$payamount=$setinfo[payamount];
$payname=$setinfo[payname];
$conversion=$setinfo[conversion];
}
$hold1 = $newvalue$payamount;
$goo1 = "$hold1 $payname";
$hold2 = $newvalue$conversion;
$goo2 = "$hold2 cash";
echo "<br><i>Bid Increment is $increment</i><br><b><font size=-1> next valid bid is $newvalue units ($goo1/$goo2)</font></b><br>
<input type=text name=\"bid\" size=20><br>
<input type=hidden name=\"pid\" value=\"$pid\">
<input type=hidden name=\"old_bid\" value=\"$unit_bid\">
<input type=hidden name=\"increment\" value=\"$increment\">
<br><input type=submit name=\"bid_button\" value=\"Commit Bid\"></td></tr>
</table></form></center>
</td><td>
<table border=0>
<tr><td>
<center>How to Bid</center> <br><br>
<ol><li><a href=\"user.php\">Register</a>.
You need to have a valid easyrewards account to bid on items.</li>
<li><a href=\"comments.php3?uid=$seller\">Read</a> what other people have to say about the
seller.</li>
<li>Read and understand the payment options and restrictions.</li>
<li>Contact seller if you have any questions.</li>
<li>Place your bid.</li>
</ol>
</td></tr>
</table>
</td></tr>";
?>
</table>
</td></tr></table>
<? include ("footer.inc");
include("footer.php"); ?>
}
function offerbidding(){
<?
if(!isset($mainfile)) { include("mainfile.php"); }
if (!isset($config)) { include("config.php"); }
include ('header.php');
include("conn.php3");
include("login.php3");
include("config.ini");
include("funcs.php3");
echo "<b>free</b>";
include ("footer.inc");
include ("footer.php");
?>
}
<?
$query = mysql_query("select forum, thread from products where pid = '$pid'");
if(mysql_num_rows($query)==1) {
$setinfo = mysql_fetch_array($query);
$forum=$setinfo[forum];
$thread=$setinfo[thread];}
if($forum == "N") {unitbidding();}
if($forum == "Y") {offerbidding();}
?>