require "Templates/db_conn.inc.php";
#split the variable
$team1=explode(",",$team);
$leaguename=$team1[0];
$ateam=$team1[1];
$bteam=$team1[2];
$name1=$team1[3];
if($leaguename=='NCAAF')
{
if($ateam=='Texas A^M')
{
$ateam='Texas A&M';
}else
{
$ateam=$ateam;
}
if($bteam=='Texas A^M')
{
$bteam='Texas A&M';
}else
{$bteam=$bteam;
}
}
$name22=$name1;
if(preg_match('/~/',$name1))
{
$name1=preg_replace('/~/',',',$name1);
}
$name2=stripslashes($name1);
$val=$leaguename;
#--taking current date
//$startdate=$enddate='2006-07-18';
$newvar=explode(',',$name1);
$newdate=$newvar[0];
$newtime=$newvar[1];
$newteam1_id=$newvar[2];
$newteam1=$newvar[3];
$newteam2_id=$newvar[4];
$newteam2=$newvar[5];
if($leaguename=='NCAAF')
{
if($newteam1=='Texas A^M')
{
$newteam1='Texas A&M';
}else
{
$newteam1=$newteam1;
}
//$newteam2=strtolower($newteam2);
if($newteam2=='Texas A^M')
{
$newteam2='Texas A&M';
}else
{$newteam2=$newteam2;
}
//$hometeam1=strtolower($hometeam);
}
if($leaguename=='MLB')
{
$newteam1_pitcher=$newvar[7];
$newteam1_pithand=$newvar[8];
$newteam2_pitcher=$newvar[9];
$newteam2_pithand=$newvar[10];
$newteam1_gameno=$newvar[11];
$newteam2_gameno=$newvar[12];
}
else
{
$newteam1_gameno=$newvar[7];
$newteam2_gameno=$newvar[8];
}
$tagroadteam=$newteam1;
$taghometeam=$newteam2;
$tagdate=$newdate;
$tagval=$leaguename;
if($pst=="true")
{
}
else
{
require "Templates/header.inc.php";
}
include "game_times.php";
?>
/*******Images Path*******/
#red down arrow path
$arrow="";
#Green Star Image Path
$star1="";
#Blue Star Image Path
$star2="";
#Red Star Image Path
$star3="";
#get the teamname
if($leaguename=='MLB')
{
$mlbqry1=mysql_query("select team_name from mlb_teams where alias_teamname='$ateam' ");
list($ateamname)=mysql_fetch_array($mlbqry1);
$mlbqry2=mysql_query("select team_name from mlb_teams where alias_teamname='$bteam' ");
list($bteamname)=mysql_fetch_array($mlbqry2);
}
elseif($leaguename=='NFL')
{
$ateamname=$ateam;
$bteamname=$bteam;
$nflqry1=mysql_query("select team_shortname from nfl_teams where team_name='$ateam' ");
list($a1teamname)=mysql_fetch_array($nflqry1);
$nflqry2=mysql_query("select team_shortname from nfl_teams where team_name='$bteam' ");
list($b1teamname)=mysql_fetch_array($nflqry2);
}
else
{
$ateamname=$ateam;
$bteamname=$bteam;
}
#-----Images Path
$ateamname1=strtolower($ateamname);
$bteamname1=strtolower($bteamname);
$folder=strtolower($leaguename);
if($leaguename=='CFL')
{
$in_folder=$folder.'_db3_images';
}
else
{
$in_folder=$folder.'_images';
}
$basepath='http://www.atsdatabase.com/atsdb2/'.$folder.'/'.$in_folder.'/';
if($leaguename=='CFL' || $leaguename=='NFL')
{
$img1=$basepath.$ateamname.'.gif';
$img2=$basepath.$bteamname.'.gif';
}
else
{
$img1=$basepath.$ateamname1.'.gif';
$img2=$basepath.$bteamname1.'.gif';
}
#-----For displaying Team Rank below Images
$rankqry=mysql_query("select * from ats_averages where league_name='$leaguename' order by ratings desc");
$ranknum=mysql_num_rows($rankqry);
$count=$ranknum;
$type=($count/3);
$modoutput=($count%3);
if($modoutput==0)
{ $top=$type; $middle=$type; $bottom=$type;}
else
{ $a=intval($type); $top=$a; $middle=($a+$modoutput); $bottom=$a; }
while($rankrow=mysql_fetch_array($rankqry))
{
$teams=$rankrow['teamname'];
$rating=$rankrow['ratings'];
$rank++;
#TOP TEAMS ARRAY
if($rank >0 &&$rank<($top+1))
{
$grade='top';
$toprank[ ]=$rank;
$topteams[ ]=strtoupper($teams);
}#end if
#MIDDLE TEAMS ARRAY
if($rank>$top && $rank<($top+$middle+1))
{
$grade='middle';
$midrank[ ]=$rank;
$midteams[ ]=strtoupper($teams);
}
#BOTTOM TEAMS ARRAY
if($rank>($top+$middle) &&$rank<($top+$middle+$bottom+1))
{
$grade='bottom';
$botrank[ ]=$rank;
$botteams[ ]=strtoupper($teams);
}#end if
}#end while
if($leaguename=='MLB')
{
$rankteam1=strtoupper($ateam);
$rankteam2=strtoupper($bteam);
}
elseif($leaguename=='NFL')
{
$rankteam1=strtoupper($a1teamname);
$rankteam2=strtoupper($b1teamname);
}
else
{
$rankteam1=strtoupper($ateamname);
$rankteam2=strtoupper($bteamname);
}
if(in_array($rankteam1,$topteams))
{ $team1_rank=" ( Top Ranked Team ) ";}
elseif(in_array($rankteam1,$midteams))
{ $team1_rank=" ( Middle Ranked Team ) ";}
elseif(in_array($rankteam1,$botteams))
{ $team1_rank=" ( Bottom Ranked Team ) ";}
if(in_array($rankteam2,$topteams))
{ $team2_rank=" ( Top Ranked Team ) ";}
elseif(in_array($rankteam2,$midteams))
{ $team2_rank=" ( Middle Ranked Team ) ";}
elseif(in_array($rankteam2,$botteams))
{ $team2_rank=" ( Bottom Ranked Team ) ";}
$sel_league=mysql_query("select league_no from ats_league1 where league_name='$leaguename'");
list($lno)=mysql_fetch_array($sel_league);
$leaguename1=strtolower($leaguename);
$table=$leaguename1.'_teams';
?>
$road_side="";
$home_side="";
$over_disp="";
$linetotal_qry=mysql_query("select * from new_asp_schedule where game_date = '$newdate' and league_no='$lno' and game_no1='$newteam1_gameno' and game_no2='$newteam2_gameno'");
while($row=mysql_fetch_array($linetotal_qry))
{
$team1_spread=$row['team1_spread'];
$team2_spread=$row['team2_spread'];
$team1_ML=$row['team1_ML'];
$team2_ML=$row['team2_ML'];
$game_total=$row['game_total'];
if($lno=='5' || $lno=='7')
{
$road_side=$team1_ML;
$home_side=$team2_ML;
$over_disp=$game_total;
}
else
{
$road_side=$team1_spread;
$home_side=$team2_spread;
$over_disp=$game_total;
}
}
?>
Head to head :-
The head to head stats part provides sports betting stats for against the spread gamblers who are looking for past head to head history between two teams who are facing each other in their next upcoming game. Besides, it provides betting stats such as the offense and defensive averages that are unique for point spread players seeking numbers reflecting the point spread and not general sports stats. Furthermore, when you click on a against the spread (ATS), straight up (SU) or OVER/UNDER (O/U) record, you will come across a pop up browser which will give you the past game scores and results of that exact situation and/or games.
#-----query to check ROAD TEAM TRENDS
//$stats_qry1=mysql_query("select * from stats_trends_temp where league_name='$leaguename' and game_date between '$startdate' and '$enddate' and (team_a='$newteam1_id') and search_type='head_to_head' and display_status!='user' ");
//echo "select * from h2hrandom_queries where league_no='$lno' and game_date between '$startdate' and '$enddate' and (team_a='$newteam1_id' and game_number='$newteam1_gameno' ";
$stats_qry1=mysql_query("select * from h2hrandom_queries where league_no='$lno' and game_date between '$startdate' and '$enddate' and (team_a='$newteam1_id' and game_number='$newteam1_gameno') order by random_id desc limit 10 ");
$snum1=mysql_num_rows($stats_qry1);
//echo "snum1=$snum1 ";
if(!$snum1)
{
?>
Trends System
Trends Not Found
}
else
{
#-------query to retrieve only team trends as road
//$stats_roadqry=mysql_query("select * from stats_trends_temp where league_name='$leaguename' and game_date between '$startdate' and '$enddate' and (team_a='$newteam1_id') and search_type='head_to_head' and display_status!='user'");
$stats_roadqry=mysql_query("select * from h2hrandom_queries where league_no='$lno' and game_date between '$startdate' and '$enddate' and (team_a='$newteam1_id' and game_number='$newteam1_gameno') order by random_id desc limit 10 ");
$s_roadnum=mysql_num_rows($stats_roadqry);
if(!$s_roadnum)
{
?>
Team Trends
Team Trends Not Found
}
else
{
?>
Team System Trends
if($leaguename!='MLB'){
?>
Team Trends
}else{?>
Team Trends
}?>
ATS
}?>
SU
O/U
Description
Win-Loss-Push
}?>
Win-Loss-Push
Over-Under-Push
Click on description to see Predictions on next game
Click on records
}?>
Click on records
Click on records
while($stats_row1=mysql_fetch_array($stats_roadqry))
{
$stats_id1=$stats_row1['random_id'];
$message1=$stats_row1['message'];
if(preg_match('/~/',$message1))
{
$message1=preg_replace('/~/','-',$message1);
}
if(preg_match('/With no Situation/',$message1))
{
$message1=preg_replace('/With no Situation/','',$message1);
}
$ats_count1=$stats_row1['ats_count'];
$su_count1=$stats_row1['su_count'];
$over_under1=$stats_row1['over_under'];
$su_per1=$stats_row1['su_percentage'];
$su_per1=trim($su_per1);
$ats_per1=$stats_row1['ats_percentage'];
$ats_per1=trim($ats_per1);
$ou_per1=$stats_row1['ou_percentage'];
$ou_per1=trim($ou_per1);
/*------This is new code to chk star----------*/
$star_system1=$stats_row1['star_system'];
$star_system1=trim($star_system1);
$stars=explode("~",$star_system1);
$ats_stars=$stars[0];
$su_stars=$stars[1];
$ou_stars=$stars[2];
#----for any
#--for no star=>0
#--for red star=> 1
#--for green star=> 2
#--for blue star=> 3
switch($ats_stars)
{
case '0': $ats_star=""; break;
case '1': $ats_star=$star3; break;
case '2': $ats_star=$star1; break;
case '3': $ats_star=$star2; break;
}
switch($su_stars)
{
case '0': $su_star=""; break;
case '1': $su_star=$star3; break;
case '2': $su_star=$star1; break;
case '3': $su_star=$star2; break;
}
switch($ou_stars)
{
case '0': $ou_star=""; break;
case '1': $ou_star=$star3; break;
case '2': $ou_star=$star1; break;
case '3': $ou_star=$star2; break;
}
/*------End of new code to chk star----------*/
$count_sum1=$stats_row1['count_sum'];
$count_sum1=trim($count_sum1);
$csum1=explode("~",$count_sum1);
$ats_csum1=$csum1[0];
$su_csum1=$csum1[1];
$ou_csum1=$csum1[2];
#-----Check if the sum of w-l-t records is less than 3 then dont show it on userside
if($su_csum1 >=3)
{
?>
#-----Check if the sum of w-l-t records is less than 10 then dont show stars on userside
if($leaguename!='MLB')
{
#---ATSwinner
if($ats_csum1 >=10)
{?>
}#end else of if($su_csum1 >=10)
#-----Over/Under
if($over_under1=='0-0-0')
{
?>
}
else
{
if($ou_csum1 >=10)
{
?>
}#end if($ou_csum1 >=10)
else
{
?>
}#end else of if($ou_csum1 >=10)
}
?>
}#end if($su_csum1 >=3)
}#end while
?>
}#end else
}
?>
#---chk for home team trends
//$stats_qry2=mysql_query("select * from stats_trends_temp where league_name='$leaguename' and game_date between '$startdate' and '$enddate' and (team_a='$newteam2_id') and search_type='head_to_head' and display_status!='user' ");
$stats_qry2=mysql_query("select * from h2hrandom_queries where league_no='$lno' and game_date between '$startdate' and '$enddate' and (team_a='$newteam2_id' and game_number='$newteam2_gameno') order by random_id desc limit 10 ");
$snum2=mysql_num_rows($stats_qry2);
if(!$snum2)
{
?>
Trends System
Trends Not Found
}
else
{
#----query to retrieve team trends as home
//$stats_homeqry=mysql_query("select * from stats_trends_temp where league_name='$leaguename' and game_date between '$startdate' and '$enddate' and (team_a='$newteam2_id') and search_type='head_to_head' and display_status!='user' ");
$stats_homeqry=mysql_query("select * from h2hrandom_queries where league_no='$lno' and game_date between '$startdate' and '$enddate' and (team_a='$newteam2_id' and game_number='$newteam2_gameno') order by random_id desc limit 10 ");
$s_homenum=mysql_num_rows($stats_homeqry);
if(!$s_homenum)
{
?>
Team Trends
Team Trends Not Found
}
else
{
?>
Team System Trends
Team Trends
}else{?>
Team Trends
}?>
ATS
}?>
SU
O/U
Description
Win-Loss-Push
}?>
Win-Loss-Push
Over-Under-Push
Click on description to see Predictions on next game
Click on records
}?>
Click on records
Click on records
while($stats_row2=mysql_fetch_array($stats_homeqry))
{
$stats_id2=$stats_row2['random_id'];
$message2=$stats_row2['message'];
if(preg_match('/~/',$message2))
{
$message2=preg_replace('/~/','-',$message2);
}
if(preg_match('/With no Situation/',$message2))
{
$message2=preg_replace('/With no Situation/','',$message2);
}
$ats_count2=$stats_row2['ats_count'];
$su_count2=$stats_row2['su_count'];
$over_under2=$stats_row2['over_under'];
$su_per2=$stats_row2['su_percentage'];
$su_per2=trim($su_per2);
$ats_per2=$stats_row2['ats_percentage'];
$ats_per2=trim($ats_per2);
$ou_per2=$stats_row2['ou_percentage'];
$ou_per2=trim($ou_per2);
/*------This is new code to chk star----------*/
$star_system2=$stats_row2['star_system'];
$star_system2=trim($star_system2);
$stars2=explode("~",$star_system2);
$ats_stars2=$stars2[0];
$su_stars2=$stars2[1];
$ou_stars2=$stars2[2];
#----for any
#--for no star=>0
#--for red star=> 1
#--for green star=> 2
#--for blue star=> 3
switch($ats_stars2)
{
case '0': $ats_star2=""; break;
case '1': $ats_star2=$star3; break;
case '2': $ats_star2=$star1; break;
case '3': $ats_star2=$star2; break;
}
switch($su_stars2)
{
case '0': $su_star2=""; break;
case '1': $su_star2=$star3; break;
case '2': $su_star2=$star1; break;
case '3': $su_star2=$star2; break;
}
switch($ou_stars2)
{
case '0': $ou_star2=""; break;
case '1': $ou_star2=$star3; break;
case '2': $ou_star2=$star1; break;
case '3': $ou_star2=$star2; break;
}
/*------End of new code to chk star----------*/
$count_sum2=$stats_row2['count_sum'];
$count_sum2=trim($count_sum2);
$csum2=explode("~",$count_sum2);
$ats_csum2=$csum2[0];
$su_csum2=$csum2[1];
$ou_csum2=$csum2[2];
#-----Check if the sum of w-l-t records is less than 3 then dont show it on userside
if($su_csum2 >=3)
{
?>
#-----Check if the sum of w-l-t records is less than 10 then dont show stars on userside
if($leaguename!='MLB')
{
#---ATSwinner
if($ats_csum2 >=10)
{
?>