football.class.php changes
Produced: 8/25/2007 12:09:31 PM
   
Mode:  Differences with Context  
   
Left file: D:\phpfootball20\football.class.php     Right file: D:\phpfootball20old\football.class.php  
11 //* Copyright 2005 by Brian Paulson and George Garcia                                         * = 11 //* Copyright 2005 by Brian Paulson and George Garcia                                         *
12 //* Please see http://lvbash.com/phpBB2 for more support on PHPFootball    *   12 //* Please see http://lvbash.com/phpBB2 for more support on PHPFootball    *
13 //* version                                                                                                                     *   13 //* version                                                                                                                     *
14 //*                                                                         *   14 //*                                                                         *
15 //***************************************************************************   15 //***************************************************************************
16 // DONOT CHANGE NEXT TWO VARIABLES -------------------------------------------------------------------------------   16 // DONOT CHANGE NEXT TWO VARIABLES -------------------------------------------------------------------------------
17 var $version = "2.1 Spreads"; <> 17 var $version = "2.0 Spreads No Auto Scores";
18 var $release_date = "Aug. 25, 2007";   18 var $release_date = "June 27, 2007 2:40pm";
19 // DONOT CHANGE ABOVE TWO VARIABLES  ----------------------------------------------------------------------------- = 19 // DONOT CHANGE ABOVE TWO VARIABLES  -----------------------------------------------------------------------------
20     20  
21 ########################################################   21 ########################################################
22 # Database Variables                                                               #   22 # Database Variables                                                               #
23 ########################################################   23 ########################################################
24 var $host;   24 var $host;
 
70 var $ticker_righttoleft = "false"; = 70 var $ticker_righttoleft = "false";
71 var $ticker_speed = "3";   71 var $ticker_speed = "3";
72 var $ticker_font = "Arial";   72 var $ticker_font = "Arial";
73 var $ticker_fontsize ="14";   73 var $ticker_fontsize ="14";
74 var $ticker_fontcolor= "#ffffff";   74 var $ticker_fontcolor= "#ffffff";
75 var $ticker_paused = "false";   75 var $ticker_paused = "false";
76   <>    
77 // SMTP mail entries      
78 var $UseSMTP = "";   // Use SMTP to mail users true = yes false = no      
79 var $SMTPHost = "";  // SMTP mail host      
80 var $SMTPUser = "";  // SMTP User id      
81 var $SMTPPassWord = ""; // SMTP Password      
82 //****************************************************************************** = 76 //******************************************************************************
83 //                              END USER CONFIGURATION                                                                             *   77 //                              END USER CONFIGURATION                                                                             *
84 //******************************************************************************   78 //******************************************************************************
85 function football()   79 function football()
86         {   80         {
87     require("dbinfo.php");   81     require("dbinfo.php");
 
111      $this->password_min_len = $row->password_min_len; = 105      $this->password_min_len = $row->password_min_len;
112      $this->bet_amount = $row->bet_amount;   106      $this->bet_amount = $row->bet_amount;
113      $this->display_graphics = $row->display_graphics;   107      $this->display_graphics = $row->display_graphics;
114      $this->logo_width = $row->logo_width;   108      $this->logo_width = $row->logo_width;
115      $this->rssurl = $row->rssurl;   109      $this->rssurl = $row->rssurl;
116      $this->usespread = $row->spread;   110      $this->usespread = $row->spread;
117      $this->UseSMTP = $row->UseSMTP; +-    
118      $this->SMTPHost = $row->SMTPHost;      
119      $this->SMTPUser = $row->SMTPUser;      
120      $this->SMTPPassWord = $row->SMTPPassWord;      
121      } = 111      }
122     }   112     }
123 function dbConnect()   113 function dbConnect()
124         {   114         {
125         $db = @mysql_connect($this->host, $this->user, $this->pass);   115         $db = @mysql_connect($this->host, $this->user, $this->pass);
126         return $db;   116         return $db;
 
287     } = 277     }
288     278  
289 function WhoOnlineIdle()   279 function WhoOnlineIdle()
290     {   280     {
291     //get the current time   281     //get the current time
292     $time = time();   282     $time = time();
293 //    $sql1="select * from ".$this->prefix."online where timestamp+3600 < '".$time."'"; +-    
294 //    $rs1=$this->dbQuery($sql1);      
295     //delete idle entries = 283     //delete idle entries
296      $del="delete from ".$this->prefix."online where timestamp+3600 < '".$time."'";   284      $del="delete from ".$this->prefix."online where timestamp+3600 < '".$time."'";
297      $dels = $this->dbQuery($del) or die( $del . mysql_error() ); <> 285      $dels = $this->dbQuery($del);
298     } = 286     }
299     287  
300 // Validate e-mail including checking the server   288 // Validate e-mail including checking the server
301 function checkEmail($email)   289 function checkEmail($email)
302 {   290 {
303    if(eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $email))   291    if(eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $email))
 
