Пример #1
0
function urlBdt($url, $fields = array())
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://www.bancdetouche.fr/" . $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    if (count($fields) > 0) {
        $fields_string = '';
        foreach ($fields as $key => $value) {
            $fields_string .= $key . '=' . $value . '&';
        }
        rtrim($fields_string, '&');
        curl_setopt($ch, CURLOPT_POST, count($fields));
        curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
    }
    $resultat = curl_exec($ch);
    $cookie = substr(extrait($resultat, 'Set-Cookie:', ';'), 12, 45);
    $info = curl_getinfo($ch);
    if (isset($info['http_code'])) {
        $code_ret = $info['http_code'];
    } else {
        $code_ret = 302;
    }
    curl_close($ch);
    return array($code_ret, $cookie);
}
Пример #2
0
<?php

define("RelativePathTop", "../../libs/top/");
include RelativePathTop . "top_lib.php";
$page = "<div class=\"ui-grid-b\">\n            <bloc::ligne>\n            <div class=\"ui-block-a\">\n                <h4>Journée {journee}</h4>\n            </div>\n            <div class=\"ui-block-b\" style=\"text-align: center;\">\n                <h4><a href=\"#pageten\" value=\"{journee}\" data-transition=\"slide\">{point}</a></h4>\n            </div>\n            <div class=\"ui-block-c\" style=\"text-align: center;\">\n            </div>\n            </bloc::ligne>\n        </div>";
$cookie = GetFromPost('cookie');
$courbe = courbeResultat($cookie);
$contenu = extrait($courbe, 'l2 = paper.text', '</script>');
preg_match_all('#text\\(([0-9]*)[^0-9]*([0-9]*)[^0-9]*([0-9]*)#', $contenu, $match);
$result = array();
$retour = array();
$str = '';
$nb = count($match[0]);
for ($i = 0; $i < $nb; $i++) {
    $result[$match[1][$i]][$match[2][$i]] = $match[3][$i];
}
foreach ($result as $x => $y) {
    foreach ($y as $val) {
        $retour[] = intval($val);
    }
}
$nb = count($retour);
$Tpl->chargeBuffer($page);
for ($i = $nb; $i > 0; $i--) {
    $Tpl->Parse('ligne.journee', $i);
    $Tpl->Parse('ligne.point', $retour[$i - 1]);
    $Tpl->Loop('ligne');
}
$resultat = array();
if ($nb) {
    $resultat['courbe'] = $retour;
Пример #3
0
    for ($i = 0; $i < $nb; $i++) {
        if ($etat[$i] == 0) {
            $Tpl->Parse('ligne.maillot', $maillot[$i]);
            $Tpl->Parse('ligne.num', $num[$i]);
            $Tpl->Parse('ligne.nom', $nom[$i]);
            $Tpl->Parse('ligne.achat', $achat[$i]);
            $Tpl->Parse('ligne.equipe', $equipe[$i]);
            $Tpl->Loop('ligne');
            $nbl++;
        }
    }
    if ($nbl) {
        $Tpl->eraseBloc('budgetzero');
    } else {
        $Tpl->eraseBloc('ligne');
    }
    $html = $Tpl->output();
    echo utf8_encode($html);
}
if ($action == 'vendre' && $num != 0) {
    confirmeVente($cookie, $num);
    $membreinfo = membreInfo($cookie);
    $portefeuille = extrait($membreinfo, 'Portefeuille', 'M');
    $achat = extrait($membreinfo, 'Valeur achat', 'M');
    $vente = extrait($membreinfo, 'Valeur vente', 'M');
    $retour = '<h5>' . $portefeuille . '</h5><h5>' . $achat . '&nbsp;/&nbsp;' . $vente . '</h5>';
    echo $retour;
}
if ($action == 'capitaine' && $num != 0) {
    miseAJourCapitaine($cookie, $num);
}
Пример #4
0
<?php

define("RelativePathTop", "../../libs/top/");
include RelativePathTop . "top_lib.php";
$page = "<div align=\"center\">{pageone}</div>\n         <a id=\"link_page2\" href=\"#pagetwo\">Identifiez vous</a>";
$edito = edito();
$part1 = extrait($edito, '<table cellpadding', '</table>');
$val = extrait($edito, 'getElementById("prochmatch', ';');
preg_match('#value=\'([0-9]*)([^0-9]*)([0-9]*)([^0-9]*)([0-9]*)([^0-9]*)([0-9]*)([^0-9]*)([0-9]*)#', $val, $match);
$date = padLeft($match[1]) . " / " . padLeft($match[3]) . " / " . padLeft($match[5]) . " " . padLeft($match[7]) . ":" . padLeft($match[9]);
$part2 = '<script type="text/javascript">document.getElementById("prochmatch").value=\'' . $date . '\';</script>';
$part3 = str_replace('<marquee ', '<marquee style="width: 400px;" ', extrait($edito, '<marquee', '</marquee>'));
$part3 = str_replace('marquee ', 'div', $part3);
$contenu = $part1 . $part2 . $part3;
$contenu = str_replace('style="', 'style="text-align: center;', $contenu);
preg_match('#(J[0-9]{1,2})#', $part3, $match);
$journee = trim(substr($match[1], 1));
$Tpl->chargeBuffer($page);
$Tpl->Parse('pageone', $contenu);
$resultat = array();
$resultat['html'] = $Tpl->output();
$resultat['journee'] = $journee;
echo json_encode($resultat);