From: eldy <> Date: Wed, 31 Dec 2008 03:22:06 +0000 (+0000) Subject: Now awredir need a key X-Git-Tag: AWSTATS_6_95_BETA~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1b7bce7805103fda7d6bf831c042a71c301bb8d;p=thirdparty%2FAWStats.git Now awredir need a key --- diff --git a/wwwroot/cgi-bin/awredir.pl b/wwwroot/cgi-bin/awredir.pl index 4a917156..88a527e9 100644 --- a/wwwroot/cgi-bin/awredir.pl +++ b/wwwroot/cgi-bin/awredir.pl @@ -113,19 +113,19 @@ if ($ENV{QUERY_STRING} =~ /key=\"?([^\"&]+)\"?/) { $Key=$1; } $Url=$ENV{QUERY_STRING}; if ($Url =~ /url=\"([^\"]+)\"/) { $Url=$1; } elsif ($Url =~ /url=(.+)$/) { $Url=$1; } +$Url = DecodeEncodedString($Url); +$UrlParam=$Url; -if ($Url !~ /^\w+:/i) { $Url = "http://".$Url; } -if (! $Url) { - error("Error: Bad use of $PROG. To redirect an URL with $PROG, use the following syntax:
/cgi-bin/$PROG.pl?url=http://urltogo"); +if (! $UrlParam) { + error("Error: Bad use of $PROG. To redirect an URL with $PROG, use the following syntax:
/cgi-bin/$PROG.pl?url=http://urltogo"); } -$Url=DecodeEncodedString($Url); + +if ($Url !~ /^http/i) { $Url = "http://".$Url; } if ($DEBUG) { print LOGFILE "Url=$Url\n"; } -if ($KEYFORMD5 eq 'YOURKEYFORMD5') { - error("Error: You must change value of constant KEYFORMD5"); -} -if ($Key ne md5($KEYFORMD5.$Url)) { - error("Error: Bad value for key= parameter"); +if ($Key ne md5_hex($KEYFORMD5.$UrlParam)) { +# error("Error: Bad value key=".$Key." to have a redirect to ".$UrlParam." - ".$KEYFORMD5." - ".md5_hex($KEYFORMD5.$UrlParam) ); + error("Error: Bad value key=".$Key." to have a redirect to ".$UrlParam); }