361      $captionno++; = 349      $captionno++;
362      }   350      }
363      }   351      }
364     352  
365 function getTicker1()   353 function getTicker1()
366     {   354     {
367   $week=$this->currentWeek()-1; <> 355   $week=$this->currentWeek();
368   $nogames=$this->AllGamesPlayedWeek($week); = 356   $nogames=$this->AllGamesPlayedWeek($week);
369   $str="";   357   $str="";
370   $display="Y";   358   $display="Y";
371   $list = $this->WinnersList($week,$display);   359   $list = $this->WinnersList($week,$display);
372   if(is_array($list))   360   if(is_array($list))
373         {   361         {
 
381          echo "<span style='background-color:#7FB51A;'> &nbsp; &nbsp; <B><font color=#000000>PHPFootball News Ticker</B></font>&nbsp; &nbsp; </span>\n"; = 369          echo "<span style='background-color:#7FB51A;'> &nbsp; &nbsp; <B><font color=#000000>PHPFootball News Ticker</B></font>&nbsp; &nbsp; </span>\n";
382     while($row = mysql_fetch_object($rs))   370     while($row = mysql_fetch_object($rs))
383      {   371      {
384      echo "&nbsp;--&nbsp; <B>$row->msg_line</B>&nbsp;\n";   372      echo "&nbsp;--&nbsp; <B>$row->msg_line</B>&nbsp;\n";
385      }   373      }
386      if ($nogames == 0) {   //check if all games played for the week   374      if ($nogames == 0) {   //check if all games played for the week
387      echo "<span style='background-color:#EEE309;'> &nbsp; <B><font color=#000000>Week $week&nbsp; Winner:&nbsp;</font></span><b> $str &nbsp;&nbsp;</B>\n"; <> 375      echo "<span style='background-color:#EEE309;'> &nbsp; <B><font color=#000000>This Week Winner:&nbsp;</font></span><b> $str &nbsp;&nbsp;</B>\n";
388       }      
389      }      
390           }      
391        
392 function getTicker2()      
393     {      
394   $week=$this->currentWeek()-1;      
395   $nogames=$this->AllGamesPlayedWeek($week);      
396   $str="";      
397   $display="Y";      
398   $list = $this->WinnersList($week,$display);      
399   if(is_array($list))      
400         {      
401         $str=implode(",",$this->WinnersList($week,$display));      
402         }      
403        
404     $sql = "select msg_line from ".$this->prefix."ticker order by id";      
405     $rs = $this->dbQuery($sql);      
406     $rows = mysql_num_rows($rs);      
407     if ($rows >0) {      
408          echo "<nobr> &nbsp; &nbsp; <B><font color=#7FB51A>PHPFootball News Ticker</B></font>&nbsp; &nbsp;";      
409     while($row = mysql_fetch_object($rs))      
410      {      
411      echo "&nbsp;--&nbsp; <B>$row->msg_line</B>&nbsp;";      
412      }      
413      if ($nogames == 0) {   //check if all games played for the week      
414      echo "&nbsp; <B><font color=#000000>Week $week&nbsp;Winner:&nbsp;</font>$str</B></nobr>";      
415       } else {      
416       echo "</nobr>";      
417       } = 376       }
418      }   377      }
419           }   378           }
420     379  
421 function NumberOfGames($week)   380 function NumberOfGames($week)
422         {   381         {
 
465        if ($row['gametime'] <= $ts) = 424        if ($row['gametime'] <= $ts)
466                         {   425                         {
467                 $lockcount = $lockcount + 1;   426                 $lockcount = $lockcount + 1;
468             }   427             }
469         }   428         }
470        if ($gamecount == $lockcount)   429        if ($gamecount == $lockcount)
471 //         if ($lockcount >0)  // use to lock all games after start of first game ow week +-    
472          { = 430          {
473           $alllocked=true;   431           $alllocked=true;
474           }   432           }
475        return $alllocked;   433        return $alllocked;
476        }   434        }
477     435  
 
