Ignore:
Timestamp:
12/15/04 04:17:00 (8 years ago)
Author:
anonymous
Message:

fusionner stat_consop et stat_conso qui etaient tres similaires

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/stat_conso.php

    r1345 r1347  
    11#!/usr/bin/php4 -q  
    22<?php 
     3@set_time_limit(0); 
     4 
     5include("/var/alternc/bureau/class/config_nochk.php"); 
     6 
     7// Libère le bureau ! 
     8alternc_shutdown(); 
    39 
    410// Ce script lit un fichier de log apache et insère les statistiques de visite par jour et par domaine / sous-domaine dans la table stat_http. 
     
    1824 echo "################################################\n"; 
    1925 
    20  
    21  
    22 // Ne pas toucher ci-dessous. 
    23  
    24 @set_time_limit(0); 
    25  
    26 include("/var/alternc/bureau/class/config_nochk.php"); 
    27  
    28 // Libère le bureau ! 
    29 alternc_shutdown(); 
    3026 
    3127if (substr($apache,-3)==".gz") { 
     
    5450while ($s=$gets($f,2048)) { 
    5551  $s=trim($s); 
    56   if (ereg('^[^ ]* [^ ]* [^ ]* \\[([0-9]*)/([a-zA-Z]*)/([0-9]*):[0-9]*:[0-9]*:[0-9]* [^ ]* "[^"]*" ([0-9-]*) ([0-9-]*) "[^"]*" "[^"]*" [0-9]* ([^ ]*)$',$s,$mat)) { 
     52  if (preg_match('/^[^ ]* [^ ]* [^ ]* \\[([0-9]*)\\/([a-zA-Z]*)\\/([0-9]*):[0-9]*:[0-9]*:[0-9]* [^ ]* "[^"]*" ([0-9-]*) ([0-9-]*) "[^"]*" "[^"]*" [0-9]* ([^ ]*)$/',$s,$mat)) { 
    5753    // ok, 1: jour  2: mois (english)  3: année  4: http result (200/404 ...) 5: taille  6: domaine 
    5854    // Ligne ok. 
     
    7773    $update=0; $insert=0; 
    7874    foreach($domstat as $key => $val) { 
    79       ereg("^([^/]*)/(.*)$",$key,$mat); 
     75      preg_match("/^([^\\/]*)\\/(.*)$/",$key,$mat); 
    8076      $mat[1]=strtolower($mat[1]); 
    8177      // on cherche l'uid de ce domaine 
     
    104100 $update=0; $insert=0; 
    105101 foreach($domstat as $key => $val) { 
    106    ereg("^([^/]*)/(.*)$",$key,$mat); 
     102   preg_match("/^([^\\/]*)\\/(.*)$/",$key,$mat); 
    107103   $mat[1]=strtolower($mat[1]); 
    108104   // on cherche l'uid de ce domaine 
Note: See TracChangeset for help on using the changeset viewer.