secondes. V0.36 17 Octobre 2005: (mysql) Débuggage des constantes. V0.40 18 Octobre 2005: (mysql & file) Lecture Ecriture fichier et ajout dans le tableau conditionnel V0.41 19 Octobre 2005: (mysql & file) Tri du tableau selon la date */ /*Constantes*/ $__VISIBLE = 1; //N'affiche pas les résultats des requetes. (mais fait quand meme les requete de recherche de données: comment ca pas optimisé ? :D) $__SNEAKYMODE = 0; //Met l'image en 1*1 pixel $__DELTIME = 259200; //3 jours avant effacement /************************** SGBAccess. See sql structure for installation *************/ define ("BDD_TYPE", "file"); define ("BDD_PASSWORD", ""); define ("BDD_LOGIN", "root"); define ("BDD_DNSLOCATION", "localhost"); define ("FILE_LOCATION", "test.txt"); $__COPYRIGHT = "GNU GPL Not for commercial use."; $__VERSION = "v0.4 (text file)"; // Source écrit par T pour php 4.2 ou plus // website : http://www.overdrived.com // email : ab@overdrived.com // _POST=code de la source afficher et a précopier // aide : http://overdrived.com/btcode.php //Code à inclure dans la tete de la page HEAD function get_microtime() { list($tps_usec, $tps_sec) = explode(" ",microtime()); return ((float)$tps_usec + (float)$tps_sec); } $tps_start = get_microtime(); testsGD(); // fin de la tete HEAD header("Content-type: image/png"); //Préparation if (BDD_TYPE == "mysql") { connectDB(); /*On va ajouter celui qui demande l'image*/ ajouter_MYSQL(); degagerTropVieux($__DELTIME); } /*Variables GET gérés*/ //-> Efface tout les connectés if(isset($_GET['RAZ'])) { if($_GET['RAZ']=='roxen') { if (BDD_TYPE == "mysql") { mysql_query("DELETE FROM connected;"); dieImageMessage ("Effacement effectué"); } if (BDD_TYPE == "file") { $visiteur = null; flush_FILE($visiteur); dieImageMessage ("Effacement effectué"); } } } //->-------------------- $visiteur = null; if (BDD_TYPE == "mysql") { $visiteurs=liredansBDD(); } if (BDD_TYPE == "file") { $visiteurs=lirefichier_FILE(); $visiteurs=ajouter_FILE($visiteurs); $visiteurs=triertableau_FILE($visiteurs); $visiteurs=degagerTropVieux_FILE($visiteurs); flush_FILE($visiteurs); } /* On va afficher */ if($__SNEAKYMODE == 1) { $im = @imagecreate (1, 1) or die ("Impossible d'initialiser la bibliothèque GD"); }else { //Génération a taille NORMALE /*Démination de la taille !*/ $pngx = 920; $pngy = 200; //count($visiteurs) * 8 + 40 $im = @imagecreate ($pngx, $pngy) or die ("Impossible d'initialiser la bibliothèque GD"); } $background_color = imagecolorallocate ($im, 255, 255, 255); $text_color = imagecolorallocate ($im, 0, 0, 0); $title_color = imagecolorallocate ($im, 25, 40, 231); /*Allocation pour les temps spéciaux.*/ $recent1 = imagecolorallocate ($im, 102, 4, 27); //$recent1 = imagecolorallocate ($im, 5, 223, 255); $recent2 = imagecolorallocate ($im, 203, 80, 5); $recent3 = imagecolorallocate ($im, 255, 11, 5); $recent4 = imagecolorallocate ($im, 5, 223, 245); if($__VISIBLE == 1) { /*Collones titres*/ imagestring ($im, 2, 5, 1, "Visiteurs", $title_color); /*Inclusion du texte*/ if(count($visiteurs)>0) { for($i=0;$i100,"...",""), 50, 100), $text_color); imagestring ($im, 1, 740, 20 + (($i) * 19),$dateaffiche, $coloruse); //DEBUG //imagestring ($im, 1, 1, 100,"MKTIME DIT: ".mktime(), $text_color); } } else { imagestring ($im, 1, 5, 20,"La table est vide", $text_color); } /*Colonne pied de page*/ imagestring ($im, 2, 5, $pngy-27, "Total visiteurs: ".count($visiteurs)." [POWERED By caudium pike]", $text_color); /*TIME---------------*/ $tps_end = get_microtime();$tps = $tps_end - $tps_start;function rounder($value){$buffer = $value * 100;$rounded = round($buffer);$buffer = $rounded / 100;$point_pos = strpos($buffer, ".");if ($point_pos == FALSE) $buffer .= ".00";else { if ((strlen($buffer) - $point_pos) == 2) $buffer .= "0";}return $buffer; } $tps2=@rounder($tps); /*