Rebonjour,
Le jour se lève et le camembert est toujours au frigo !
Il se fait désirer...
Voici un point du jour (c'est le cas de le dire !) :
1.
Dans ma page principale :
je charge l'image
<img src="php/statspieclics.php?stat=<?php echo $graphStat; ?>&dateref01=<?php echo $dateref01; ?>&dateref02=<?php echo $dateref02; ?>">
en appelant donc...
Et là encore, je retombe sur l'affichage d'une image vide !
Pire, on dirait que le navigateur ne tient pas compte des arguments passés dans l'url !
2.
Pouvez-vous m'aider pour le Memory leak ?
Aidez-moi, s'il-vous-plaît,
j'ai l'impression de tourner en rond !
Au secours !
Merci d'avance !
Voici les codes :
"www.creaprint.be/statistiques20.php"
<?php
session_start();
ob_start();
$php="statistiques20";
$rubrique="admin";
require_once("php/cliquer.inc.php");
cliquer($rubrique);
$travaux="oui";
date_default_timezone_set('Europe/Brussels');
$dd = date("Ymd");
$dateref00="20120701";
if (isset($_GET['stat']) && !empty($_GET['stat'])) {
$graphStat=$_GET['stat'];
if ($graphStat != 4) {
header("Location: index.php");
exit;
}
} else {
header("Location: index.php");
exit;
}
if (isset($_GET['ok']) && !empty($_GET['ok'])) {
$ok=$_GET['ok'];
} else {
$ok=0;
$_POST['date01']=formatdate($dd);
$_POST['date02']=$_POST['date01'];
}
if ($ok==1) {
$dateref01=enregdate($_POST['date01']);
$dateref02=enregdate($_POST['date02']);
if ($dateref01 != "" AND $dateref02 != "") {
if ($dateref01 > $dateref02) {
$inter=$dateref01;
$dateref01=$dateref02;
$dateref02=$inter;
$_POST['date01']=formatdate($dateref01);
$_POST['date02']=formatdate($dateref02);
}
if ($dateref02 > $dd) {
$dateref02=$dd;
$_POST['date02']=formatdate($dateref02);
}
if ($dateref01 < $dateref00) {
$dateref01=$dateref00;
$_POST['date01']=formatdate($dateref01);
}
$diffjour= $dateref02 - $dateref01 +1;
if ($diffjour > 1) {
$diffjour .= " jours";
} else {
$diffjour .= " jour";
}
if ($dateref02 == $dd) {
$diffjour = "< ".$diffjour;
}
} else {
$_POST['date01']=formatdate($dateref01);
$_POST['date02']=formatdate($dateref02);
$ok=0;
}
}
function formatdate($datum) {
if ($datum == "00000000" OR $datum == "") {
$datum="";
} else {
$datum = substr($datum,6,2)."/".substr($datum,4,2)."/".substr($datum,0,4);
}
return $datum;
}
function enregdate($datum) {
if (strlen($datum)>0) {
$datum = str_replace("/","",$datum);
$datum = substr($datum,4,4).substr($datum,2,2).substr($datum,0,2);
} else {
$datum = "";
}
return $datum;
}
ob_end_flush();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<LINK REL="SHORTCUT ICON" href="logos/favicon.ico">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name = "reply-to" content = "flvandoorne@creaprint.be"/>
<meta name = "author" content = "creaprint"/>
<meta name = "description" content = "accueil"/>
<meta name = "keywords" content = "creaprint creaprint.be sitecreaprint.be creation impression webdesign site internet web logo carte visite cartons entete flyer affiche catalogue plaquette annonce presse packaging lettrage gif anime newsletter e-commerce vitrine kit promo boutique e-boutique www.creaprint.be www.sitecreaprint.be florence vandoorne deportes 7730 estaimpuis belgique paypal virement mastercard visa "/>
<title>creaprint.be - Statistiques</title>
<style type="text/css">
<!--
-->
</style>
<script type="text/javascript">
<!--
function compZero(nombre) {
return nombre < 10 ? '0' + nombre : nombre;
}
function date_heure() {
var infos = new Date();
//Heure
document.getElementById('heure').innerHTML = compZero(infos.getHours()) + ':' + compZero(infos.getMinutes()) + ':' + compZero(infos.getSeconds());
//Date
var mois = new Array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre');
var jours = new Array('dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi');
document.getElementById('journee').innerHTML = 'Nous sommes le ' + jours[infos.getDay()] + ' ' + infos.getDate() + ' ' + mois[infos.getMonth()] + ' ' + infos.getFullYear() + ' à';
setInterval("date_heure()", 1000); //Actualisation de l'heure
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function isValidDate(d) {
var dateRegEx = /^((((0?[1-9]|[12]\d|3[01])[\.\-\/](0?[13578]|1[02])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|((0?[1-9]|[12]\d|30)[\.\-\/](0?[13456789]|1[012])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|((0?[1-9]|1\d|2[0-8])[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|(29[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00)))|(((0[1-9]|[12]\d|3[01])(0[13578]|1[02])((1[6-9]|[2-9]\d)?\d{2}))|((0[1-9]|[12]\d|30)(0[13456789]|1[012])((1[6-9]|[2-9]\d)?\d{2}))|((0[1-9]|1\d|2[0-8])02((1[6-9]|[2-9]\d)?\d{2}))|(2902((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00))))$/;
return d.match(dateRegEx);
}
function validationdate(inp) {
var date = new Date();
datum = inp.value;
if (datum != "") {
datum = datum+'//';
segment = datum.split('/');
jj = segment[0];
mm = segment[1];
aaaa = segment[2];
if (!isNaN(jj+mm+aaaa)) {
jj = jj + "";
if (jj.length == 1) {
jj = "0"+jj;
}
if (mm == 0) {
mm = date.getMonth()+1;
}
mm = mm + "";
if (mm.length == 1) {
mm = "0"+mm;
}
if (aaaa.length == 0) {
aaaa = date.getFullYear();
}
aaaa = aaaa + "";
if (aaaa.length == 2) {
aaaa = "20"+aaaa;
}
datum = jj+"/"+mm+"/"+aaaa;
if (!isValidDate(datum)) {
inp.style.backgroundColor="#faf0c5";
inp.value="";
} else {
inp.style.backgroundColor="";
inp.value=datum;
}
} else {
inp.style.backgroundColor="#faf0c5";
inp.value="";
}
} else {
inp.style.backgroundColor="";
inp.value="";
}
}
//-->
</script>
<link rel="alternate" type="application/rss+xml" title="ROR" href="sitemap.xml" />
<link href="css/general.css" rel="stylesheet" type="text/css" media="all">
<link href="css/statistiques.css" rel="stylesheet" type="text/css" media="all">
<link href="css/statistiques20.css" rel="stylesheet" type="text/css" media="all">
</head>
<body onload = "date_heure(); MM_preloadImages('images/general/euroON.gif','images/general/statsON.gif','images/general/puzzleON.gif','images/general/compteON.gif','images/general/clicON.gif','images/general/pie_on.gif')">
<div id="referencement">
<h1>creaprint<br>creaprint.be<br>sitecreaprint.be<br>creation<br>impression<br>site internet<br>e-boutique<br>boutique<br>kit promo<br>www.creaprint.be</h1>
<h1>e-boutique boutique internet boutique en ligne</h1>
<h2>aministrateur<br>statistique periode frequentation camembert</h2>
<h3>Florence VANDOORNE Boulevard des Déportés 67A BE 7730 estaimpuis belgique +32 473 75 31 37 flvandoorne@skynet.be</h3>
<h3>logos<br>carte visite carton entete<br>flyer affiche annonce presse<br>packaging boite sachet carton emballage opercule<br>catalogue plaquette magazine<br>lettrage vehicule voiture camion autocar vitrine<br>site internet</h3>
<h3>site internet vitrine<br>site internet e-commerce<br>gif anime<br>newsletter<br>kit promo</h3>
</div>
<div id="ombre">
<div id="site">
<div id="caddie" <?php echo (isset($_COOKIE['CFVespace']))?"style='visibility:visible;'":"style='visibility:hidden;'"; ?>><a href="boutique10.php"><img src="images/general/caddie.jpg" width="30" height="30" alt="caddie"></a></div>
<div id="visuel">
<div id="entete"><a href="index.php"><img src="images/general/logo_creaprint.png" alt="creaprint" width="291" height="105" align="left"></a><img src="images/general/grand_cmyb.gif" width="260" height="105" alt="cmyb" align="left"></div>
<div id="versespace"><img src="images/general/cadenas<?php echo (isset($_COOKIE['CFVespace']))?"ferme":"ouvert"; ?>.gif" alt="espace_client" width="125" height="105" border="0" usemap="#Map2">
<map name="Map2">
<area shape="rect" coords="10,-2,126,82" <?php echo (isset($_COOKIE['CFVespace']))?"":"href='espace20.php?p=".$php."'"; ?> alt="login">
</map>
</div>
<div id="bienvenue" <?php echo (isset($_COOKIE['CFVespace']))?"style='visibility:visible;'":"style='visibility:hidden;'"; ?>><p style="padding-right:9px;">Bienvenue<br>dans votre</p><p id="moncompte"><a href="espace00.php">Mon compte</a></p><p id="deconnexion"><a href="php/espaceOFF.php?p=<?php echo $php; ?>">DECONNEXION</a></p></div>
<div id="separateurH01"><img src="images/general/trait_orange.gif" width="676" height="6" alt="separateurH02" align="left">
</div>
<div id="menu"><img src="images/general/menu_bonhommes.gif" width="126" height="147" alt="menu" align="left"><img src="images/general/menu_photo.png" width="550" height="147" alt="presentation" align="left">
</div>
<div id="menu_options">
<ul>
<li><a href="index.php">ACCUEIL</a></li>
<li><a href="creation00.php">CRÉATION</a></li>
<li><a href="impression00.php">IMPRESSION</a></li>
<li><a href="webdesign00.php">SITE WEB</a></li>
<li><a href="kitpromo00.php">KIT PROMO</a></li>
<li><a href="boutique00.php">BOUTIQUE</a></li>
<li><a href="contact00.php">CONTACT</a></li>
</ul>
</div>
<div id="separateurH02"><img src="images/general/trait_grisclair.gif" width="676" height="6" alt="separateurH02" align="left">
</div>
<div id="contenu">
<div id="bloc00">
<div align="left" class="c15 blanc bold" style="padding-left:8px; margin-top:8px;">Statistiques de clics sur les pages du site sur une période précise</div>
</div>
<form name="myform" action="statistiques20.php?stat=<?php echo $graphStat; ?>&ok=1" method="post">
<div id="graphique02">
<table border="0" cellspacing="0" style="padding-top:2px; vertical-align:middle;" width="275">
<tr>
<td width="80"></td>
<td width="100"></td>
<td width="95"></td>
</tr>
<tr>
<td align="right">Période du </td>
<td><input name="date01" type="text" id="date01" height="15" size="10" value="<?php echo $_POST['date01']; ?>" class="zone1 <?php echo ($ok==1 && empty($_POST['date01']))?'valable':'valable'; ?>" onBlur="validationdate(this);"></td>
<td align="right" class="bold"><?php echo $diffjour; ?></td>
</tr>
<tr>
<td align="right">au </td>
<td><input name="date02" type="text" id="date02" height="15" size="10" value="<?php echo $_POST['date02']; ?>" class="zone1 <?php echo ($ok==1 && empty($_POST['date02']))?'valable':'valable'; ?>" onBlur="validationdate(this);"></td>
<td></td>
</tr>
</table>
</div>
</form>
<div id="graphique03">
<?php
if ($ok == 1) {
?>
<img src="php/statspieclics.php?stat=<?php echo $graphStat; ?>&dateref01=<?php echo $dateref01; ?>&dateref02=<?php echo $dateref02; ?>">
<?php
}
?>
</div>
<div id="journee"></div>
<div id="heure"></div>
<div id="standby"></div>
<div id="valider"><a href="#" onclick="javascript:document.myform.submit();">Valider</a></div>
</div>
<div id="separateurH03"><img src="images/general/trait_grisfonce.gif" width="676" height="6" alt="separateurH03" align="left"></div>
<div id="pied">
<div id="recherche" style="margin-top:8px; float:left; width:168px; height:27px; border:2px solid #DDDDDD; background-color: #737373;">
<a href="recherche00.php">
<img src="images/general/recherche.gif" width="17" height="17" alt="recherche" style="float:left; margin-left:6px; margin-top:5px; margin-right:8px;">
<div style="margin-top:7px;" class="c12 bold">Je cherche sur le site</div>
</a>
</div>
<div style="float:left; width:45px; padding-left:5px;">
<div><a href="paiement00.php"><img src="images/general/mastercardOFF.gif" width="45" height="28" alt="mastercard" style="margin-top:9px;"></a></div>
<div><a href="paiement00.php"><img src="images/general/visaOFF.gif" width="45" height="28" alt="visa"></a></div>
</div>
<div style="margin-left:5px; margin-top:8px; float:left;"><img src="images/general/trait_grisclair.gif" width="3" height="60" alt="promo_du_mois"></div>
<div class="c11 bleu" style="margin-left:10px; margin-top:6px; height:45px; padding-top:15px; padding-left:10px; float:left;">
<a href="index.php" class="bleu">Accueil</a> |
<a href="contact00.php" class="bleu">Contact</a> |
<a href="promotions00.php" class="bleu">Promotions</a> |
<a href="recherche00.php" class="bleu">Recherche</a> |
<a href="paiement00.php" class="bleu">Paiement</a> |
<a href="conditions00.php" class="bleu">Conditions de vente</a> |
<a href="faq00.php" class="bleu">Aide</a>
<div id="divers">Ce site et l'ensemble des informations qui y sont contenues sont soumis<br>
aux lois du Copyright © 2012 Créaprint</span> - <a href="mentions00.php">Mentions légales</a><br>
Design et réalisation : <a href="http://www.creaprint.be">www.creaprint.be</a></div>
</div>
</div>
<div id="commande"><img src="images/general/commande.png" alt="commande" width="141" height="181" border="0" usemap="#Map">
<map name="Map">
<area shape="poly" coords="22,46,15,71,67,152,71,155,134,115,135,108,82,26,62,21" href="boutique00.php" alt="commande">
</map>
</div>
<a href="login00.php"><div id="login"></div></a>
<?php
if (isset($_COOKIE['CFVutilOK']) AND ($_COOKIE['CFVutilOK'] != "visit")) {
?>
<div id="bout01"><a href="avancement00.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('majcommande','','images/general/euroON.gif',1)"><img src="images/general/euroOFF.gif" alt="majcommande" name="majcommande" width="16" height="16" border="0"></a></div>
<div id="bout02"><a href="data00.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('majarticle','','images/general/puzzleON.gif',1)"><img src="images/general/puzzleOFF.gif" alt="majarticle" name="majarticle" width="23" height="16" border="0"></a></div>
<div id="bout03"><a href="user00.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('majutilisateur','','images/general/compteON.gif',1)"><img src="images/general/compteOFF.gif" alt="majutilisateur" name="majutilisateur" width="19" height="15" border="0"></a></div>
<div id="pie01"><a href="statistiques20.php?stat=4" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('pie','','images/general/pie_on.gif',1)"><img src="images/general/pie_off.gif" alt="pie" width="15" height="16" id="pie"></a></div>
<div id="clic01"><a href="statistiques10.php?stat=1" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('clics_jours','','images/general/clicON.gif',1)"><img src="images/general/clicOFF.gif" alt="clics_jours" width="13" height="16" id="clics_jours"></a></div>
<div id="clic02"><a href="statistiques10.php?stat=2" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('clics_mois','','images/general/clicON.gif',1)"><img src="images/general/clicOFF.gif" alt="clics_mois" width="13" height="16" id="clics_mois"></a></div>
<div id="clic03"><a href="statistiques10.php?stat=3" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('clics_annees','','images/general/clicON.gif',1)"><img src="images/general/clicOFF.gif" alt="clics_annees" width="13" height="16" id="clics_annees"></a></div>
<div id="stat01"><a href="statistiques00.php?stat=1" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('stats_jours','','images/general/statsON.gif',1)"><img src="images/general/statsOFF.gif" alt="stats_jours" name="stats_jours" width="16" height="15" border="0"></a></div>
<div id="stat02"><a href="statistiques00.php?stat=2" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('stats_mois','','images/general/statsON.gif',1)"><img src="images/general/statsOFF.gif" alt="stats_mois" name="stats_mois" width="16" height="15" border="0"></a></div>
<div id="stat03"><a href="statistiques00.php?stat=3" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('stats_annees','','images/general/statsON.gif',1)"><img src="images/general/statsOFF.gif" alt="stats_annees" name="stats_annees" width="16" height="15" border="0"></a></div>
<?php
}
?>
</div>
</div>
</div>
<div id="dessous"></div>
<div id="contacteznous">
<div>
<img src="images/general/footer_image.gif" width="261" height="97" usemap="#Map99" border="0">
<map name="Map99">
<area shape="rect" coords="51,50,161,92" href="contact00.php" alt="help">
</map>
</div>
<div style="position:absolute; top:70px; padding-left:10px;" class="bold orange"><?php echo ($travaux!="")?"Cette page est momentanément en maintenance... Veuillez nous en excuser !":""; ?></div>
</div>
</body>
</html>
et "php/statspieclics.php" :
<?php
session_start();
ob_start();
// ini_set("display_errors", 0);
date_default_timezone_set('Europe/Brussels');
require_once("connexionMysql.inc.php");
if (isset($_GET['stat']) && !empty($_GET['stat'])) {
$grapahStat=$_GET['stat'];
if ($graphStat != 4) {
header("Location: ../index.php");
exit;
}
} else {
header("Location: ../index.php");
exit;
}
if (isset($_GET['dateref01']) && !empty($_GET['dateref01'])) {
$dateref01=$_GET['dateref01'];
} else {
header("Location: ../index.php");
exit;
}
if (isset($_GET['dateref02']) && !empty($_GET['dateref02'])) {
$dateref02=$_GET['dateref02'];
} else {
header("Location: ../index.php");
exit;
}
$largeurImage = 676;
$hauteurImage = 322;
$label = array(
"Accueil",utf8_decode("Création"),"Impression","Site Web","Kit promo",
"Boutique","Contact","FAQ","Recherche","News",
"Espace Client","Paiement","Mentions","Promos","Conditions",
"Facebook","Documents","Administrateur");
$data = array();
$aa = array();
$mm = array();
$rubr=count($label);
$indYY01 = substr($dateref01,0,4);
$indMM01 = substr($dateref01,4,2);
$indJJ01 = substr($dateref01,6,2);
$indYY02 = substr($dateref02,0,4);
$indMM02 = substr($dateref02,4,2);
$indJJ02 = substr($dateref02,6,2);
for ($indYY=$indYY01; $indYY<=$indYY02; $indYY++) {
if ($indYY==$indYY01) {
$debMM=$indMM01;
} else {
$debMM=1;
}
if ($indYY==$indYY02) {
$finMM=$indMM02;
} else {
$finMM=12;
}
for ($indMM=$debMM; $indMM<=$finMM; $indMM++) {
$aa[]=sprintf('%02d', $indYY);
$mm[]=sprintf('%02d', $indMM);
}
}
for ($ss=0; $ss<$rubr; $ss++) {
$clics = "clics".sprintf('%02d', $ss+1);
$data[$ss]=0;
for ($ind=0; $ind<count($aa); $ind++) {
$reqVisite="SELECT * FROM ".$clics.
" WHERE annee= '".$aa[$ind]."' AND mois= '".$mm[$ind]."' ";
$resVisite=mysql_query($reqVisite);
$record=mysql_fetch_array($resVisite);
if ($indYY==$indYY01 AND $indMM==$indMM01) {
$debJJ=$indJJ01;
} else {
$debJJ=1;
}
if ($indYY==$indYY02 AND $indMM==$indMM02) {
$finJJ=$indJJ02;
} else {
$finJJ=31;
}
for ($indj=$debJJ; $indj<=$finJJ; $indj++) {
$jour= "jour".sprintf('%02d', $indj);
$data[$ss] += $record["$jour"];
}
}
}
$data_sum = array_sum($data);
// Réglages
$show_label = true; // true = affichage avec label, false = sans label.
$show_percent = true; // true = affichage avec pourcentage, false = sans pourcentage.
$show_text = true; // true = affichage avec texte, false = sans texte.
$show_parts = false; // true = affichage avec valeurs , false = snas valeurs.
$label_form = 'square'; // 'square' ou 'round' label.
$background_color = 'ED0000'; // background-color du graphique...
$text_color = '000000'; // text-color.
$colors = array('003366', 'CCD6E0', '7F99B2','F7EFC6', 'C6BE8C', 'CC6600','990000','520000','BFBFC1','808080'); // couleurs des quartiers.
$shadow_height = 16; // Hauteur relief 3D.
$shadow_dark = true; // true = ombre plus foncée, false = ombre plus légère...
$width = 199;
$height = $width/2;
for ($i=0; $i<$rubr; $i++) {
if ($data[$i]/array_sum($data) < 0.1) {
$number[$i] = ' '.number_format(($data[$i]/array_sum($data))*100,1,',','.').'%';
} else {
$number[$i] = number_format(($data[$i]/array_sum($data))*100,1,',','.').'%';
}
if (strlen($label[$i]) > $text_length) {
$text_length = strlen($label[$i]);
}
}
if (is_array($label)) {
$antal_label = count($label);
$xtra = (5+15*$antal_label)-($height+ceil($shadow_height));
if ($xtra > 0) {
$xtra_height = (5+15*$antal_label)-($height+ceil($shadow_height));
}
$xtra_width = 5;
if ($show_label) {
$xtra_width += 20;
}
if ($show_percent) {
$xtra_width += 45;
}
if ($show_text) {
$xtra_width += $text_length*8;
}
if ($show_parts) {
$xtra_width += 35;
}
}
// préparation du graphique
// header ("Content-type: image/png");
// $im = ImageCreateTrueColor($largeurImage, $hauteurImage)
$im = ImageCreateTrueColor($width+$xtra_width, $height+ceil($shadow_height)+$xtra_height);
// or die ("Erreur lors de la création de l'image");
ImageFill($im, 0, 0, colorHex($im, $background_color));
foreach ($colors as $colorkode) {
$fill_color[] = colorHex($im, $colorkode);
$shadow_color[] = colorHexshadow($im, $colorkode, $shadow_dark);
}
$label_place = 5;
if (is_array($label)) {
for ($i = 0; $i < $rubr; $i++) {
if ($label_form == 'round' && $show_label && $data[$i] > 0) {
imagefilledellipse($im,$width+11,$label_place+5,10,10,colorHex($im, $colors[$i % count($colors)]));
imageellipse($im,$width+11,$label_place+5,10,10,colorHex($im, $text_color));
}
else if ($label_form == 'square' && $show_label && $data[$i] > 0) {
imagefilledrectangle($im,$width+6,$label_place,$width+16,$label_place+10,colorHex($im, $colors[$i % count($colors)]));
imagerectangle($im,$width+6,$label_place,$width+16,$label_place+10,colorHex($im, $text_color));
}
if ($data[$i] > 0) {
if ($show_percent) {
$label_output = $number[$i].' ';
}
if ($show_text) {
$label_output = $label_output.$label[$i].' ';
}
if ($show_parts) {
$label_output = $label_output.$data[$i];
}
imagestring($im,'2',$width+20,$label_place,$label_output,colorHex($im, $text_color));
$label_output = '';
$label_place = $label_place + 15;
}
}
}
$centerX = round($width/2);
$centerY = round($height/2);
$diameterX = $width-4;
$diameterY = $height-4;
$start = 270;
for ($i=0; $i<$rubr; $i++) {
$value += $data[$i];
$end = ceil(($value/$data_sum)*360) + 270;
$slice[] = array($start, $end, $shadow_color[$value_counter % count($shadow_color)], $fill_color[$value_counter % count($fill_color)]);
$start = $end;
$value_counter++;
}
for ($i=$centerY+$shadow_height; $i>$centerY; $i--) {
for ($j=0; $j<$rubr; $j++) {
if ($slice[$j][0] != $slice[$j][1]) {
ImageFilledArc($im, $centerX, $i, $diameterX, $diameterY, $slice[$j][0], $slice[$j][1], $slice[$j][2], IMG_ARC_PIE);
}
}
}
for ($j=0; $j<$rubr; $j++) {
if ($slice[$j][0] != $slice[$j][1]) {
ImageFilledArc($im, $centerX, $centerY, $diameterX, $diameterY, $slice[$j][0], $slice[$j][1], $slice[$j][3], IMG_ARC_PIE);
}
}
// ImagePng($im);
// ImageDestroy($im);
function colorHex($im, $HexColorString) {
$R = hexdec(substr($HexColorString,0,2));
$G = hexdec(substr($HexColorString,2,2));
$B = hexdec(substr($HexColorString,4,2));
return ImageColorAllocate($im, $R, $G, $B);
}
function colorHexshadow($im, $HexColorString, $mork) {
$R = hexdec(substr($HexColorString,0,2));
$G = hexdec(substr($HexColorString,2,2));
$B = hexdec(substr($HexColorString,4,2));
if ($mork) {
($R>99)?$R-=100:$R=0;
($G>99)?$G-=100:$G=0;
($B>99)?$B-=100:$B=0;
} else {
($R<220)?$R+=35:$R=255;
($G<220)?$G+=35:$G=255;
($B<220)?$B+=35:$B=255;
}
return ImageColorAllocate($im, $R, $G, $B);
}
mysql_close($connexion);
// ob_end_flush();
ob_end_clean();
header ('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
[/i][/i][/i][/i][/i][/i]
Modifié par jytest (13 Jul 2012 - 11:13)