Changes between Version 1 and Version 2 of PlugIns/PHP


Ignore:
Timestamp:
10/04/12 09:21:02 (12 years ago)
Author:
sherbold
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PlugIns/PHP

    v1 v2  
    1 = PHPMonitor = 
     1[[TracNav(TOC|nocollapse)]] 
    22 
    3 The PHPMonitor is a small PHP script with has to be pre-prended to all other PHP scripts of a website. This can be done either manually (unreliable) or by configuring the php.ini file of a server appropriatly (not always possible). The script relies on a cookie for the user identification to be available thorugh the [http://httpd.apache.org/docs/2.2/mod/mod_usertrack.html Apache module mod_usertrack]. 
     3= PHP-based Web Applications Plug-in = 
    44 
    5 {{{ 
    6 #!php 
    7 <?php 
    8   /* 
    9    * Usage monitoring script for PHP web applications. 
    10    * Requires the apache modules mod_usertrack to provide 
    11    * a cookie for user identification. 
    12    */ 
    13   $log_dir = dirname( __FILE__)."/"; 
    14   $log_name = "usage.log"; 
    15   $cookie_name = "swe_informatik_uni-goettingen_de"; 
    16  
    17   $postkeys = ""; 
    18  
    19   while (list($key, $value) = each($_POST)) { 
    20     $postkeys = $postkeys." ".$key; 
    21   } 
    22   if( $_SERVER['HTTP_REFERER']=='' ) { 
    23     $referer = '-'; 
    24   } else { 
    25     $referer = $_SERVER['HTTP_REFERER']; 
    26   } 
    27  
    28   $cookieVal = $_COOKIE[$cookie_name]; 
    29   if($cookieVal==0) { 
    30     $apacheHeader = apache_response_headers(); 
    31     $explodeResult1 = explode(';',$apacheHeader['Set-Cookie']); 
    32     $explodeResult2 = explode('=',$explodeResult1[0]); 
    33     $cookieVal = $explodeResult2[1]; 
    34   } 
    35  
    36   $log_entry = "\"".$cookieVal."\" \"".gmdate('Y-m-d H:i:s')."\" \"".$_SERVER['REQUEST_URI']."\" \"".$referer."\" \"".$_SERVER['HTTP_USER_AGENT']."\" \"".$postkeys."\"\r\n"; 
    37   $fp=fopen( $log_dir . $log_name, 'a' ); 
    38   fputs($fp, $log_entry); 
    39   fclose($fp); 
    40 ?> 
    41  
    42 }}} 
     5This plug-in provides the means to apply our techniques to PHP-based web applications. It consists of two artifacts:  
     6 1. [wiki:PHP/PHPMonitor PHPMonitor]: A monitoring component that can be used to monitor PHP-based web applications running on [http://httpd.apache.org/ Apache web servers]. The details of this artifact are explained [wiki:PHP/PHPMonitor here]. 
     7 1. eventbench-plugins-php: A Java plug-in into the !EventBench Frontend that allows parsing of data monitored with the PHPMonitor into events to be used with the !EventBench Core. Furthermore, it is possible to generate abstract replays to be executed against a Web server with curl. With abstract, we mean that the replays lack values for GET and POST variables, which need to be inserted by a test data generator.