| Apache2-WURFLFilter documentation | Contained in the Apache2-WURFLFilter distribution. |
Apache2::AMFCommonLib - Common Library That AMF uses.
Is a simple Common Library for AMF
For more details: http://www.idelfuschini.it/apache-mobile-filter-v2x.html
Mobile Demo page of the filter: http://apachemobilefilter.nogoogle.it (thanks Ivan alias sigmund)
Demo page of the filter: http://apachemobilefilter.nogoogle.it/php_test.php (thanks Ivan alias sigmund)
Idel Fuschini (idel.fuschini [at] gmail [dot] com)
| Apache2-WURFLFilter documentation | Contained in the Apache2-WURFLFilter distribution. |
#file:Apache2/AMFCommonLib.pm; #-------------------------------- # # Created by Idel Fuschini # Date: 15/12/09 # Site: http://www.idelfuschini.it # Mail: idel.fuschini@gmail.com package Apache2::AMFCommonLib; use strict; use warnings; use vars qw($VERSION); $VERSION= "2.21"; sub new { my $package = shift; return bless({}, $package); } sub Data { my $_sec; my $_min; my $_hour; my $_mday; my $_day; my $_mon; my $_year; my $_wday; my $_yday; my $_isdst; my $_data; ($_sec,$_min,$_hour,$_mday,$_mon,$_year,$_wday,$_yday,$_isdst) = localtime(time); $_mon=$_mon+1; $_year=substr($_year,1); $_mon=&correct_number($_mon); $_mday=&correct_number($_mday); $_hour=&correct_number($_hour); $_min=&correct_number($_min); $_sec=&correct_number($_sec); $_data="$_mday/$_mon/$_year - $_hour:$_min:$_sec"; return $_data; } sub correct_number { my ($number) = @_; if ($number < 10) { $number="0$number"; } return $number; } sub printLog { my $self = shift; if (@_) { $self->{'printLog'} = shift; } my $data=Data(); print "$data - $self->{'printLog'}\n"; } sub GetMultipleUa { my $self = shift; my $UserAgent; if (@_) { $UserAgent = shift; } my %ArrayPM; my $pair; my $ind=0; my $pairs3; my %ArrayUAparse; my @pairs = split(/\ /, $UserAgent); foreach $pair (@pairs) { if ($ind==0) { if ($pair =~ /\//o) { my @pairs2 = split(/\//, $pair); foreach $pairs3 (@pairs2) { if ($ind==0) { $ind=$ind+1; $ArrayUAparse{$ind}=$pairs3; } else { $ind=$ind+1; $ArrayUAparse{$ind}="$ArrayUAparse{$ind-1}\/$pairs3"; } } } else { $ind=$ind+1; $ArrayUAparse{$ind}="$pair"; } } else { if ($pair =~ /\//o) { my $ind2=0; my @pairs2 = split(/\//, $pair); foreach $pairs3 (@pairs2) { if ($ind2==0) { $ind=$ind+1; $ind2=1; $ArrayUAparse{$ind}="$ArrayUAparse{$ind-1} $pairs3"; } else { $ind=$ind+1; $ArrayUAparse{$ind}="$ArrayUAparse{$ind-1}\/$pairs3"; } } } else { $ind=$ind+1; $ArrayUAparse{$ind}="$ArrayUAparse{$ind-1} $pair"; } } } return %ArrayUAparse; } sub readCookie { my $self = shift; my $cookie_search; if (@_) { $cookie_search = shift; } my $param_tofound; my $string_tofound; my $value=""; my $id_return=""; my @pairs = split(/;/, $cookie_search); my $name; foreach $param_tofound (@pairs) { ($string_tofound,$value)=split(/=/, $param_tofound); if ($string_tofound eq "amf") { $id_return=$value; } } return $id_return; } sub extValueTag { my $self = shift; my ($tag,$string); if (@_) { $tag = shift; $string = shift; } #my ($tag,$string) = @_; my $a_tag="\<$tag"; my $b_tag="\<\/$tag\>"; my $finish=index($string,"\>") + 1; my $x=$finish; my $y=index($string,$b_tag); my $return_tag=substr($string,$x,$y - $x); return $return_tag; }