Create("churchil_demo"); echo("

Browse Auctions by Date

\n"); /* Ok, what we're doing here is printing a nice table of the * current month and the following two months. Any time * we've got an auction listed on that date, set up a link * so the user can drill down and view the specifics of that * auction. */ if ($Date) { /* Ok, we were handed in a date. List the auctions * that are occuring on that date. */ $date = date("M d",$Date); echo("

\n"); echo("\n"); echo("\n"); $date1 = date("Y-m-d",$Date); $date2 = date("Y-m-d",($Date+86400)); $sql->Query("select Auctions.ID, Auctions.Name, Locations.City, Locations.State from Auctions, Locations where Auctions.StartTime > \"$date1\" and Auctions.StartTime < \"$date2\" and Auctions.Location = Locations.ID order by Auctions.StartTime"); for ($i = 0; $i < $sql->rows; $i++) { $sql->Fetch($i); $id = $sql->data[0]; $name = $sql->data[1]; $city = $sql->data[2]; $state = $sql->data[3]; echo("\n"); echo(" \n"); } echo("
Auctions on $date
NameLocation
$name$city, $state
\n"); echo("

Select another date

\n"); } else { /* Print out a table showing the next couple of * months. The rest of this month, and the next * two months is what I mean by 'couple'. */ $now = time(); /* Current time in seconds */ $month = date("F",$now); /* Full text of month name */ $day = date("w",$now); /* Numeric day of week */ /* Before we start printing the table, query the database * and figure out what days actually have auctions on them. * Only look about three months into the fugure. */ $future = date("Y-m-d",mktime(0,0,0,(date("m",$now)+3),1,date("Y",$now))); $sql->Query("select StartTime from Auctions where StartTime < \"$future\""); for ($i = 0; $i < $sql->rows; $i++) { $sql->Fetch($i); $date = $sql->data[StartTime]; $date = strtok($date," "); $hasAuction[$date] = 1; } /* Ok, start printing out the table */ echo("

\n"); echo("\n"); echo("\n"); echo(" \n"); echo(""); for ($i = 0; $i < $day; $i++) { echo(""); } $endtime = mktime(0,0,0,(date("m",$now)+3),1,date("Y",$now)); $time = $now; $dow = $day; /* Day of week */ $curr_month = date("m",$now); /* Numeric month */ while ($time < $endtime) { $dow++; if ($curr_month != date("m",$time)) { $curr_month = date("m",$time); for ($i = $dow; $i <= 7; $i++) { echo(""); } echo("\n"); $month = date("F",$time); /* Full text of month name */ echo("\n"); if ($dow != 8) { for ($i = 1; $i < $dow; $i++) { echo(""); } } } if ($dow > 7) { $dow = 1; echo("\n"); } $day = date("d",$time); $date = date("Y-m-d",$time); if ($hasAuction[$date] == 1) { $url = "select-date.php3?Date=$time"; echo("\n"); } else { echo("\n"); } $time += 86400; /* Number of seconds in a day */ } for ($i = $dow; $i < 7; $i++) { echo(""); } echo("
$month
SMTWTFS
  
$month
 
$day$day 
\n"); } include("footer.php3"); ?>