1package common; 2 3$REFRESH_TIME = 5; 4 5sub File_read 6{ 7 $sFilename = @_[ 0 ]; 8 9 @aFileContentList = ""; 10 open( F_CURRPIC, "<" . $sFilename ) || "Could not open file " . $sFilename . " !<BR>\n"; 11 while( <F_CURRPIC> ) 12 { 13 push( @aFileContentList, $_ ); 14 } 15 close( F_CURRPIC ); 16 17 return @aFileContentList; 18} ##File_read 19 20 21sub HTTP_getRequest 22{ 23 # post- or get- method ? 24 if( $ENV{ 'REQUEST_METHOD' } eq 'GET' ) 25 { 26 # get parameters from querystring (get) 27 $sRequest = $ENV{ 'QUERY_STRING' } 28 } 29 else 30 { 31 # get parameters from stdin (post) 32 read( STDIN, $sRequest, $ENV{ 'CONTENT_LENGTH' } ); 33 } 34 # process parameters 35 @aRequestList = split( /&/, $sRequest ); 36 foreach $Feld ( @aRequestList ) 37 { 38 ( $name, $sValue ) = split( /=/, $Feld ); 39 $sValue =~ tr/+/ /; 40 $sValue =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; 41 $sValue =~ s/<!--(.|\n)*-->//g; 42 $aRequestMap{ $name } = $sValue; 43 } 44 45 return %aRequestMap; 46} ##HTTP_getRequest 47 481;