| [ Index ] |
|
Code source de Cr@wltr@ck 2.2.1 |
1 <?php 2 //---------------------------------------------------------------------- 3 // CrawlTrack 2.2.1 4 //---------------------------------------------------------------------- 5 // Crawler Tracker for website 6 //---------------------------------------------------------------------- 7 // Author: Jean-Denis Brun 8 //---------------------------------------------------------------------- 9 // Website: www.crawltrack.fr 10 //---------------------------------------------------------------------- 11 // That script is distributed under GNU GPL license 12 //---------------------------------------------------------------------- 13 // file: visit-graph.php 14 //---------------------------------------------------------------------- 15 // this graph is made with artichow website: www.artichow.org 16 //---------------------------------------------------------------------- 17 error_reporting(0); 18 //initialize array 19 $listlangcrawlt=array(); 20 //get graph infos 21 $graphname= urlencode($_GET['graphname']); 22 $period = $_GET['period']; 23 $navig = $_GET['navig']; 24 25 //database connection 26 include "../include/configconnect.php"; 27 $connexion = mysql_connect($crawlthost,$crawltuser,$crawltpassword) or die("MySQL connection to database problem"); 28 $selection = mysql_select_db($crawltdb) or die("MySQL database selection problem"); 29 //get the listlang files 30 include "../include/listlang.php"; 31 //get the functions files 32 $times=0;//give value just to avoid error in functions.php 33 $firstdayweek='Monday'; //give value just to avoid error in functions.php 34 include "../include/functions.php"; 35 //get graph values 36 $sql = "SELECT graph_values FROM crawlt_graph 37 WHERE name='".sql_quote($graphname)."'"; 38 39 $requete = mysql_query($sql, $connexion) or die("MySQL query error"); 40 41 $nbrresult=mysql_num_rows($requete); 42 if($nbrresult>=1) 43 { 44 $ligne = mysql_fetch_array($requete,MYSQL_ASSOC); 45 $data = $ligne['graph_values']; 46 } 47 else 48 { 49 echo"<h1>No Graph values available !!!!</h1>"; 50 exit(); 51 } 52 $datatransfert= unserialize(urldecode(stripslashes($data))); 53 //get language to use 54 $crawltlang = $_GET['crawltlang']; 55 //language file include 56 if(file_exists("../language/".$crawltlang.".php") && in_array($crawltlang,$listlangcrawlt)) 57 { 58 include "../language/".$crawltlang.".php"; 59 } 60 else 61 { 62 echo"<h1>No language files available !!!!</h1>"; 63 exit(); 64 } 65 66 //legend text 67 $legend1=$language['nbr_visits']; 68 $legend2=$language['nbr_pages']; 69 $legend3=$language['crawler_name']; 70 71 foreach ($datatransfert as $key => $value) 72 { 73 $axex[] = $key; 74 } 75 76 //graph creation 77 //create table for graph 78 79 foreach($axex as $data) 80 { 81 $cutdata=explode("-",$datatransfert[$data]); 82 $page2[]=$cutdata[0]; 83 $visit[]=$cutdata[1]; 84 $crawl[]=$cutdata[2]; 85 } 86 87 //test to see if ttf font is available 88 $fontttf= gd_info(); 89 90 if( @$fontttf['FreeType Linkage']=='with freetype') 91 { 92 $ttf='ok'; 93 } 94 else 95 { 96 $ttf='no-ok'; 97 } 98 99 100 require_once "artichow/BarPlot.class.php"; 101 require_once "artichow/LinePlot.class.php"; 102 103 $graph = new Graph(700, 300); 104 105 106 107 108 $group = new PlotGroup(); 109 110 $group->setBackgroundColor(new Color(173, 216, 230, 60)); 111 112 $group->setSpace(2, 2, 0.1, 0); 113 114 115 if($period==2 OR $period==3 OR ($period>=100 && $period<300) ) 116 { 117 $group->setPadding(50, 85, 30, 60); 118 } 119 else 120 { 121 $group->setPadding(50, 85, 30, 20); 122 } 123 124 //visits 125 126 if($navig==2 OR $navig==4) 127 { 128 $plot = new BarPlot($visit,1,2); 129 } 130 else 131 { 132 $plot = new BarPlot($visit,1,3); 133 } 134 135 $debut = new Color(0, 51, 153); 136 $fin = new Color(0, 191, 255); 137 138 139 $plot->setBarGradient( 140 new LinearGradient( 141 $debut, 142 $fin, 143 90 144 ) 145 ); 146 147 $plot->setXAxisZero(TRUE); 148 $plot->setSpace(2, 2, 20, 0); 149 $plot->barShadow->setSize(2); 150 $plot->barShadow->setPosition(SHADOW_RIGHT_TOP); 151 $plot->barShadow->setColor(new Color(180, 180, 180, 10)); 152 $plot->barShadow->smooth(TRUE); 153 154 //legend 155 156 $group->legend->add($plot, $legend1, LEGEND_BACKGROUND); 157 158 $group->add($plot); 159 160 if($navig==4) 161 {} 162 else 163 { 164 //pages viewed 165 166 if($navig==2) 167 { 168 $plot = new BarPlot($page2,2,2); 169 } 170 else 171 { 172 $plot = new BarPlot($page2,2,3); 173 } 174 175 $debut = new Color(255, 0, 0); 176 $fin = new Color(255, 215, 0); 177 178 179 $plot->setBarGradient( 180 new LinearGradient( 181 $debut, 182 $fin, 183 90 184 ) 185 ); 186 187 188 $plot->setXAxisZero(TRUE); 189 $plot->setSpace(2, 2, 20, 0); 190 $plot->barShadow->setSize(2); 191 $plot->barShadow->setPosition(SHADOW_RIGHT_TOP); 192 $plot->barShadow->setColor(new Color(180, 180, 180, 10)); 193 $plot->barShadow->smooth(TRUE); 194 195 //legend 196 $group->legend->add($plot, $legend2, LEGEND_BACKGROUND); 197 if ($ttf=='ok') 198 { 199 $group->legend->setTextFont(new Tuffy(10)); 200 } 201 else 202 { 203 $group->legend->setTextFont(new Font(2)); 204 } 205 206 $group->add($plot); 207 } 208 209 if($navig==2) 210 {} 211 else 212 { 213 //crawler 214 215 if($navig==4) 216 { 217 $plot = new BarPlot($crawl,2,2); 218 } 219 else 220 { 221 $plot = new BarPlot($crawl,3,3); 222 } 223 224 225 $debut = new Color(0, 128, 0); 226 $fin = new Color(144, 238, 144); 227 228 229 $plot->setBarGradient( 230 new LinearGradient( 231 $debut, 232 $fin, 233 90 234 ) 235 ); 236 237 $plot->setXAxisZero(TRUE); 238 $plot->setSpace(2, 2, 20, 0); 239 $plot->barShadow->setSize(2); 240 $plot->barShadow->setPosition(SHADOW_RIGHT_TOP); 241 $plot->barShadow->setColor(new Color(180, 180, 180, 10)); 242 $plot->barShadow->smooth(TRUE); 243 244 245 246 //legend 247 $group->legend->add($plot, $legend3, LEGEND_BACKGROUND); 248 249 $group->add($plot); 250 } 251 252 $group->legend->setBackgroundColor(new Color(255,255,255,0)); 253 $group->legend->setPosition(0.995,0.2); 254 255 256 257 258 //X axis label 259 if($period == 0 OR $period >= 1000) 260 { 261 for($i=0;$i<24;$i++) 262 { 263 $axex[$i]=$axex[$i]."h"; 264 } 265 } 266 267 $group->axis->bottom->setLabelText($axex); 268 269 270 if ($ttf=='ok') 271 { 272 $group->axis->left->label->setFont(new Tuffy(8)); 273 $group->axis->bottom->label->setFont(new Tuffy(8)); 274 } 275 else 276 { 277 $group->axis->left->label->setFont(new Font(2)); 278 $group->axis->bottom->label->setFont(new Font(2)); 279 } 280 if($period==2 OR $period==3 OR ($period>=100 && $period<300)) 281 { 282 $group->axis->bottom->label->setAngle(45); 283 if ($ttf=='ok') 284 { 285 $group->axis->bottom->label->move(-10, 0); 286 } 287 else 288 { 289 $group->axis->bottom->label->move(20, 0); 290 } 291 } 292 293 $graph->add($group); 294 $graph->draw(); 295 296 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Thu Sep 6 14:14:11 2007 | par Balluche grâce à PHPXref 0.7 |