use strict ; use Socket ; use FileHandle ; sub eml_getpag { my( $tlkurl) = @_ ; my( $proxy_host, $proxy_port, $http) ; my( $con_host, $con_port) ; my( $host, $port, $url, $path, $ip, $sockaddr) ; my( $arg, $buf, $text); $http = '1.1' ; $host = 'localhost' ; $port = getservbyname( 'http', 'tcp') ; $path = '/' ; $tlkurl =~ m!(http:)?(//)?([^:/]*)?(:([0-9]+)?)?(/.*)?! ; if ( $3) { $host = $3 ; } if ( $5) { $port = $5 ; } if ( $6) { $path = $6 ; } $con_host = $host ; $con_port = $port ; $url = $path ; if( !( $ip = inet_aton( $con_host))) { return( 'inet_aton') ; } $sockaddr = pack_sockaddr_in( $con_port, $ip) ; if( !socket( SOCKET, PF_INET, SOCK_STREAM, 0)) { return( 'inet_aton') ; } if( !connect( SOCKET, $sockaddr)) { return( 'inet_aton') ; } autoflush SOCKET ( 1) ; print SOCKET "GET $url HTTP/1.1\n"; print SOCKET "Host: $host\n"; print SOCKET "Connection: close\n\n"; while ( $buf = ) { if( $buf =~ /^\r\n$/) { last ; } } while ( $buf = ) { if( $buf =~ /^[0-9a-f]+\r\n$/) { next ; } if( $buf =~ /^\r\n$/) { next ; } $text .= $buf ; } close(SOCKET); return( $text) ; } sub eml_encurl { my( $string) = @_ ; $string =~ s/([^0-9A-Za-z+_ ])/'%'.unpack('H2', $1)/ge ; return( $string) ; } my( $usragn) = $ENV{'HTTP_USER_AGENT'} ; my( $viewer) = 0 ; if( $usragn =~ /DoCoMo/ || $usragn =~ /Vodafone/ || $usragn =~ /SoftBank/ || $usragn =~ /UP.Browser/ || $usragn =~ /msnbot/ || $usragn =~ /Mozilla/) { $viewer = 1 ; } my( $cginam) = "http://www.quick-links.com/cgi-bin/emlj/lnk_lnks.cgi" ; my( $param) = "?mode=php&userid=" . "lp177732" . "&viewer=" . $viewer . "&remote=" . &eml_encurl( $ENV{'REMOTE_ADDR'}) . "&requri=" . &eml_encurl( $ENV{'REQUEST_URI'}) . "&refer=" . &eml_encurl( $ENV{'HTTP_REFERER'}) ; my( $url) = "$cginam$param" ; my( $pagdat) = &eml_getpag( $url) ; print "Content-type: text/html; charset=EUC-JP\n\n" ; print "$pagdat" ; exit( 0) ;