Exemplo n.º 1
0
    // end if
    // if current page is greater than total pages...
    if ($currentpage > $totalpages) {
        // set current page to last page
        $currentpage = $totalpages;
    }
    // end if
    // if current page is less than first page...
    if ($currentpage < 1) {
        // set current page to first page
        $currentpage = 1;
    }
    // end if
    // the offset of the list, based on current page
    $offset = ($currentpage - 1) * $rowsperpage;
    $rooms = getSeasonData($offset, $rowsperpage);
    foreach ($rooms as $i => $value) {
        $link = 'updateseason.php?id=' . $value['season_id'];
        $del = $_SERVER['PHP_SELF'] . '?id=' . $value['season_id'];
        ?>
<tr class="table-content"><td width="20"><input type="checkbox" name="season[]" value="<?php 
        echo $value['season_id'];
        ?>
" /></td>
<td><?php 
        echo $value['season_id'];
        ?>
</td>
<td><?php 
        echo $value['season_name'];
        ?>
<?php

//BE WARNED - RUNNING THIS WILL REMOVE THE 2013/2014 PREFIX TO THE COUNTRIES
$root = "/home/football/www/";
include $root . 'dbconnect_new.php';
require_once $root . 'api/v2/app_functions.php';
getSeasonData();
function getSeasonData()
{
    global $dbconn;
    $now_alternative = date('Y-m-d H:m:s');
    $url = 'http://data2.scorespro.com/exporter/json.php?state=clientStructure&type=12&s=1';
    $cURL = curl_init();
    curl_setopt($cURL, CURLOPT_URL, $url);
    curl_setopt($cURL, CURLOPT_HTTPGET, true);
    curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($cURL, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json'));
    $result = curl_exec($cURL);
    $json = json_decode($result, true);
    curl_close($cURL);
    $seasonData = $json['list'];
    $englandSeasonID = nil;
    foreach ($seasonData as $key) {
        $seasonID = $key['id'];
        $name = $key['name'];
        if (is_numeric($seasonID)) {
            if ($name == '2014/2015') {
                getCountriesFromSeasonID($seasonID);
            }
        }
    }