#!/usr/local/bin/perl # Script: source.pl (chmod: 755) ############################################## # Keleko, Inc. © 1999 webmaster@keleko.com # # http://www.keleko.com/scripts/ # ############################################## # You must have "CGI.pm" - located at: # # http://stein.cshl.org/WWW/software/CGI # ############################################## use CGI; $query = new CGI; $url = $query->param('url'); $img = $query->param('img'); &checkurl; sub checkurl {if ($url =~ "file:") {&home;} else {&checkup;}} sub checkup {if ($url eq "") {&home;} else {&casview;}} sub casview {if ($img ne "") {print("Location: $img\n\n"); } else {if ($img eq "") { use LWP::Simple; use LWP::UserAgent; use HTML::LinkExtor; use URI::URL; $ua = new LWP::UserAgent; my @imgs = (); sub callback {my($tag, %attr) = @_; return if $tag ne 'img'; push(@imgs, values %attr);} $p = HTML::LinkExtor->new(\&callback); $res = $ua->request(HTTP::Request->new(GET => $url), sub {$p->parse($_[0])}); my $base = $res->base; @imgs = map {$_ = url($_, $base)->abs;} @imgs; $imgs = join("\n", @imgs); $source = get($url); $source =~ s#(/textarea)#(/textarea)#gi; if ($source eq "") {$source = "Can't resolve address for $url Possible Reasons: Error 400 - Bad Request Error 401 - Auth Required Error 403 - Forbidden Error 404 - Not Found Error 500 - Server Error";} print "Content-type: text/html\n\n"; print("\n"); print("
\n"); print("| \n"); print("\n"); print(" | \n"); print("