//Script PFCC_picks_matrix.php
//September 2007, Justin Weaver, dirty-dawg.com
//
//Script designed to replace original Perl Code
//Perl code was suffering from time accounting and menu problems.
//
?>
dirty-dawg Pro Football Confidence Contest Individual Player Picks
//Load Top Stuff
include("../php_includes/top_menu.inc");
include("../php_includes/dbconnect.inc");
//Read Database to find current week
mysql_select_db("db90397326",$dbcnx);
$sql = "select * from PFCCWeeks ORDER by Deadline DESC";
$result = mysql_query($sql);
$now = date("Y-m-d H:i:s");
$num_rows = mysql_num_rows($result);
while ($row = mysql_fetch_array($result)) {
$endtime = $row["Deadline"];
if ($now > $endtime) {
//Then this is the right week
//echo "Week with deadline of $endtime is the current week
";
$validtime = 1;
$contestyear = $row["Year"];
$contestweek = $row["Week"];
$conteststring = $row["DateString"];
break;
}
}
$CurrentDate = date("l, F j, Y h:i:s A T");
$weeknumb = 0 + $contestweek;
$weekyear = substr($contestyear,2,2);
$sql = "select Members.MemberName as FullName, Members.ID from Members, PFCCPicks$weeknumb$weekyear
where Members.MemberHandle = PFCCPicks$weeknumb$weekyear.MemberHandle";
$result = mysql_query($sql);
$totalplayers = mysql_num_rows($result);
//Begin to generate guts of web page
echo ("
Pro Football Confidence
Contest (PFCC)
Individual Player
Picks $contestyear
Week $contestweek, $conteststring
Total dirty-dawgers this week: $totalplayers
Click on your favorite dirty-dawger
below to get a look at their sorry Pro football picks for this week.
These links are normally updated a few minutes after the weekly deadline.
If your favorite dirty-dawger is you, and you notice an error in your picks as listed
below, please double-check your verification email (you still have it, right?)
. If there is a discrepancy, and you actually think that it is in the
realm of possibility that we made a mistake, you are wrong!
Full Consensus Info
");
//Find Player Names and Alphabetize
while ($row = mysql_fetch_array($result)) {
$FullName = $row["FullName"];
$ID = $row["ID"];
$FullName = ucwords(strtolower($FullName));
$NameParts = explode(" ",$FullName);
$PartCount = sizeof($NameParts);
$LastName = $NameParts[$PartCount-1];
$FirstName =$NameParts[0];
$NameHash["$LastName $FirstName $ID"] = $FullName;
$IDHash["$LastName $FirstName $ID"] = $ID;
}
ksort($NameHash);
ksort($IDHash);
while ($element = each($NameHash)) {
$Players[]=$element["value"];
}
while ($element = each($IDHash)) {
$PlayerID[]=$element["value"];
}
//Now determine how many rows of players using 4 across
$data_rows = $totalplayers/4;
if (($totalplayers % 4) != 0) {
$data_rows++;
}
//Write the table of players
for ($i = 0; $i<$data_rows; ++$i) {
$col1 = $i;
$col2 = $i+$data_rows;
$col3 = $i+($data_rows*2);
$col4 = $i+($data_rows*3);
echo("
| $Players[$col1] |
$Players[$col2] |
$Players[$col3] |
$Players[$col4] |
");
}
echo ("
");
include("../php_includes/footer.inc");