| 15 | //* Show current game status from currentscores table. * | = | 15 | //* Show current game status from currentscores table. * |
| 16 | //*************************************************************************** | 16 | //*************************************************************************** | |
| 17 | $subtitle="Game Status View"; | 17 | $subtitle="Game Status View"; | |
| 18 | $metaflag="1"; | 18 | $metaflag="1"; | |
| 19 | require("protect.php"); | 19 | require("protect.php"); | |
| 20 | require("header.php"); | 20 | require("header.php"); | |
| 21 | // Check to see if currentscores table exists if not create it. | <> | ||
| 22 | $sql="show tables like '".$football->prefix."currentscores'"; | |||
| 23 | $result = $football->dbQuery($sql) or die( $sql . mysql_error() ); | |||
| 24 | while($row = mysql_fetch_array($result)) { | |||
| 25 | if ($row[0] != $football->prefix."currentscores") { | |||
| 26 | //if (@mysql_num_rows($result) == 0) { // table missing create a new one | |||
| 27 | require ("currentscorescre.php"); | |||
| 28 | } | |||
| 29 | } | 21 | ||
| 30 | // Get teams information for display | = | 22 | // Get teams information for display |
| 31 | $sql="select ".$football->prefix."currentscores.*, ".$football->prefix."teams.city as VCity, ".$football->prefix."teams.name as VName, ".$football->prefix."teams.display as VDisplayName, ".$football->prefix."teams.icon as Vicon, teams2.city as HCity,teams2.name as HName, teams2.display as HDisplayName , teams2.icon as Hicon from (".$football->prefix."currentscores inner join ".$football->prefix."teams on ".$football->prefix."currentscores.vid = ".$football->prefix."teams.id) | <> | 23 | $sql="select ".$football->prefix."currentscores.*, ".$football->prefix."teams.city as VCity, ".$football->prefix."teams.name as VName, ".$football->prefix."teams.display as VDisplayName, ".$football->prefix."teams.icon as Vicon, teams2.city as HCity,teams2.name as HName, teams2.display as HDisplayName , teams2.icon as Hicon from (".$football->prefix."currentscores inner join ".$football->prefix."teams on ".$football->prefix."currentscores.vid = ".$football->prefix."teams.id) |
| 32 | inner join ".$football->prefix."teams as teams2 on ".$football->prefix."currentscores.hid = teams2.id order by ".$football->prefix."currentscores.gametime, ".$football->prefix."currentscores.gameid"; | = | 24 | inner join ".$football->prefix."teams as teams2 on ".$football->prefix."currentscores.hid = teams2.id order by ".$football->prefix."currentscores.gametime, ".$football->prefix."currentscores.gameid"; |
| 33 | $rs = $football->dbQuery($sql); | 25 | $rs = $football->dbQuery($sql); | |
| 34 | $getpick = $football->GetPick($_SESSION['user']); | 26 | $getpick = $football->GetPick($_SESSION['user']); | |
| 35 | $n = 0; | 27 | $n = 0; | |
| 36 | while($row = mysql_fetch_object($rs)) | 28 | while($row = mysql_fetch_object($rs)) | |
| 37 | { | 29 | { | |
| 38 | $updatetime = date("D M d g:i a",$row->lastck); | 30 | $updatetime = date("D M d g:i a",$row->lastck); | |
| 39 | $finalstatus = false; | 31 | $finalstatus = false; | |
| 40 | $gameid = $row->gameid; | +- | ||
| 41 | $game = $row->game; | = | 32 | $game = $row->game; |
| 42 | $week = $row->week; | 33 | $week = $row->week; | |
| 43 | $spread = $row->spread; | 34 | $spread = $row->spread; | |
| 44 | $sresults = ""; | +- | ||
| 45 | if ($row->VDisplayName != "") { | = | 35 | if ($row->VDisplayName != "") { |
| 46 | $visitor = $row->VDisplayName; | 36 | $visitor = $row->VDisplayName; | |
| 47 | } | 37 | } | |
| 48 | else { | 38 | else { | |
| 49 | $visitor = $row->VCity; | 39 | $visitor = $row->VCity; | |
| 50 | } | 40 | } | |
| 66 | $ot = $row->ot; | = | 56 | $ot = $row->ot; |
| 67 | if ($status == ""){ | 57 | if ($status == ""){ | |
| 68 | $status = "Stat n/a"; | 58 | $status = "Stat n/a"; | |
| 69 | } | 59 | } | |
| 70 | if ($status == "Final" or $status == "OT Final"){ | 60 | if ($status == "Final" or $status == "OT Final"){ | |
| 71 | $finalstatus = true; | 61 | $finalstatus = true; | |
| 72 | if ($hscore > $vscore) { | <> | ||
| 73 | $winner = $hid; | |||
| 74 | } else { | |||
| 75 | $winner = $vid; | |||
| 76 | } | |||
| 77 | // $winner = ""; | 62 | $winner = ""; | |
| 78 | $sresults = ""; | |||
| 79 | $sresults = $football->getSpreadResults($vid,$hid,$vscore,$hscore,$spread,$winner); | |||
| 80 | } | = | 63 | } |
| 81 | if ($finalstatus == false) { | 64 | if ($finalstatus == false) { | |
| 82 | $ot = "n/a"; | 65 | $ot = "n/a"; | |
| 83 | // $visitor = $row->VCity; | 66 | // $visitor = $row->VCity; | |
| 84 | // $home = $row->HCity; | 67 | // $home = $row->HCity; | |
| 85 | $hscore = $row->hscore; | 68 | $hscore = $row->hscore; | |
| 86 | $vscore = $row->vscore; | 69 | $vscore = $row->vscore; | |
| 87 | } | 70 | } | |
| 88 | elseif($vscore > $hscore) | 71 | elseif($vscore > $hscore) | |
| 89 | { | 72 | { | |
| 90 | // $sresults = $football->getSpreadResults($vid,$hid,$vscore,$hscore,$spread,$finalstatus); | <> | 73 | $sresults = $football->getSpreadResults($vid,$hid,$vscore,$hscore,$spread,$vid); |
| 91 | $visitor = "<strong><font color=\"#009900\">".$visitor."</font></strong>"; | = | 74 | $visitor = "<strong><font color=\"#009900\">".$visitor."</font></strong>"; |
| 92 | $vscore = "<strong>".$vscore."</strong>"; | 75 | $vscore = "<strong>".$vscore."</strong>"; | |
| 93 | $winner = $vid; | 76 | $winner = $vid; | |
| 94 | } | 77 | } | |
| 95 | else | 78 | else | |
| 96 | { | 79 | { | |
| 97 | // $sresults = $football->getSpreadResults($vid,$hid,$vscore,$hscore,$spread,$finalstatus); | <> | 80 | $sresults = $football->getSpreadResults($vid,$hid,$vscore,$hscore,$spread,$hid); |
| 98 | $home = "<strong><font color=\"#009900\">".$home."</font></strong>"; | = | 81 | $home = "<strong><font color=\"#009900\">".$home."</font></strong>"; |
| 99 | $hscore = "<strong>".$hscore."</strong>"; | 82 | $hscore = "<strong>".$hscore."</strong>"; | |
| 100 | } | 83 | } | |
| 101 | $pick= $getpick[$row->gameid]; | 84 | $pick= $getpick[$row->gameid]; | |
| 102 | if ($pick == $row->vid) { | 85 | if ($pick == $row->vid) { | |
| 103 | $visitor = "<i>".$visitor."</i>"; | 86 | $visitor = "<i>".$visitor."</i>"; | |
| 105 | elseif($pick == $row->hid) { | = | 88 | elseif($pick == $row->hid) { |
| 106 | $home = "<i>".$home."</i>"; | 89 | $home = "<i>".$home."</i>"; | |
| 107 | } | 90 | } | |
| 108 | $hid = $row->hid; | 91 | $hid = $row->hid; | |
| 109 | $date = date("m/d/Y",$row->gametime); | 92 | $date = date("m/d/Y",$row->gametime); | |
| 110 | $time = date("H:i:s A",$row->gametime); | 93 | $time = date("H:i:s A",$row->gametime); | |
| 111 | $gamedate = $football->doDate($date,$time,$football->game_display_offset); | <> | 94 | $gamedate = $football->doDate($date,$time,$football->display_offset); |
| 112 | = | 95 | ||
| 113 | if ($n == 0) { | 96 | if ($n == 0) { | |
| 114 | ?> | 97 | ?> | |
| 115 | <table class="main" cellpadding="0" cellspacing="0"> | 98 | <table class="main" cellpadding="0" cellspacing="0"> | |
| 116 | <tr> | 99 | <tr> | |
| 117 | <th align="left" colspan="13">Week <?php echo $week; ?> Status Updated every 5 minutes on game day. Current Status as of <?php echo $updatetime; ?></th> | 100 | <th align="left" colspan="13">Week <?php echo $week; ?> Status Updated every 5 minutes on game day. Current Status as of <?php echo $updatetime; ?></th> | |
| 157 | else { $visitordisplay = $visitor; } | = | 140 | else { $visitordisplay = $visitor; } |
| 158 | ?> | 141 | ?> | |
| 159 | <td> | 142 | <td> | |
| 160 | <? | 143 | <? | |
| 161 | 144 | |||
| 162 | echo $visitordisplay; echo $football->getTeamStats($vid); | 145 | echo $visitordisplay; echo $football->getTeamStats($vid); | |
| 163 | if ($football->usespread=="Y") { | <> | ||
| 164 | if ($sresults == $vid and $vid != $winner){ echo "<image src=./images/win.gif height=\"20\">"; }?> | 146 | if ($sresults == $vid and $vid != $winner){ echo "<image src=./images/win.gif height=\"20\">"; }?></td> | |
| 165 | <? } ?> | |||
| 166 | </td> | |||
| 167 | <td><image src = ./images/<? echo $vicon; ?> width=<? echo $football->logo_width; ?>></td> | = | 147 | <td><image src = ./images/<? echo $vicon; ?> width=<? echo $football->logo_width; ?>></td> |
| 168 | <? if ($spread > 0 and $football->usespread =="Y") { | 148 | <? if ($spread > 0 and $football->usespread =="Y") { | |
| 169 | $homedisplay = "<u>"; | 149 | $homedisplay = "<u>"; | |
| 170 | $homedisplay .= $home; | 150 | $homedisplay .= $home; | |
| 171 | $homedisplay .= "</u>"; } | 151 | $homedisplay .= "</u>"; } | |
| 172 | else { $homedisplay = $home; } | 152 | else { $homedisplay = $home; } | |
| 176 | <td><?php if ($spread == 0) { echo "even"; } else {echo $football->dectofrac($spread); }?></td> | = | 156 | <td><?php if ($spread == 0) { echo "even"; } else {echo $football->dectofrac($spread); }?></td> |
| 177 | <? } ?> | 157 | <? } ?> | |
| 178 | <td><b>At</b> | 158 | <td><b>At</b> | |
| 179 | <? | 159 | <? | |
| 180 | 160 | |||
| 181 | echo $homedisplay; echo $football->getTeamStats($hid); | 161 | echo $homedisplay; echo $football->getTeamStats($hid); | |
| 182 | if ($football->usespread=="Y") { | <> | ||
| 183 | if ($sresults == $hid and $hid != $winner){ echo "<image src=./images/win.gif height=\"20\">"; }?> | 162 | if ($sresults == $hid and $hid != $winner){ echo "<image src=./images/win.gif height=\"20\">"; }?></td> | |
| 184 | <? } ?> | |||
| 185 | </td> | |||
| 186 | <td><image src = ./images/<? echo $hicon; ?> width=<? echo $football->logo_width; ?>></td> | = | 163 | <td><image src = ./images/<? echo $hicon; ?> width=<? echo $football->logo_width; ?>></td> |
| 187 | <td><?php echo $hscore; ?></td> | 164 | <td><?php echo $hscore; ?></td> | |
| 188 | <td><span class="small"><?php echo $ot; ?></span></td> | 165 | <td><span class="small"><?php echo $ot; ?></span></td> | |
| 189 | <td><a href="#" onclick="window.open('http://www.nfl.com/gamecenter/live/NFL_<? echo $game; ?>','windname','width=700,height=900,scrollbars,resizable,top=0,left=0'); return false;">Gamecenter</a></td> | 166 | <td><a href="#" onclick="window.open('http://www.nfl.com/gamecenter/live/NFL_<? echo $game; ?>','windname','width=700,height=900,scrollbars,resizable,top=0,left=0'); return false;">Gamecenter</a></td> | |
| 190 | 167 | |||
| 191 | <td><?php echo $status; ?></td> | 168 | <td><?php echo $status; ?></td> | |