edsGetUrl.php 1.73 KB
Newer Older
Hamza Arfaoui's avatar
Hamza Arfaoui committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
<?php
// PCZ - NETISSE - 2013/12/12 : WEBSERVICE DE RECUPERATION D'URL DE PILE A PARTIR D'UN EDS
// http://localhost:8888/credit/front/edsGetUrl.php?eds=573
// http://cans.netisse.eu/edsGetUrl.php?eds=458
// https://cl00pavnts01.zcam.ztech/edsGetUrl.php?ip=10.167.145.150&mat=Y007153&eds=00201

// 00201 = Aigrefeuille
// 00213 = Blain		IP Blain = 10.167.145.139	10.167.145.229


include("./inc/confNetisse.php");
if (!isset($_REQUEST["eds"])) {
	header("Location:./eds.php?e=1");
} else {
	$EDS = $_REQUEST["eds"];
	
	// PCZ : 2020/06/22 : DETECTION DE L'ADRESSE IP DU CONSEILLER
	$IP = "000.000.000.000";
	if ($_REQUEST["ip"]) $IP = $_REQUEST["ip"];
	
	$tab = explode(".", $IP);		
            if (strlen($tab[0]) < 3) {
                $tab[0] = str_pad($tab[0], 3, '0', STR_PAD_LEFT);
            }		
            if (strlen($tab[1]) < 3) {
                $tab[1] = str_pad($tab[10], 3, '0', STR_PAD_LEFT);
            }		
            if (strlen($tab[2]) < 3) {
                $tab[2] = str_pad($tab[2], 3, '0', STR_PAD_LEFT);
            }		
            if (strlen($tab[3]) < 3) {
                $tab[3] = str_pad($tab[3], 3, '0', STR_PAD_LEFT);
            }		
            $IP = $tab[0].".".$tab[1].".".$tab[2].".".$tab[3];

	
	$MAT = "";
	if (isset($_REQUEST["eds"])) $MAT = $_REQUEST["mat"];
	$q = "SELECT code_agence FROM ca_agences WHERE eds LIKE CONCAT('%', :eds, '%') and supp=:supp";
	$v = array(':eds' => $EDS, 'supp' => 0);
	$stmt = excuteQuery($q, $v);
	$r = $stmt['stmt'];
	$n = $r->rowCount();
//echo "<li>N=".$n."</li>";	
	if ($n != 1) {
		header("Location:./eds.php?e=2&eds=".$EDS);
	} else if ($n == 1) {
		$CODE = $r->fetchColumn(0);
		//header("Location:./pile/?IDA=".$CODE."&MAT=".$MAT."&IP=".$IP);
		header("Location:./pile/?IDA=".$CODE);
	}
}
?>