USER = ".$_GET['USER']);
echo("
LIB_NAME = ".$_GET['LIB_NAME']);
echo("
branch = ".$_GET['branch']);
die("
die");
*/
header("Content-Type: image/svg+xml");
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date dans le passé
/*
header('Content-Type: image/svg+xml');
echo '';
*/
function errorSVG($_name) {
echo('');
exit();
}
include_once("connect.php");
@include_once("connect_server.php");
$TEST_bdd = mysqli_connect($sqlServer, $sqlLogin, $sqlPass, $sqlBDD);
// Check connection
if (mysqli_connect_errno()) {
errorSVG("SQL ERROR");
}
// check if all is here ...
$branch = "master";
if (isset($_GET['USER']) == FALSE) {
errorSVG("USER??");
} else if (isset($_GET['LIB_NAME']) == FALSE) {
errorSVG("LIB_NAME??");
}
if (isset($_GET['branch']) == TRUE) {
$branch = $_GET['branch'];
}
//echo "register ".$_POST['JSON_FILE'];
$sql = "SELECT `TEST_list`.`passed` "
." , `TEST_list`.`total` "
." FROM `TEST_list`"
." , `CI_group`"
." WHERE `CI_group`.`user-name` = '".$_GET['USER']."'"
." AND `CI_group`.`lib-name` = '".$_GET['LIB_NAME']."'"
." AND `CI_group`.`lib-branch` = '".$branch."'"
." AND `CI_group`.`id` = `TEST_list`.`id-group`"
." ORDER BY `TEST_list`.`time` DESC"
." LIMIT 1";
$result = $TEST_bdd->query($sql);
//echo("sql : ".$sql);
if ($result == NULL) {
errorSVG("UNKNOW");
}
//echo("find result : ".$result);
if ($result->num_rows > 0) {
if ($result->num_rows > 1) {
errorSVG("To much value");
}
$row = $result->fetch_assoc();
} else {
errorSVG("No Value");
}
if ($row['total'] == 0) {
$testRatio = 0;
} else {
$testRatio = intval(100 * $row['passed'] / $row['total']);
}
//some testRatio value :
if ($testRatio < 25 ) {
$color = "c11";
} else if ($testRatio < 50 ) {
$color = "c1c";
} else if ($testRatio < 100 ) {
$color = "c71";
} else {
$color = "4c1";
}
echo('');
// simply close link with the DB...
$TEST_bdd->close();
?>