532          $del="delete from ".$this->prefix."tiebreaker where week = ".$week." and user = '".$user."'"; = 490          $del="delete from ".$this->prefix."tiebreaker where week = ".$week." and user = '".$user."'";
533          $dels = $this->dbQuery($del);   491          $dels = $this->dbQuery($del);
534          $in="insert into ".$this->prefix."tiebreaker (week, user, points) values(".$week.", '".$user."',".$picks['tb'].")";   492          $in="insert into ".$this->prefix."tiebreaker (week, user, points) values(".$week.", '".$user."',".$picks['tb'].")";
535          $ins = $this->dbQuery($in);   493          $ins = $this->dbQuery($in);
536           }   494           }
537     495  
    <> 496 // email picks to user
      497  
      498     $sql  = "SELECT * FROM ".$this->prefix."users WHERE user = '".$user."' AND maillist = '1'";
      499     $rs = $this->dbQuery($sql);
      500     $row = mysql_fetch_array($rs);
      501     $email = $row['email'];
      502  
      503     if ($email != "") {
      504  
      505     $subject = "Your ".$this->sitetitle."";
      506     $subject .= " Picks for Week: ".$week."";
      507     $contents = "<html><head><title>User Picks</title></head><body>";
      508     $contents .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"".$this->copyrightweb."/styles.css\" />";
      509     $contents .= "<font size=\"2\">Below are your picks for Week: ".$week."<br><b>Underlined teams are your picks</b></font><br><br>\n";
      510     $contents .= "<table class=\"main\" cellpadding=\"0\" cellspacing=\"0\"><tr>\n<td align=\"left\" colspan=\"7\">Week ".$week." Picks for ".$user."</th></tr>\n<tr><td align=\"center\" colspan=\"3\"><strong>Date/Time</strong></td>\n<td align=\"center\" colspan=\"1\"><strong>Away</strong></td>\n<td>&nbsp;</td>\n<td align=\"center\" colspan=\"2\"><strong>Home</strong></td>\n</tr>\n";
      511  
      512    $sql = "select * from ".$this->prefix."tiebreaker where week = '".$week."' and user = '".$user."'";
      513    $rs = $this->dbQuery($sql);
      514    $row = mysql_fetch_array($rs);
      515    $tb = $row['points'];
      516  
      517    $sql = "SELECT * FROM ".$this->prefix."picks, ".$this->prefix."schedule, ".$this->prefix."teams WHERE USER = '".$user."' AND week = '".$week."' AND ".$this->prefix."picks.gameid = ".$this->prefix."schedule.gameid AND ".$this->prefix."picks.pick = ".$this->prefix."teams.id ORDER BY ".$this->prefix."schedule.gametime, ".$this->prefix."schedule.gameid";
      518  
      519    $result = $this->dbQuery($sql);
      520    $nRows = mysql_num_rows($result);
      521    $upicks = "";
      522  
      523    for ($i=0; $i< $nRows; $i++){
      524  
      525             $row = mysql_fetch_array($result);
      526             $pickcity = $row['city'];
      527             $pickname = $row['name'];
      528             $gameid = $row['gameid'];
      529             $pick = $row['pick'];
      530  
      531    $sql="select ".$this->prefix."schedule.*, ".$this->prefix."teams.city as VCity, ".$this->prefix."teams.name as VName, ".$this->prefix."teams.display as VDisplayName, ".$this->prefix."teams.icon as Vicon, teams2.city as HCity, teams2.name as HName, teams2.display as HDisplayName, teams2.icon as Hicon from (".$this->prefix."schedule inner join ".$this->prefix."teams on ".$this->prefix."schedule.vid = ".$this->prefix."teams.id) inner join ".$this->prefix."teams as teams2 on ".$this->prefix."schedule.hid = teams2.id where ".$this->prefix."schedule.gameid = '".$gameid."'";
      532  
      533    $pickresult = $this->dbQuery($sql);
      534    $prow = mysql_fetch_array($pickresult);
      535    $game = "";
      536    $vid = $prow['vid'];
      537    $vcity = $prow['VCity'];
      538    $vname = $prow['VName'];
      539    $vicon = $prow['Vicon'];
      540    $hid = $prow['hid'];
      541    $hcity = $prow['HCity'];
      542    $hname = $prow['HName'];
      543    $hicon = $prow['Hicon'];
      544    $gametime = $prow['gametime'];
      545    $date = date("m/d/Y",$gametime);
      546    $time = date("H:i:s A",$gametime);
      547    $ts = $this->doDate($date,$time,$this->display_offset);
      548    $day = date("D",$ts);
      549    $month = date("M d",$ts);
      550    $time = date("g:i a",$ts);
      551  
      552    $contents .= "<tr><td>".$day."</td><td>".$month."</td><td>".$time."</td>";
      553  
      554    if ($vid == $pick) {
      555     $visitor = "<b><u>";
      556     $visitor .= $vcity;
      557     $visitor .= " ";
      558     $visitor .= $vname;
      559     $visitor .= "</b></u>";
538          }   560     }
      561     else {
      562     $visitor = $vcity;
      563     $visitor .= " ";
      564     $visitor .= $vname;
      565     }
      566  
      567    $contents .= "<td>$visitor";
      568    $contents .= $this->getTeamStats($vid);
      569    $contents .= "</td>";
      570    $contents .= "<td><img src = \"".$this->copyrightweb."/images/$vicon\" width=".$this->logo_width."></td>\n";
      571  
      572    if ($hid == $pick) {
      573     $home = "<b><u>";
      574     $home .= $hcity;
      575     $home .= " ";
      576     $home .= $hname;
      577     $home .= "</b></u>";
      578     }
      579     else {
      580     $home = $hcity;
      581     $home .= " ";
      582     $home .= $hname;
      583     }
      584  
      585   $contents .= "<td>at  $home";
      586   $contents .= $this->getTeamStats($hid);
      587   $contents .= "</td>";
      588   $contents .= "<td><img src = \"".$this->copyrightweb."/images/$hicon\" width=".$this->logo_width."></td>";
      589   $contents .= "</tr>\n";
      590 }
      591  
      592   $contents .= "</table>\n";
      593   $contents .= "<br><br><br><b>Tie breaker for Monday Night Game: ".$tb."</b>\n";
      594   $contents .= "<br><br>\n";
      595  
      596   $to = $email;
      597  
      598   $footer = "If you wish to not receive this letter, please click the following link:<br>\n";
      599   $y = "<br><br>------------------------------------------------------------------------<br>\n";
      600   $y .= $footer."<a href=\"".$this->copyrightweb."/unsubscribe.php\"><font size=\"2\">Unsubscribe</font></a><br>";
      601   $y .= "\n";
      602   $y .= "<br>------------------------------------------------------------------------\n";
      603   $y .= "</body>";
      604  
      605   $email = $contents.$y;
      606  
      607   $headers .= "From: $this->admin_email\n";
      608   $headers .= "Reply-To: $this->admin_email\n";
      609   $headers .= "Return-Path: $this->admin_email\n";
      610 //  $headers .= "MIME-Version: 1.0\r\n";
      611   $headers .= "Content-Type: text/html\r\n";
      612 //  $headers .= "X-Mailer: PHP / ".phpversion()."\r\n";
      613  
      614   mail($to,$subject,$email,$headers);
      615   $mail = "1";
      616  
      617 }
      618 return $mail;
      619 }
