#!/usr/bin/perl # Script Name: Source Viewer (version 1) # Scripted By: U-L-T-R-A@webtv.net # Copyright © Date: 06-02-02 (Updated: 10-31-02) # Get this script & more at: http://ult-tex.com/ultra/scripts/ # Leave in all copyright statements & these 5 lines. # Set page variables. $heading = "Your Source Viewer"; $back = ''; $bg = 'ffffff'; $text = '505050'; $link = '1515ff'; $vlink = 'c000ff'; $trans = 'spinoutin'; $txtbxtext = '000080'; $txtbxtag = 'bc=ffffff cursor=ff nohighlight autoactivate usestyle'; $btntag = 'text=000070 insetselection'; # Environment variables. $agent = $ENV{'HTTP_USER_AGENT'}; $server = $ENV{'SERVER_NAME'}; # Required modules. use LWP::Simple; use CGI qw(param); # Read in the form inputs. $url = param('url'); $data = param('data'); print "Content-type: text/html\n\n"; if ($url) { $title = "Results for $url"; $URL = "'$url'"; } else { $title = $heading; $URL = 'history.previous'; } # Begin view document page. if ($data) { print "$data"; exit; } # Print the html header. &pc_block; print qq~ $title
<font s=7 c=ff><b> Webtv Bug! Reload Page 5 Times!</b></font> <br><br> $heading

Powered By: $server~; # Begin the results page. if ($url) { $source = get($url); &error_msg; $source =~ s/<\/textarea>/<\/textarea>/gi; print qq~




Search For:
Replace With:


NOTE! Search & Replace Is Case Sensitive
Example: HELLO is not the same as hello

~; } else { print qq~


Enter the url of the page you want to source or pick one from the recents menu or use the url of the previous page already in the textbox.

Click the "Source It" button and the script will read in the contents of the page you're sourcing and display the codes in a full width easy to read textarea where you can view and edit them.

You can make changes and try different codes and preview the page and the changes you made by clicking the "View Document" button. There is also a very nice search and replace feature.

NOTE! If the page you are sourcing has its source codes blocked then you will get an error message displayed with possible reasons for the error.

~; } # Print the html footer. print qq~


Script Copyright 2002 By U-L-T-R-A\@webtv.net


~; # Begin pc access block. sub pc_block { if ($agent !~ /webtv/i) { print "
Sorry, this page is for Webtv users only.
"; exit; } } # Begin error message. sub error_msg { if (!$source) { $source = qq~Can't Obtain Data For Address: $url Possible Reasons: € Error 400 Bad URL Syntax € Error 401 Authorization Required € Error 403 Forbidden (Permission Denied) € Error 404 File Not Found € Error 500 Internal Server Error € Error 502 Overloaded € Error 503 Gateway Timeout~; } }