over-all

[insert_php]

global $wpdb, $current_user, $searcher;
require_once($_SERVER[‘DOCUMENT_ROOT’].’/wp-content/themes/enlightenment-child/helper_search.php’);
require_once($_SERVER[‘DOCUMENT_ROOT’].’/wp-content/themes/enlightenment-child/checkuser.php’);
$searcher = new search_helper;
require_once($_SERVER[‘DOCUMENT_ROOT’].’/wp-content/themes/enlightenment-child/wordpress-helper.php’);
$wphelper = new wordpress_helper;
require_once($_SERVER[‘DOCUMENT_ROOT’].’/wp-content/themes/enlightenment-child/predictors.php’);

$predictors = new Predictors;

require_once($_SERVER[‘DOCUMENT_ROOT’].’/wp-content/themes/enlightenment-child/simple_html_dom.php’);

if ($current_user->user_login <>‘root’) return;

//if ($current_user->user_login <>‘root’) return;
set_time_limit(0);

$query = ‘SELECT * FROM jos_fixtures ‘;
echo $query;
$fixtures = $wpdb->get_results($query);

foreach($fixtures as $row)
{
if ($row->country_div == ‘English Premier’) $cntr = ‘english/premier-league’;
if ($row->country_div == ‘Holland’) $cntr = ‘netherlands/eredivisie’;
if ($row->country_div == ‘Spain’) $cntr = ‘spain/la-liga-primera’;
if ($row->country_div == ‘Italy’) $cntr = ‘italy/serie-a’;
if ($row->country_div == ‘French’) $cntr = ‘france/ligue-1’;
if ($row->country_div == ‘Championship’) $cntr = ‘english/championship’;
if ($row->country_div == ‘Portugal’) $cntr = ‘portugal/primeira-liga’;
if ($row->country_div == ‘Belgium’) $cntr = ‘belgium/jupiler-pro-league’;
if ($row->country_div == ‘Scotland’) $cntr = ‘scottish/premiership’;

echo “before checkteam HOME TEAM “.$row->h_team. ‘
‘;
echo “before checkteam AWAY TEAM “.$row->a_team. ‘

‘;

$h_team = $searcher->checkteam($row->h_team);
$a_team = $searcher->checkteam($row->a_team);
echo “after checkteam HOME TEAM “.$h_team. ‘
‘;
echo “after checkteam AWAY TEAM “.$a_team. ‘

‘;

$url[0] = “https://www.oddschecker.com/football/”.$cntr.”/”.$h_team.”-v-“.$a_team.”/total-goals-over-under”;

$xx=0;
while ($xx < 1) { $ItemPage = get_pager($url[$xx]); $returnArray = array(); echo "
URL IS “.$url[$xx].”
“;

if (!empty($ItemPage))
{
$html = str_get_html($ItemPage);

foreach ($html->find(‘table’) as $e)
{
foreach ($e->find(‘tr’) as $kk)
{
if($kk->{‘data-bname’} != “”)
{
//echo $lineno.’ ‘.$kk->{‘data-bname’};

$cnt = 0;
$tot = 0;
foreach ($kk->find(‘td[data-odig]’) as $kkk)
{
//echo ” “.$kkk->{‘data-odig’};echo ” “;
if ($kkk->{‘data-odig’} > 0)
{
$cnt = $cnt + 1;
$tot = $tot + $kkk->{‘data-odig’};
}
}
$avg = $tot/$cnt;

$exploded = explode(“/”,$kk->{‘data-bname’});
echo “value sent to rcheckteam “.$exploded[0].’
‘;
$aa = $searcher->rcheckteam($exploded[0]);

$bb = $exploded[1];

/* echo “team to check is “,$aa.’
‘;
echo “row->h_team “,$row->h_team.’
‘;
echo “row->a_team “,$row->a_team.’
‘;
if ($aa == $row->h_team)
$homeaway =’HOME’;
elseif ($aa == $row->a_team)
$homeaway =’AWAY’;
else
continue;
*/
echo “INDEX IS “.$row->index.” “. $aa.”/”.$bb .’ ‘.$row->h_team.’ ‘.
$row->a_team .’ ‘.$homeaway. ‘ AVG IS ‘ . $avg.’
‘;

if ($aa == ‘Over 2.5’ )
{
echo ‘ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbupdating in here’;
$xxx = “update jos_fixtures set over25 =”. $avg .
” where h_team = ‘”.$row->h_team. “‘ and a_team = ‘”.$row->a_team.”‘”;

$wpdb->Query($xxx);
}

if ($aa == ‘Under 2.5’ )
{
echo ‘ uAAAAAAAAAAAAAAAAAAAAAAApdating in here’;
$xxx = “update jos_fixtures set under25 =”. $avg .
” where h_team = ‘”.$row->h_team. “‘ and a_team = ‘”.$row->a_team.”‘”;
$wpdb->Query($xxx);

}

}
}
}
} // end of the loop here
$xx = $xx + 1;
}
} // end of main loop

$xx = $predictors->update_jos_fixtures();

function get_pager($url)
{
//echo $url;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_USERAGENT,’Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13’);
$html = curl_exec($ch);
return $html;
}

[/insert_php]