539   = 620  
540 function GetPick($user)   621 function GetPick($user)
541         {   622         {
542         $getpick="";   623         $getpick="";
543     $sql="select pick,gameid from ".$this->prefix."picks where user = '".$user."'";   624     $sql="select pick,gameid from ".$this->prefix."picks where user = '".$user."'";
544         $rs = $this->dbQuery($sql);   625         $rs = $this->dbQuery($sql);
 
968                  $gamesxml[$row['gameid']] = $xmldata; = 1049                  $gamesxml[$row['gameid']] = $xmldata;
969                  }   1050                  }
970         return $gamesxml;   1051         return $gamesxml;
971 }   1052 }
972     1053  
973 function fetchGameData($game) {   1054 function fetchGameData($game) {
974     $myFFLurl = 'http://feeds.myffl.net/feed/game/'; <>    
975 //    $myFFLurl = 'http://www.myffl.net/myffl/live/game.php';   1055     $myFFLurl = 'http://www.myffl.net/myffl/live/game.php';
976     $myFFLquery = "?$game/PHP/arr/game";   1056     $myFFLquery = "?$game/php";
977     //$httpQuery = $this->ffl_HttpGet( $myFFLurl.$myFFLquery ); = 1057     //$httpQuery = $this->ffl_HttpGet( $myFFLurl.$myFFLquery );
978     $httpQuery = $this->ffl_HttpGet( $myFFLurl.$myFFLquery );   1058     $httpQuery = $this->ffl_HttpGet( $myFFLurl.$myFFLquery );
979     $dataArray = unserialize( $httpQuery['body'] );   1059     $dataArray = unserialize( $httpQuery['body'] );
980     return $dataArray;   1060     return $dataArray;
981 }   1061 }
982     1062