Просмотр файла gallery/count31.php

Размер файла: 2.67Kb
  1. <?php
  2. #-----------------------------------------------------#
  3. # ********* WAP-MOTORS ********* #
  4. # Made by : VANTUZ #
  5. # E-mail : visavi.net@mail.ru #
  6. # Site : http://pizdec.ru #
  7. # WAP-Site : http://visavi.net #
  8. # ICQ : 36-44-66 #
  9. # Вы не имеете право вносить изменения в код скрипта #
  10. #-----------------------------------------------------#
  11. require_once"../template/start.php";
  12. require_once"../template/regglobals.php";
  13. require_once"../template/config.php";
  14. require_once"../template/functions.php";
  15.  
  16. $p31_hits=file(BASEDIR."local/datacounter/31_hits.dat");
  17. $p31_hitsarr =explode("|",$p31_hits[0]);
  18.  
  19. foreach($p31_hitsarr as $k){
  20. $p31datadays = explode("-",$k);
  21. $hour_data[]=$p31datadays[1];
  22. }
  23.  
  24.  
  25.  
  26. $p31_host=file(BASEDIR."local/datacounter/31_host.dat");
  27. $p31_hostarr =explode("|",$p31_host[0]);
  28.  
  29. foreach($p31_hostarr as $k){
  30. $p31datadays = explode("-",$k);
  31. $hour_host[]=$p31datadays[1];
  32. }
  33.  
  34.  
  35. $max = 0;
  36. $max_index = 0;
  37. foreach ($hour_data as $index => $value){
  38. if ($value > $max){
  39. $max = $value;
  40. $max_index = $index;
  41. }
  42. }
  43.  
  44. if ($max == 0) {$max = 1;}
  45. // процентное соотношение хитов
  46. $per_hit = array();
  47. foreach ($hour_data as $value){
  48. $per_hit[] = $value*0.90/$max;
  49. }
  50. // процентное соотношение хостов
  51. $per_host = array();
  52. foreach ($hour_host as $value){
  53. $per_host[] = $value*0.90/$max;
  54. }
  55. $img = @imageCreateFromGIF(BASEDIR.'images/img/counter31.gif');
  56.  
  57. // линейный
  58. $color1 = imageColorAllocate($img, 44,191,228);
  59. $color2 = imageColorAllocate($img, 0,0,120);
  60. $color_red = imageColorAllocate($img, 200,0,0);
  61.  
  62. $imageH = 96;
  63. $imageW = 47;
  64. $collW = 4;
  65. $x1 = 138;
  66. $y1 = (int)($imageW - $imageW*$per_hit[0] + 7);
  67. $y1_host = (int)($imageW - $imageW*$per_host[0] + 7);
  68. $x2 = $x1 - 3;
  69.  
  70. $counth=count($hour_data);
  71. if($counth>30){$counth=30;}
  72.  
  73. for($i=1;$i<=$counth;$i++)
  74. {
  75. // хиты
  76. $y2 = (int)($imageW - $imageW*$per_hit[$i] + 7);
  77. imageLine($img,$x1,$y1,$x2,$y2,$color1);
  78. // хосты
  79. $y2_host = (int)($imageW - $imageW*$per_host[$i] + 7);
  80. imageLine($img,$x1,$y1_host,$x2,$y2_host,$color2);
  81. if ($hour_data[$i] != 0 && $i == $max_index){
  82.  
  83. ImageString($img, 1, $x2-17, $y2-10, "max", $color_red);
  84. ImageString($img, 1, $x2+2, $y2-10, $hour_data[$i], $color2);
  85.  
  86. imageLine($img,$x2-1,$y2-7,$x2-1,$y2+42,$color_red);
  87. }
  88. $y1 = $y2;
  89. $y1_host = $y2_host;
  90. $x1 -= $collW;
  91. $x2 -= $collW;
  92. }
  93. Header("Content-type: image/gif");
  94. ImageGIF($img);
  95. ImageDestroy($img);
  96. ?>