#!/usr/bin/perl
use strict;
use Socket;
main();
sub main(){
my $options=""; # default options
my $login="avia"; # your login
my $banner=banner($ENV{'PATH_INFO'} || "/$login",$ENV{'QUERY_STRING'} || $options);
print "Content-type: text/html\nContent-Length: ".length($banner)."\n\n",$banner;
}
sub banner{
#srand($$+time());
my ($login,$query)=@_;
my $mirror="120.goodoo.ru"; # nearest mirror IP
my $timeout=2; # timeout in seconds
my $random=int rand(10000000); # random number
my $charset=$ENV{'SOURCE_CHARSET'}; # Russian Apache charset autodetect
my $headers={
'REFERER' => "http://".$ENV{'SERVER_NAME'}.$ENV{'REQUEST_URI'}, # we need to pass
'USER-AGENT' => $ENV{'HTTP_USER_AGENT'}, # these headers
'X_FORWARDED_FOR' => $ENV{'HTTP_X_FORWARDED_FOR'}, # into subrequests
'REMOTE_ADDR' => $ENV{'REMOTE_ADDR'} #
};
$query="&charset=$charset".($query ? "&":"").$query;
request($login,$mirror,$query,$timeout,$headers,$random) || default($login,$mirror,$query,$random);
}
sub default{
my ($login,$mirror,$query,$random)=@_;
"".
"".
"";
}
sub request{
my ($login,$mirror,$query,$timeout,$headers,$random)=@_;
$query=~tr/ /+/;
my $banner;
my $request="GET /cgi-bin/iframe$login?$random&ssi=yes$query HTTP/1.0\nHOST: $mirror\n";
while (my ($name,$value)=each %$headers){
$request.="$name: $value\n" if $value;
}
local $SIG{ALRM}= sub { die };
local $/=undef;
alarm($timeout);
eval {
$banner=http($mirror,$request);
};
close(SOCK);
return "" if $@;
return "" unless ($banner=~ /^HTTP\/[^ ]* (\d+)/) && ($1==200);
$banner=~/\r?\n\r?\n/s;
return $';
}
sub http{
my ($host,$headers)=@_;
my $thataddr=gethostbyname($host);
return "[unable to resolve host name]" unless $thataddr;
return "[socket create error]" unless socket(SOCK,PF_INET,SOCK_STREAM,getprotobyname('tcp'));
return "[socket connect error]" unless connect(SOCK,pack('S n a4 x8',PF_INET,80,$thataddr));
select(SOCK); $|=1; select(STDOUT);
print SOCK "$headers\n";
}
#!/usr/bin/perl
use strict;
use Socket;
main();
sub main(){
my $options=""; # default options
my $login="avia"; # your login
my $banner=banner($ENV{'PATH_INFO'} || "/$login",$ENV{'QUERY_STRING'} || $options);
print "Content-type: text/html\nContent-Length: ".length($banner)."\n\n",$banner;
}
sub banner{
#srand($$+time());
my ($login,$query)=@_;
my $mirror="120.goodoo.ru"; # nearest mirror IP
my $timeout=2; # timeout in seconds
my $random=int rand(10000000); # random number
my $charset=$ENV{'SOURCE_CHARSET'}; # Russian Apache charset autodetect
my $headers={
'REFERER' => "http://".$ENV{'SERVER_NAME'}.$ENV{'REQUEST_URI'}, # we need to pass
'USER-AGENT' => $ENV{'HTTP_USER_AGENT'}, # these headers
'X_FORWARDED_FOR' => $ENV{'HTTP_X_FORWARDED_FOR'}, # into subrequests
'REMOTE_ADDR' => $ENV{'REMOTE_ADDR'} #
};
$query="&charset=$charset".($query ? "&":"").$query;
request($login,$mirror,$query,$timeout,$headers,$random) || default($login,$mirror,$query,$random);
}
sub default{
my ($login,$mirror,$query,$random)=@_;
"".
"".
"";
}
sub request{
my ($login,$mirror,$query,$timeout,$headers,$random)=@_;
$query=~tr/ /+/;
my $banner;
my $request="GET /cgi-bin/iframe$login?$random&ssi=yes$query HTTP/1.0\nHOST: $mirror\n";
while (my ($name,$value)=each %$headers){
$request.="$name: $value\n" if $value;
}
local $SIG{ALRM}= sub { die };
local $/=undef;
alarm($timeout);
eval {
$banner=http($mirror,$request);
};
close(SOCK);
return "" if $@;
return "" unless ($banner=~ /^HTTP\/[^ ]* (\d+)/) && ($1==200);
$banner=~/\r?\n\r?\n/s;
return $';
}
sub http{
my ($host,$headers)=@_;
my $thataddr=gethostbyname($host);
return "[unable to resolve host name]" unless $thataddr;
return "[socket create error]" unless socket(SOCK,PF_INET,SOCK_STREAM,getprotobyname('tcp'));
return "[socket connect error]" unless connect(SOCK,pack('S n a4 x8',PF_INET,80,$thataddr));
select(SOCK); $|=1; select(STDOUT);
print SOCK "$headers\n";
}
[an error occurred while processing the directive]
New combined Russian&English version introduced!
Dear Sirs,
In order to increase the performance of the AviaMarket system the Russian language version of the latter has, on 28 January 2003, been combined with its English version. So, now the current frequent visited and efficient Russian language AviaMarket is complemented with an English interface allowing for the messages in English to be published in the system as well. At the moment of this merger, in the Russian language system there have been 6691 users registered and 1606 commercial offers placed. In the transition period you may encounter a problem of reading messages in Russian, but at the same time from now on you will be able to post your ads in English understandable to the entire Internet community.
All English language AviaMarket version users who registered before 28 January 2003 will be granted for free an unlimited access to the combined system for the term of 6 months.
If you have been a registered user, to use the this combined system you just need to enter: