ob_clean();
ob_implicit_flush();
//ob_get_status();
flush();
//echo "$select";
require "Templates/db_conn.inc.php";
if($select=='')
{$select='NFL';}
if($select=='CFB')
{
$select='NCAAF';
}
$val=$select;
$tagval=$val;
if($pst=="true")
{
}
else
{
require "Templates/atsdb2_header_new.php";
}
###################################################################
// factors to compare/identify the game from 2 tables new_asp_schedule and gameDetails are
// date, time, road_game_no, home_game_no, league
// team names cant be compared because team names are different in both tables.
?>
/*
FOR NBA
bookmaker --greek
away_runline --team1_spread
away_runline1 -- team1_spmoney
home_runline --team2_spread
home_runline1--team2_spmoney
tot_overmoney ---tot_overmoney
tot_undermoney ---- tot_undermoney
home_cris---game_total
FOR CBB
away_runline --team1_spread
away_runline1 -- team1_spmoney
home_runline --team2_spread
home_runline1--team2_spmoney
tot_overmoney ---tot_overmoney
tot_undermoney ---- tot_undermoney
home_cris---game_total
#####################
linecuracy_result
#####################
linecuracy_result_id
gameDetails_id
new_asp_schedule_id
thegreek_spread
bookmaker_spread
thegreek_spread_result
bookmaker_spread_result
thegreek_ou
bookmaker_ou
thegreek_ou_result
bookmaker_ou_result
thegreek_ml
bookmaker_ml
thegreek_ml_result
bookmaker_ml_result
thegreek_ats
bookmaker_ats
thegreek_ats_result
bookmaker_ats_result
updated_date
*/
// new_asp_schedule table game_time is pacific time & gameDetails has central time zone
// http://www.atsdatabase.com/us_time.php (shows time in different time zones)
// pacific time is 3 hours ahead of central time
function getresult($startdate,$enddate,$bk_league,$dateclause)
{
switch($bk_league)
{
case 'CFL':
$league_desc ='CANADIAN FOOTBALL';
break;
case 'MLB':
$league_desc='MAJOR LEAGUE BASEBALL';
break;
case 'NFL':
$league_desc='NFL';
break;
case 'NCAAF':
case 'CFB':
$league_desc='COLLEGE FOOTBALL';
break;
case 'NCAAB':
case 'CBB':
$league_desc='COLLEGE BASEBALL';
break;
case 'NBA':
$league_desc='NBA';
break;
case 'NHL':
$league_desc='NHL';
break;
}
##########NEW CODING
####Total games
//echo "select count(*) as totnum from gameDetails where game_name='$bk_league' and $dateclause and game_date between '$startdate' and '$enddate' and away_game_no<'1000' and home_game_no<'1000' and league_desc='$league_desc' and flag='yes'
";
$total_qry=mysql_query("select count(*) as totnum from gameDetails where game_name='$bk_league' and $dateclause and game_date between '$startdate' and '$enddate' and away_game_no<'1000' and home_game_no<'1000' and league_desc='$league_desc' and flag='yes' ");
list($totnum)=mysql_fetch_array($total_qry);
//echo "totnum=$totnum
";
if($totnum!='0')
{
//echo "select count(*) as tg_Wspreadnum from gameDetails where game_name='$bk_league' and $dateclause and game_date between '$startdate' and '$enddate'and away_game_no<'1000' and home_game_no<'1000' and (tg_spread_result='WIN') and league_desc='$league_desc' and flag='yes'
";
####Total games win by thegrek spread
$tg_Wspreadqry=mysql_query("select count(*) as tg_Wspreadnum from gameDetails where game_name='$bk_league' and $dateclause and game_date between '$startdate' and '$enddate'and away_game_no<'1000' and home_game_no<'1000' and (tg_spread_result='WIN') and league_desc='$league_desc' and flag='yes' ");
list($tg_Wspreadnum)=mysql_fetch_array($tg_Wspreadqry);
$tgsp_winper1=round((($tg_Wspreadnum/$totnum)*100),0);
//echo "tg_Wspreadnum=$tg_Wspreadnum
";
####Total games lost by thegrek spread
$tg_Lspreadqry=mysql_query("select count(*) as tg_Lspreadnum from gameDetails where game_name='$bk_league' and $dateclause and game_date between '$startdate' and '$enddate'and away_game_no<'1000' and home_game_no<'1000'and tg_spread_result='LOST' and league_desc='$league_desc' and flag='yes' ");
list($tg_Lspreadnum)=mysql_fetch_array($tg_Lspreadqry);
$tgsp_lostper1=round((($tg_Lspreadnum/$totnum)*100),0);
//echo "tgsp_lostper1=$tgsp_lostper1
";
####Total games win by thegrek spread
$bk_Wspreadqry=mysql_query("select count(*) as bk_Wspreadnum from gameDetails where game_name='$bk_league' and $dateclause and game_date between '$startdate' and '$enddate'and away_game_no<'1000' and home_game_no<'1000' and (bk_spread_result='WIN' ) and league_desc='$league_desc' and flag='yes' ");
list($bk_Wspreadnum)=mysql_fetch_array($bk_Wspreadqry);
$bksp_winper1=round((($bk_Wspreadnum/$totnum)*100),0);
####Total games lost by thegrek spread
$bk_Lspreadqry=mysql_query("select count(*) as bk_Lspreadnum from gameDetails where game_name='$bk_league' and $dateclause and game_date between '$startdate' and '$enddate'and away_game_no<'1000' and home_game_no<'1000'and bk_spread_result='LOST' and league_desc='$league_desc' and flag='yes' ");
list($bk_Lspreadnum)=mysql_fetch_array($bk_Lspreadqry);
$bksp_lostper1=round((($bk_Lspreadnum/$totnum)*100),0);
/**************************************************************************/
####Total games win by thegrek spread
$tg_Wmlqry=mysql_query("select count(*) as tg_Wmlnum from gameDetails where game_name='$bk_league' and $dateclause and game_date between '$startdate' and '$enddate'and away_game_no<'1000' and home_game_no<'1000'and (tg_ml_result='WIN') and tg_ml_edge!='' and league_desc='$league_desc' and flag='yes' ");
list($tg_Wmlnum)=mysql_fetch_array($tg_Wmlqry);
$tgml_winper1=round((($tg_Wmlnum/$totnum)*100),0);
####Total games lost by thegrek spread
$tg_Lmlqry=mysql_query("select count(*) as tg_Lmlnum from gameDetails where game_name='$bk_league' and $dateclause and game_date between '$startdate' and '$enddate'and away_game_no<'1000' and home_game_no<'1000'and tg_ml_result='LOST' and tg_ml_edge!='' and league_desc='$league_desc' and flag='yes' ");
list($tg_Lmlnum)=mysql_fetch_array($tg_Lmlqry);
$tgml_lostper1=round((($tg_Lmlnum/$totnum)*100),0);
####Total games win by thegrek spread
$bk_Wmlqry=mysql_query("select count(*) as bk_Wmlnum from gameDetails where game_name='$bk_league' and $dateclause and game_date between '$startdate' and '$enddate'and away_game_no<'1000' and home_game_no<'1000' and (bk_ml_result='WIN' ) and bk_ml_edge!='' and league_desc='$league_desc' and flag='yes' ");
list($bk_Wmlnum)=mysql_fetch_array($bk_Wmlqry);
$bkml_winper1=round((($bk_Wmlnum/$totnum)*100),0);
####Total games lost by thegrek spread
$bk_Lmlqry=mysql_query("select count(*) as bk_Lmlnum from gameDetails where game_name='$bk_league' and $dateclause and game_date between '$startdate' and '$enddate'and away_game_no<'1000' and home_game_no<'1000'and bk_ml_result='LOST' and bk_ml_edge!='' and league_desc='$league_desc' and flag='yes' ");
list($bk_Lmlnum)=mysql_fetch_array($bk_Lmlqry);
$bkml_lostper1=round((($bk_Lmlnum/$totnum)*100),0);
/**************************************************************************/
####Total games win by thegrek spread
$tg_Wouqry=mysql_query("select count(*) as tg_Wounum from gameDetails where game_name='$bk_league' and $dateclause and game_date between '$startdate' and '$enddate'and away_game_no<'1000' and home_game_no<'1000' and (tg_ou_result='WIN' ) and league_desc='$league_desc' and flag='yes' ");
list($tg_Wounum)=mysql_fetch_array($tg_Wouqry);
$tgou_winper1=round((($tg_Wounum/$totnum)*100),0);
####Total games lost by thegrek spread
$tg_Louqry=mysql_query("select count(*) as tg_Lounum from gameDetails where game_name='$bk_league' and $dateclause and game_date between '$startdate' and '$enddate'and away_game_no<'1000' and home_game_no<'1000'and tg_ou_result='LOST' and league_desc='$league_desc' and flag='yes' ");
list($tg_Lounum)=mysql_fetch_array($tg_Louqry);
$tgou_lostper1=round((($tg_Lounum/$totnum)*100),0);
####Total games win by thegrek spread
$bk_Wouqry=mysql_query("select count(*) as bk_Wounum from gameDetails where game_name='$bk_league' and $dateclause and game_date between '$startdate' and '$enddate'and away_game_no<'1000' and home_game_no<'1000'and (bk_ou_result='WIN' ) and league_desc='$league_desc' and flag='yes' ");
list($bk_Wounum)=mysql_fetch_array($bk_Wouqry);
$bkou_winper1=round((($bk_Wounum/$totnum)*100),0);
####Total games lost by thegrek spread
$bk_Louqry=mysql_query("select count(*) as bk_Lounum from gameDetails where game_name='$bk_league' and $dateclause and game_date between '$startdate' and '$enddate'and away_game_no<'1000' and home_game_no<'1000'and bk_ou_result='LOST' and league_desc='$league_desc' and flag='yes' ");
list($bk_Lounum)=mysql_fetch_array($bk_Louqry);
$bkou_lostper1=round((($bk_Lounum/$totnum)*100),0);
/**************************************************************************/
####Total games win by thegrek spread
$tg_Wspmlqry=mysql_query("select count(*) as tg_Wspmlnum from gameDetails where game_name='$bk_league' and $dateclause and game_date between '$startdate' and '$enddate'and away_game_no<'1000' and home_game_no<'1000' and (tg_spml_result='WIN' ) and league_desc='$league_desc' and flag='yes' ");
list($tg_Wspmlnum)=mysql_fetch_array($tg_Wspmlqry);
$tgspml_winper1=round((($tg_Wspmlnum/$totnum)*100),0);
####Total games lost by thegrek spread
$tg_Lspmlqry=mysql_query("select count(*) as tg_Lspmlnum from gameDetails where game_name='$bk_league' and $dateclause and game_date between '$startdate' and '$enddate'and away_game_no<'1000' and home_game_no<'1000' and tg_spml_result='LOST' and league_desc='$league_desc' and flag='yes' ");
list($tg_Lspmlnum)=mysql_fetch_array($tg_Lspmlqry);
$tgspml_lostper1=round((($tg_Lspmlnum/$totnum)*100),0);
####Total games win by thegrek spread
$bk_Wspmlqry=mysql_query("select count(*) as bk_Wspmlnum from gameDetails where game_name='$bk_league' and $dateclause and game_date between '$startdate' and '$enddate'and away_game_no<'1000' and home_game_no<'1000'and (bk_spml_result='WIN' ) and league_desc='$league_desc' and flag='yes' ");
list($bk_Wspmlnum)=mysql_fetch_array($bk_Wspmlqry);
$bkspml_winper1=round((($bk_Wspmlnum/$totnum)*100),0);
####Total games lost by thegrek spread
$bk_Lspmlqry=mysql_query("select count(*) as bk_Lspmlnum from gameDetails where game_name='$bk_league' and $dateclause and game_date between '$startdate' and '$enddate'and away_game_no<'1000' and home_game_no<'1000'and bk_spml_result='LOST' and league_desc='$league_desc' and flag='yes' ");
list($bk_Lspmlnum)=mysql_fetch_array($bk_Lspmlqry);
$bkspml_lostper1=round((($bk_Lspmlnum/$totnum)*100),0);
}
else
{
$tgsp_winper1='0';
$tgsp_lostper1='0';
$bksp_winper1='0';
$bksp_lostper1='0';
$tgml_winper1='0';
$tgml_lostper1='0';
$bkml_winper1='0';
$bkml_lostper1='0';
$tgou_winper1='0';
$tgou_lostper1='0';
$bkou_winper1='0';
$bkou_lostper1='0';
$tgspml_winper1='0';
$tgspml_lostper1='0';
$bkspml_winper1='0';
$bkspml_lostper1='0';
} $returnval=$tg_Wspreadnum.'~'.$tg_Lspreadnum.'~'.$bk_Wspreadnum.'~'.$bk_Lspreadnum.'~'.$tg_Wmlnum.'~'.$tg_Lmlnum.'~'.$bk_Wmlnum.'~'.$bk_Lmlnum.'~'.$tg_Wounum.'~'.$tg_Lounum.'~'.$bk_Wounum.'~'.$bk_Lounum.'~'.$tg_Wspmlnum.'~'.$tg_Lspmlnum.'~'.$bk_Wspmlnum.'~'.$bk_Lspmlnum;
return $returnval;
}
$tz = getenv('TZ'); // Get current server time zone setting
putenv("TZ=EST5EDT"); // Change to US Eastern time zone or whatever you want
$lt = (localtime(time(),"TRUE"));
$ltt=$lt['tm_hour'];
putenv("TZ=$tz"); // Change it back to the original server time zone
//$tz = array ( 'PST' => -8);
//$pacific_time = time() + ($tz['PST'] * 3600);
$tz = array ( 'EST' => -5);
$pacific_time = time() + ($tz['EST'] * 3600);
$lt = localtime($pacific_time, TRUE);
if ($lt['tm_isdst'])
$pacific_time += 3600;
$pacific_date=gmstrftime('%Y-%m-%d', $pacific_time);
list($y2, $m2, $d2) = split("-", $pacific_date);
$month=gmstrftime('%A', $pacific_time);
$pacific_time=gmstrftime('%T', $pacific_time);
if($month=="Tuesday")
{
if($select=='CFL' || $select=='NFL' || $select=='NCAAF' || $select=='CFB')
{
$startdate=$pacific_date;
$enddate = date("Y-m-d", mktime (0, 0, 0, $m2, $d2+6, $y2));
}
elseif($select=='MLB' || $select=='NHL' || $select=='NBA' || $select=='NCAAB')
{
$startdate=$pacific_date;
$enddate=$pacific_date;
}
}
if($month=="Wednesday")
{
if($select=='CFL' || $select=='NFL' || $select=='NCAAF' || $select=='CFB')
{
$startdate = date("Y-m-d", mktime (0, 0, 0, $m2, $d2-1, $y2));
list($y1, $m1, $d1) = split("-", $startdate);
$enddate = date("Y-m-d", mktime (0, 0, 0, $m1, $d1+6, $y1));
}
elseif($select=='MLB' || $select=='NHL' || $select=='NBA' || $select=='NCAAB')
{
$startdate=$pacific_date;
$enddate=$pacific_date;
}
}
if($month=="Thursday")
{
if($select=='CFL' || $select=='NFL' || $select=='NCAAF' || $select=='CFB')
{
$startdate = date("Y-m-d", mktime (0, 0, 0, $m2, $d2-2, $y2));
list($y1, $m1, $d1) = split("-", $startdate);
$enddate = date("Y-m-d", mktime (0, 0, 0, $m1, $d1+6, $y1));
}
elseif($select=='MLB' || $select=='NHL' || $select=='NBA' || $select=='NCAAB')
{
$startdate=$pacific_date;
$enddate=$pacific_date;
}
}
if($month=="Friday")
{
if($select=='CFL' || $select=='NFL' || $select=='NCAAF' || $select=='CFB')
{
$startdate = date("Y-m-d", mktime (0, 0, 0, $m2, $d2-3, $y2));
list($y1, $m1, $d1) = split("-", $startdate);
$enddate = date("Y-m-d", mktime (0, 0, 0, $m1, $d1+6, $y1));
}
elseif($select=='MLB' || $select=='NHL' || $select=='NBA' || $select=='NCAAB')
{
$startdate=$pacific_date;
$enddate=$pacific_date;
}
}
if($month=="Saturday")
{
if($select=='CFL' || $select=='NFL' || $select=='NCAAF' || $select=='CFB')
{
$startdate = date("Y-m-d", mktime (0, 0, 0, $m2, $d2-4, $y2));
list($y1, $m1, $d1) = split("-", $startdate);
$enddate = date("Y-m-d", mktime (0, 0, 0, $m1, $d1+6, $y1));
}
elseif($select=='MLB' || $select=='NHL' || $select=='NBA' || $select=='NCAAB')
{
$startdate=$pacific_date;
$enddate=$pacific_date;
}
}
if($month=="Sunday")
{
if($select=='CFL' || $select=='NFL' || $select=='NCAAF' || $select=='CFB')
{
$startdate = date("Y-m-d", mktime (0, 0, 0, $m2, $d2-5, $y2));
list($y1, $m1, $d1) = split("-", $startdate);
$enddate = date("Y-m-d", mktime (0, 0, 0, $m1, $d1+6, $y1));
}
elseif($select=='MLB' || $select=='NHL' || $select=='NBA' || $select=='NCAAB')
{
$startdate=$pacific_date;
$enddate=$pacific_date;
}
}
if($month=="Monday")
{
if($select=='CFL' || $select=='NFL' || $select=='NCAAF' || $select=='CFB')
{
$startdate = date("Y-m-d", mktime (0, 0, 0, $m2, $d2-6, $y2));
list($y1, $m1, $d1) = split("-", $startdate);
$enddate = date("Y-m-d", mktime (0, 0, 0, $m1, $d1+6, $y1));
}
elseif($select=='MLB' || $select=='NHL' || $select=='NBA' || $select=='NCAAB')
{
$startdate=$pacific_date;
$enddate=$pacific_date;
}
}
if($select=='NFL')
{$enddate='2010-02-07';
}
switch($select)
{
case 'CFL':
$league_desc ='CANADIAN FOOTBALL';
break;
case 'MLB':
$league_desc='MAJOR LEAGUE BASEBALL';
break;
case 'NFL':
$league_desc='NFL';
break;
case 'NCAAF':
case 'CFB':
$league_desc='COLLEGE FOOTBALL';
break;
case 'NCAAB':
case 'CBB':
$league_desc='COLLEGE BASEBALL';
break;
case 'NBA':
$league_desc='NBA';
break;
case 'NHL':
$league_desc='NHL';
break;
}
if($select=='CFL')
{
//$select_query = "SELECT * FROM gameDetails WHERE game_name='$select' and away_game_no<'1000' and home_game_no<'1000' and (away_team not like '%teams%' or home_team not like '%teams%') and (away_team not like '%runs%' or home_team not like '%runs%') and league_desc='$league_desc' and flag='yes' and game_date between '$startdate' and '$enddate' ORDER BY game_date desc, game_name";
$select_query = "SELECT * FROM gameDetails WHERE game_name='$select' and away_game_no<'1000' and home_game_no<'1000' and (away_team not like '%teams%' or home_team not like '%teams%') and (away_team not like '%runs%' or home_team not like '%runs%') and flag='yes' and game_date between '$startdate' and '$enddate' ORDER BY game_date desc, game_name";
}
else
{
if($select=='NCAAF')
{
$select='CFB';
}
//$select_query = "SELECT * FROM gameDetails WHERE game_name='$select' AND home_moneyline!='' AND away_moneyline!='' and away_game_no<'1000' and home_game_no<'1000' and (away_team not like '%teams%' or home_team not like '%teams%') and (away_team not like '%runs%' or home_team not like '%runs%') and flag='yes' and game_date between '$startdate' and '$enddate' ORDER BY game_date desc, game_name";
$select_query = "SELECT * FROM gameDetails WHERE game_name='$select' AND away_game_no<'1000' and home_game_no<'1000' and (away_team not like '%teams%' or home_team not like '%teams%') and (away_team not like '%runs%' or home_team not like '%runs%') and flag='yes' and game_date between '$startdate' and '$enddate' ORDER BY game_date desc, game_name";
}
// echo "select_query=$select_query
";
$sel_res = mysql_query($select_query);
$sel_num = mysql_num_rows($sel_res);
//echo "sel_num=$sel_num
";
if($sel_num)
{
while($sel_row = mysql_fetch_array($sel_res))
{
// BOOKMAKER DATA
###Thegreek Data
$bk_auto_id = $sel_row['auto_id'];
$bk_league = $sel_row['game_name'];
$bk_game_date = $sel_row['game_date'];
$bk_away_game_no = $sel_row['away_game_no'];
$bk_home_game_no = $sel_row['home_game_no'];
$bk_away_team = $sel_row['away_team'];
$bk_home_team = $sel_row['home_team'];
$bk_away_runline = $sel_row['away_runline'];
$bk_away_runline1 = $sel_row['away_runline1'];
$bk_home_runline = $sel_row['home_runline'];
$bk_home_runline1 = $sel_row['home_runline1'];
$bk_tot_overmoney = $sel_row['tot_overmoney'];
$bk_tot_undermoney = $sel_row['tot_undermoney'];
$bk_away_moneyline = $sel_row['away_moneyline'];
$bk_home_moneyline = $sel_row['home_moneyline'];
$bk_home_cris = $sel_row['home_cris'];
$bk_away_cris = $sel_row['away_cris'];
###Thegreek Data
$tg_team1_spread = $sel_row['tg_team1_spread'];
$tg_team1_spmoney = $sel_row['tg_team1_spmoney'];
$tg_team2_spread = $sel_row['tg_team2_spread'];
$tg_team2_spmoney = $sel_row['tg_team2_spmoney'];
$tg_tot_overmoney = $sel_row['tg_tot_overmoney'];
$tg_tot_undermoney = $sel_row['tg_tot_undermoney'];
$tg_team1_ML = $sel_row['tg_team1_ML']; // road moneyline
$tg_team2_ML = $sel_row['tg_team2_ML']; // home moneyline
$tg_game_total = $sel_row['tg_game_total'];
// get game score from thegreek
$tg_game_status = $sel_row['tg_game_status'];
###EGDE PART
$tg_spread_edge= $sel_row['tg_spread_edge'];
$bk_spread_edge= $sel_row['bk_spread_edge'];
$tg_ou_edge= $sel_row['tg_ou_edge'];
$bk_ou_edge= $sel_row['bk_ou_edge'];
$tg_ml_edge= $sel_row['tg_ml_edge'];
$bk_ml_edge= $sel_row['bk_ml_edge'];
$tg_spml_edge= $sel_row['tg_spml_edge'];
$bk_spml_edge= $sel_row['bk_spml_edge'];
###RESULT PART
$tg_spread_result= $sel_row['tg_spread_result'];
$bk_spread_result= $sel_row['bk_spread_result'];
$tg_ou_result= $sel_row['tg_ou_result'];
$bk_ou_result= $sel_row['bk_ou_result'];
$tg_ml_result= $sel_row['tg_ml_result'];
$bk_ml_result= $sel_row['bk_ml_result'];
$tg_spml_result= $sel_row['tg_spml_result'];
$bk_spml_result= $sel_row['bk_spml_result'];
if($bk_league=='NFL' || $bk_league=='NBA' || $bk_league=='NHL' || $bk_league=='NCAAF' || $bk_league=='CFB' || $bk_league=='CBB' || $bk_league=='NCAAB' )
{
$curr_month=date('m');
if($curr_month>='08')
$cur_year=date('Y');
else
$cur_year=date('Y')-1;
$next_year=$cur_year+1;
}
else
{
$cur_year=date('Y');
}
if($bk_league=='NFL')
{
$start_month='08' ;$end_month='02';
$end_date=$next_year.'-'.$end_month;
}
elseif($bk_league=='NBA')
{
$start_month='10' ;$end_month='06';
$end_date=$next_year.'-'.$end_month;
}
elseif($bk_league=='NHL')
{
$start_month='09' ;$end_month='06';
$end_date=$next_year.'-'.$end_month;
}
elseif($bk_league=='CFL')
{
$start_month='06' ;$end_month='11';
$end_date=$cur_year.'-'.$end_month;
}
elseif($bk_league=='MLB')
{
$start_month='03' ;$end_month='10';
$end_date=$cur_year.'-'.$end_month;
}
elseif($bk_league=='NCAAF' || $bk_league=='CFB')
{
$start_month='08' ;$end_month='02';
$end_date=$next_year.'-'.$end_month;
}
elseif($bk_league=='NCAAB' || $bk_league=='CBB')
{
$start_month='10' ;$end_month='04';
$end_date=$next_year.'-'.$end_month;
}
$start_date=$cur_year.'-'.$start_month;
$dateclause="( left(game_date,7) between '$start_date' and '$end_date' ) and (away_team not like '%teams%' or home_team not like '%teams%') and (away_team not like '%runs%' or home_team not like '%runs%') ";
if($bk_league == "NBA")
{
$league1 = "3";$lname='NBA';
}
if($bk_league == "NHL")
{
$league1 = "7";$lname='NHL';
}
if($bk_league == "CFL")
{
$league1 = "18";$lname='CFL';
}
if($bk_league == "NFL")
{
$league1 = "1";$lname='NFL';
}
if($bk_league == "MLB")
{
$league1 = "5";$lname='MLB';
}
if($bk_league == "CFB" || $bk_league == "NCAAF")
{
$league1 = "2";$lname='NCAAF';
}
if($bk_league == "CBB" || $bk_league == "NCAAB")
{
$league1 = "4";$lname='NCAAB';
}
$tablename=strtolower($lname).'_teams';
// get this game from new_asp_schedule table (THEGREEK DATA)
$select_query1 = "SELECT * FROM new_asp_schedule WHERE league_no='$league1' AND game_date='$bk_game_date' AND game_no1='$bk_away_game_no' AND game_no2='$bk_home_game_no' order by game_date desc limit 1 ";
//echo "select_query1=$select_query1
";
$sel_res1 = mysql_query($select_query1);
$sel_num1 = mysql_num_rows($sel_res1);
if($sel_num1)
{
// do processing if game exists in both tables.
while($sel_row1 = mysql_fetch_array($sel_res1))
{
$tg_team1 = $sel_row1['team1']; // road moneyline
$tg_team2 = $sel_row1['team2']; // home moneyline
/*$tg_team1_spread = $sel_row1['team1_spread'];
$tg_team1_spmoney = $sel_row1['team1_spmoney'];
$tg_team2_spread = $sel_row1['team2_spread'];
$tg_team2_spmoney = $sel_row1['team2_spmoney'];
$tg_tot_overmoney = $sel_row1['tot_overmoney'];
$tg_tot_undermoney = $sel_row1['tot_undermoney'];
$tg_team1_ML = $sel_row1['team1_ML']; // road moneyline
$tg_team2_ML = $sel_row1['team2_ML']; // home moneyline
$tg_game_total = $sel_row1['game_total'];
// get game score from thegreek
$tg_game_status = $sel_row1['game_status'];*/
$tg_road_team_score = $sel_row1['team1_score'];
$tg_home_team_score = $sel_row1['team2_score'];
if($lname=='NBA' || $lname=='CFL' || $lname=='NFL' || $lname=='NHL')
{
$tablevar='nick_name';
$chkl_tname1=mysql_query("select $tablevar from $tablename where new_teamname='$tg_team1'");
list($tg_team1name)=mysql_fetch_array($chkl_tname1);
$chkl_tname2=mysql_query("select $tablevar from $tablename where new_teamname='$tg_team2'");
list($tg_team2name)=mysql_fetch_array($chkl_tname2);
}
elseif($lname=='CFB' || $lname=='NCAAF')
{
$tablevar='score_teamname';
$chkl_tname1=mysql_query("select $tablevar from $tablename where new_teamname='$tg_team1'");
list($tg_team1name)=mysql_fetch_array($chkl_tname1);
$chkl_tname2=mysql_query("select $tablevar from $tablename where new_teamname='$tg_team2'");
list($tg_team2name)=mysql_fetch_array($chkl_tname2);
}
elseif($lname=='MLB')
{
$tablevar='alias_teamname';
$chkl_tname1=mysql_query("select $tablevar from $tablename where new_teamname='$tg_team1'");
list($tg_team1name)=mysql_fetch_array($chkl_tname1);
$chkl_tname2=mysql_query("select $tablevar from $tablename where new_teamname='$tg_team2'");
list($tg_team2name)=mysql_fetch_array($chkl_tname2);
}
/*else
{
$tg_team1name=$tg_team1;
$tg_team2name=$tg_team2;
}*/
}#end while
if($bk_league == "NHL" || $bk_league=='MLB')
{
if($tg_team1name!='' && $tg_team2name!='')
{
?>
| League: Date:- |
| Game |
TheGreek |
Bookmaker |
TheGreek |
Bookmaker |
TheGreek |
Bookmaker |
|
ML |
ML |
O/U |
O/U |
ATS |
ATS |
|
|
|
|
|
|
}
else
{
?>
|
}?>
|
| () |
|
|
|
|
|
|
| () |
|
|
|
|
|
|
| Edge |
|
|
|
|
|
|
| Result |
|
|
|
|
|
|
for($aa=1;$aa<3;$aa++)
{
if($aa==1)
{
$aa11=7;
}
else
{
$aa11=30;
}
//$val11=7*$aa;
$dateval=86400 * $aa11;
$startdate =date('Y-m-d',time()-$dateval);
$enddate = date("Y-m-d");
$getresultval=getresult($startdate,$enddate,$bk_league,$dateclause);
$getresultarray=explode("~",$getresultval);
$tg_Wspreadnum=$getresultarray[0];
$tg_Lspreadnum=$getresultarray[1];
$bk_Wspreadnum=$getresultarray[2];
$bk_Lspreadnum=$getresultarray[3];
$tg_Wmlnum=$getresultarray[4];
$tg_Lmlnum=$getresultarray[5];
$bk_Wmlnum=$getresultarray[6];
$bk_Lmlnum=$getresultarray[7];
$tg_Wounum=$getresultarray[8];
$tg_Lounum=$getresultarray[9];
$bk_Wounum=$getresultarray[10];
$bk_Lounum=$getresultarray[11];
$tg_Wspmlnum=$getresultarray[12];
$tg_Lspmlnum=$getresultarray[13];
$bk_Wspmlnum=$getresultarray[14];
$bk_Lspmlnum=$getresultarray[15];
?>
| Last Days YTD Record(W-L) |
- |
- |
- |
- |
- |
- |
} ?>
}
}#if($bk_league == "NHL" || $bk_league='MLB')
else
{
?>
| League: Date:- |
| Game |
TheGreek |
Bookmaker |
TheGreek |
Bookmaker |
TheGreek |
Bookmaker |
|
Spread |
Spread |
O/U |
O/U |
ML |
ML |
| () |
|
|
|
|
|
|
| () |
|
|
|
|
|
|
| Edge |
|
|
|
|
|
|
| Result |
|
|
|
|
|
|
for($aa=1;$aa<3;$aa++)
{
if($aa==1)
{
$aa11=7;
}
else
{
$aa11=30;
}
//$val11=7*$aa;
$dateval=86400 * $aa11;
$startdate =date('Y-m-d',time()-$dateval);
$enddate = date("Y-m-d");
$getresultval=getresult($startdate,$enddate,$bk_league,$dateclause);
$getresultarray=explode("~",$getresultval);
$tg_Wspreadnum=$getresultarray[0];
$tg_Lspreadnum=$getresultarray[1];
$bk_Wspreadnum=$getresultarray[2];
$bk_Lspreadnum=$getresultarray[3];
$tg_Wmlnum=$getresultarray[4];
$tg_Lmlnum=$getresultarray[5];
$bk_Wmlnum=$getresultarray[6];
$bk_Lmlnum=$getresultarray[7];
$tg_Wounum=$getresultarray[8];
$tg_Lounum=$getresultarray[9];
$bk_Wounum=$getresultarray[10];
$bk_Lounum=$getresultarray[11];
$tg_Wspmlnum=$getresultarray[12];
$tg_Lspmlnum=$getresultarray[13];
$bk_Wspmlnum=$getresultarray[14];
$bk_Lspmlnum=$getresultarray[15];
?>
| Last Days YTD Record (W-L) |
- |
- |
- |
- |
- |
- |
}?>
}
}// end if($sel_num1)
}// end while($sel_row
}// end if($sel_num)
else
{
?>
| League: |
| No Games Found For Current Date |
}
?>
if($pst=="true")
{
}
elseif($pstpicks=="true")
{
}
else
{
//require "Templates/atsdb2_footer_new_inner_0705.php";
require "Templates/atsdb2_footer_new.php";
}
?>