#!/home/y/bin/perl
#use CGI::Carp qw(fatalsToBrowser);
#################################################################################################
#
# All-purpose whois script for SimpleNet. Written by Michael Sussna, October 1999.
#
# Two forms call this, both on the same HTML page, /whois/lookup.html.
#
# Form1 allows a domain lookup with user-specified tld. Lookup details are optional.
# Form2 allows lookups on hypothetical domain names based on user or company name, hobby, etc.
#
#################################################################################################
use LWP::UserAgent;
use HTTP::Request;
use lib '/Space/CGI/modules';
use YDNSTools;
use UDB_access;
require '/Space/CGI/libraries/domains-api-post.lib';
require '/Space/CGI/libraries/yid.pl'; # yahoo id extractor
#require '/Space/CGI/libraries/domain-name-availability.pl';
#require '/Space/209.132.1/068/cgi-bin/domain-name-availability.pl';
@result_rows = "";
$result_rownum = 0;
$num_per_page = "500";
$error_flag = 0;
#################################################################################################
#DoTimeIn();
GetFormInput();
Init();
# Action 1 = internal to blackbox, 2 = external (e.g. from banner)
SetupLookAndFeel();
PostSetupInit();
if ($aForm{action} eq "") {Error("0"); ExitScript();}
if ($aForm{name} eq "")
{
if ($landing) {OutputPage(); ExitScript();}
else {Error("1"); ExitScript();}
}
if (
$aForm{update_my_list}
or $aForm{review_my_list}
or $aForm{'view_more.x'}
or $aForm{update_my_list_viewmore}
)
{UpdateAndOutputPage(); ExitScript();}
if (
$aForm{update_my_list_review}
or $aForm{secure_checkout}
)
{UpdateReview(); ExitScript();}
if ($aForm{num_domains} > 0) {NotFirstTime();}
else {$first_time = 1; Form1();}
OutputPage();
ExitScript();
#################################################################################################
sub Init
{
$|=1;
$property = "domains";
# $property = $aForm{property};
yid_main();
if ($yid) {$auth_time_limit = 172800;} # 48 hours
else {$auth_time_limit = 3600;} # 1 hour
# Set the domain bit of the cookie as appropriate according to the cookie RFC
$cookie_auth_domain = $ENV{HTTP_HOST};
$cookie_auth_domain =~ s/^(whois)\.//i;
$cookie_auth_domain =~ s/\:.*//;
$cookie_auth_domain_nodot = $cookie_auth_domain;
$cookie_auth_domain = ".$cookie_auth_domain";
if (
(not $aForm{update_my_list})
and (not $aForm{update_my_list_review})
and (not $aForm{secure_checkout})
and (not $aForm{review_my_list})
and (not $aForm{'view_more.x'})
and (not $aForm{update_my_list_viewmore})
)
{
print "Content-type: text/html\n\n";
}
$woops = "";
$woops_count = 0;
$first_time = 0;
$landing = 0;
if ($aForm{ext} eq "" or $aForm{ext} eq "null") {$aForm{ext} = "\.xxx";}
$num_oingo_fields_before_tlds = 3;
srand (time ^ $$ ^ unpack "%32L*", `ps axww | gzip`);
$ran = int rand 1000000000;
if ($aForm{name} eq "" and $aForm{action} =~ /2/) {$landing = 1;}
$secondary_avails_here = 0;
if ($aForm{'view_more.x'})
{
$something_new = 1;
@oingo_tldfields = split /,/,$aForm{oingo_tld_fields};
}
else {$something_new = 0;}
$something_more = 0;
$tld_requested = 0;
$aForm{template} =~ /(.*)_.*/;
$template_directory = $1;
$biz_blurb = "
<div align=\"left\"><font size = -2 face = arial,helvetica>
Registrations in the .biz top-level domain (TLD) must be used or intended to be used primarily for bona fide
business or commercial purposes. For more information about appropriate & inappropriate use, refer to the
<a href=\"http://domains.yahoo.com/inwwagree.html\">Domain Registration Agreement</a>.</font><br><br></div>
";
}
sub SetupLookAndFeel
{
# Template 1 is the results page, template 2 is the landing page.
# Split each into two parts. Part "a" is output before the blackbox output,
# part "b" after it.
# Look and feel variables in the blackbox html are first filled
# in from the defaults in the defaults file. Then any user-defined
# overrides are applied on top of that, from the user variables file.
# The black box html (with search results, if any) is inserted at
# the appropriate point in the template html.
if (-e "/Space/209.132.1/068/Server/Documents/Templates/$template_directory/$aForm{template}_1.html"
and -e "/Space/209.132.1/068/Server/Documents/Templates/$template_directory/$aForm{template}_2.html")
{
$template1_path = "/Space/209.132.1/068/Server/Documents/Templates/$template_directory/$aForm{template}_1.html";
$template2_path = "/Space/209.132.1/068/Server/Documents/Templates/$template_directory/$aForm{template}_2.html";
}
else
{
$template1_path = "/Space/209.132.1/068/Server/Documents/Templates/domains/domains_a_1.html";
$template2_path = "/Space/209.132.1/068/Server/Documents/Templates/domains/domains_a_2.html";
}
open(TEMPLATE1_FILE,"$template1_path") or die "Can't open $template1_path: $!\n";
while ($line = <TEMPLATE1_FILE> and $line !~ /blackboxoutput/)
{
$template1a_html .= $line;
}
while ($line = <TEMPLATE1_FILE>) {$template1b_html .= $line;}
close TEMPLATE1_FILE;
open(TEMPLATE2_FILE,"$template2_path") or die "Can't open $template2_path: $!\n";
while ($line = <TEMPLATE2_FILE> and $line !~ /blackboxoutput/)
{
$template2a_html .= $line;
}
while ($line = <TEMPLATE2_FILE>) {$template2b_html .= $line;}
close TEMPLATE2_FILE;
open(BLACKBOX_FILE,"/Space/209.132.1/068/Server/Documents/Templates/blackbox.html") or die "Can't open /Templates/blackbox.html: $!\n";
while ($line = <BLACKBOX_FILE>)
{
$blackbox_html .= $line;
}
close BLACKBOX_FILE;
if ($landing)
{
$blackbox_html =~ s/searchbox_/landing_searchbox_/ig;
$blackbox_html =~ s/main_border_/landing_main_border_/ig;
$blackbox_html =~ s/main_interior_/landing_main_interior_/ig;
}
else
{
$blackbox_html =~ s/searchbox_/results_searchbox_/ig;
$blackbox_html =~ s/main_border_/results_main_border_/ig;
$blackbox_html =~ s/main_interior_/results_main_interior_/ig;
}
# Populate look and feel variables hash with default values
open(DEFAULT_VARIABLES_FILE,"/Space/209.132.1/068/Server/Documents/Templates/default/default_variables.txt") or die "Can't open /Templates/default/default_variables.txt: $!\n";
while ($line = <DEFAULT_VARIABLES_FILE>)
{
if ($line =~ /^\#/ or $line =~ /^\s/) {next;}
if ($line =~ /=/)
{
($name,$value) = split /=/,$line,2; # 2 allows ='s in value
chomp($value);
$lookandfeel{$name} = $value;
}
}
close DEFAULT_VARIABLES_FILE;
# Override any look and feel variables with values that user has supplied
open(USER_VARIABLES_FILE,"/Space/209.132.1/068/Server/Documents/Templates/$template_directory/$aForm{template}_variables.txt") or die "Can't open /Templates/$template_directory/$aForm{template}_variables.txt: $!\n";
while ($line = <USER_VARIABLES_FILE>)
{
if ($line =~ /^\#/ or $line =~ /^\s/) {next;}
if ($line =~ /=/)
{
($name,$value) = split /=/,$line,2; # 2 allows ='s in value
chomp($value);
$lookandfeel{$name} = $value;
}
}
close USER_VARIABLES_FILE;
# Do this now so any overrides already seen are overriden by this
if ($landing) {$lookandfeel{searchagain_type} = "box";}
if ($aForm{review_my_list}
or $aForm{update_my_list}
or $aForm{update_my_list_review}
or $aForm{'view_more.x'}
or $aForm{update_my_list_viewmore}
)
{
$lookandfeel{primary_border_color} = "#FFFFFF";
}
if ($lookandfeel{user_show_landing} =~ /y/ or $lookandfeel{user_show_results} =~ /y/)
{SetupUseridAppearance();}
# Apply merged variable values to blackbox html
foreach $key (sort keys %lookandfeel)
{
$temp = $lookandfeel{$key};
$blackbox_html =~ s/$key/$temp/ig;
}
}
sub PostSetupInit
{
@tld = split /,/, $lookandfeel{tld_list};
@default_tlds = split /,/,$lookandfeel{default_tld};
$num_primary_domains = $#tld + 1;
$num_secondary_rows_page1 = $lookandfeel{secondary_display_number1};
if ($lookandfeel{secondary_display_number2} =~ /all/)
{
$max_viewmore_rows = 999;
}
else # Set to 0 to turn off
{
$max_viewmore_rows = $lookandfeel{secondary_display_number2};
}
# $num_secondary_rows_page1 = 3;
# $max_viewmore_rows = 50; # Set to 0 to turn off
}
sub ExitScript
{
#DoTimeOut();
exit;
}
sub OutputPage
{
OutputBlackboxA();
OutputBeginning();
if ($error_exists or $landing) {}
elsif
(
$aForm{update_my_list}
or $aForm{review_my_list}
or $aForm{update_my_list_review}
or $aForm{update_my_list_viewmore}
or $aForm{secure_checkout}
)
{OutputReview();}
elsif ($aForm{'view_more.x'}) {OutputViewMore();}
else # I.e., first time
{
OutputPreliminary();
if (not $aForm{'view_more.x'}) {OutputPrimary();}
if ($lookandfeel{secondary_show} =~ /y/i) {OutputSecondary();}
if ($lookandfeel{user_show_results} =~ /y/i
and $yid
and not $aForm{'view_more.x'}) {OutputUserid();}
OutputButtonsResults();
OutputEndForm();
}
OutputSearchagain();
if ($landing and $lookandfeel{user_show_landing} =~ /y/i)
{
$first_time = 1;
$aForm{name} = "fromlanding";
$num_domains = $aForm{num_domains};
OutputFormAndMiscHiddens();
if ($yid) {OutputUserid();}
UpdateDomainlistCookieHiddens(); # Needs OutputUserid done 1st to get s_d_l
@sorted_page_list = @page_list;
$num_domains = @sorted_domain_list;
OutputButtonsResults();
OutputEndForm();
}
OutputBeacon();
OutputEnd();
OutputBlackboxB();
}
sub OutputBlackboxA
{
SetupPersonalization();
if ($landing) # Landing page
{
(@out_lines_a) = split /\n/,$template2a_html;
(@out_lines_b) = split /\n/,$template2b_html;
}
else # Results page
{
(@out_lines_a) = split /\n/,$template1a_html;
(@out_lines_b) = split /\n/,$template1b_html;
}
foreach $line (@out_lines_a) {print "$line\n";}
SetupQuerystring(); # Do now, before split, even if not used
(@out_blackbox_lines) = split /\n/,$blackbox_html;
ChopupBlackbox();
$bbi = 0;
}
sub SetupPersonalization
{
if ($yid)
{
$person = "
<table width=750 cellpadding=2 cellspacing=0 border=0 bgcolor=\"#dcdcdc\" align=\"center\">
<tr>
<td><font face=arial size=-1><b>Welcome, $yid!</b></font></td>
<td align=right nowrap><font face=arial size=-1><a href=http://edit.yahoo.com/config/eval_profile?.done=http%3a//domains.yahoo.com/>Account Info</a> -
<a href=http://login.yahoo.com/config/login?logout=1&.intl=us&.src=dom&.done=http%3a//login.yahoo.com/config/login%3f.intl=us%26.src=dom%26.done=http%253a//domains.yahoo.com>Sign Out</a></font></td>
</tr>
</table>";
}
else
{
$person = "
<table width=750 cellpadding=2 cellspacing=0 border=0 bgcolor=\"#dcdcdc\" align=\"center\">
<tr>
<td><font face=arial size=-1><b>Welcome, Guest</b></font></td>
<td align=right nowrap><font face=arial size=-1>
<a href=http://login.yahoo.com/config/login?.src=dom>Sign In</a></font></td>
</tr>
</table>";
}
if ($landing)
{
$template2a_html =~ s/begin personalization bar -->/begin personalization bar --> $person/;
}
else
{
$template1a_html =~ s/begin personalization bar -->/begin personalization bar --> $person/;
}
}
sub ChopupBlackbox
{
CaptureBeginning();
CaptureBeginForm();
CapturePrimary();
CaptureSecondary();
CaptureUserid();
CaptureReview();
CaptureResultSubmit();
CaptureSearchagain();
CaptureBeacon();
CaptureEnd();
}
sub CaptureBeginning
{
my $bbi = 0;
until (@out_blackbox_lines[$bbi] =~ /Start the begin-form tag/)
{
push @blackbox_beginning_lines,@out_blackbox_lines[$bbi];
$bbi++;
}
}
sub CaptureBeginForm
{
my $bbi = 0;
while (@out_blackbox_lines[$bbi] !~ /Start the begin-form tag/) {$bbi++;}
until (@out_blackbox_lines[$bbi] =~ /End the begin-form tag/)
{
push @blackbox_beginform_lines,@out_blackbox_lines[$bbi];
$bbi++;
}
push @blackbox_beginform_lines,@out_blackbox_lines[$bbi];
}
sub CapturePrimary
{
my $bbi = 0;
while (@out_blackbox_lines[$bbi] !~ /Start Holding Table Primary Output/) {$bbi++;}
until (@out_blackbox_lines[$bbi] =~ /End Holding Table Primary Output/)
{
push @blackbox_primary_lines,@out_blackbox_lines[$bbi];
$bbi++;
}
push @blackbox_primary_lines,@out_blackbox_lines[$bbi];
}
sub CaptureSecondary
{
my $bbi = 0;
while (@out_blackbox_lines[$bbi] !~ /Start Holding Table Secondary Output/) {$bbi++;}
until (@out_blackbox_lines[$bbi] =~ /End Holding Table Secondary Output/)
{
push @blackbox_secondary_lines,@out_blackbox_lines[$bbi];
$bbi++;
}
push @blackbox_secondary_lines,@out_blackbox_lines[$bbi];
}
sub CaptureUserid
{
my $bbi = 0;
while (@out_blackbox_lines[$bbi] !~ /Start Holding Table Userid Output/) {$bbi++;}
until (@out_blackbox_lines[$bbi] =~ /End Holding Table Userid Output/)
{
push @blackbox_userid_lines,@out_blackbox_lines[$bbi];
$bbi++;
}
push @blackbox_userid_lines,@out_blackbox_lines[$bbi];
}
sub CaptureReview
{
my $bbi = 0;
while (@out_blackbox_lines[$bbi] !~ /Start Holding Table Review Output/) {$bbi++;}
until (@out_blackbox_lines[$bbi] =~ /End Holding Table Review Output/)
{
push @blackbox_review_lines,@out_blackbox_lines[$bbi];
$bbi++;
}
push @blackbox_review_lines,@out_blackbox_lines[$bbi];
}
sub CaptureResultSubmit
{
my $bbi = 0;
while (@out_blackbox_lines[$bbi] !~ /Start Result Submit Buttons/) {$bbi++;}
until (@out_blackbox_lines[$bbi] =~ /End Result Submit Buttons/)
{
push @blackbox_resultsubmit_lines,@out_blackbox_lines[$bbi];
$bbi++;
}
push @blackbox_resultsubmit_lines,@out_blackbox_lines[$bbi];
}
sub CaptureSearchagain
{
my $bbi = 0;
while (@out_blackbox_lines[$bbi] !~ /Start Holding Table Searchagain Output/) {$bbi++;}
until (@out_blackbox_lines[$bbi] =~ /ALL three are included here\./)
{
push @blackbox_searchagain_start_lines,@out_blackbox_lines[$bbi];
$bbi++;
}
push @blackbox_searchagain_start_lines,@out_blackbox_lines[$bbi];
$bbi++;
until (@out_blackbox_lines[$bbi] =~ /End searchagain = none/)
{
push @blackbox_searchagain_middle_lines,@out_blackbox_lines[$bbi];
$bbi++;
}
push @blackbox_searchagain_middle_lines,@out_blackbox_lines[$bbi];
$bbi++;
until (@out_blackbox_lines[$bbi] =~ /End Holding Table Searchagain Output/)
{
push @blackbox_searchagain_end_lines,@out_blackbox_lines[$bbi];
$bbi++;
}
push @blackbox_searchagain_end_lines,@out_blackbox_lines[$bbi];
}
sub CaptureBeacon
{
my $bbi = 0;
while (@out_blackbox_lines[$bbi] !~ /Start Beacon/) {$bbi++;}
until (@out_blackbox_lines[$bbi] =~ /End Beacon/)
{
push @blackbox_beacon_lines,@out_blackbox_lines[$bbi];
$bbi++;
}
push @blackbox_beacon_lines,@out_blackbox_lines[$bbi];
}
sub CaptureEnd
{
my $bbi = 0;
until (@out_blackbox_lines[$bbi] =~ /End Holding Table Searchagain Output/) {$bbi++;}
$bbi++;
while (@out_blackbox_lines[$bbi])
{
push @blackbox_end_lines,@out_blackbox_lines[$bbi];
$bbi++;
}
}
sub OutputBlackboxB
{
foreach $line (@out_lines_b) {print "$line\n";}
}
sub OutputBeginning
{
my $bbi = 0;
while (@blackbox_beginning_lines[$bbi]) {print "@blackbox_beginning_lines[$bbi]\n"; $bbi++;}
}
sub OutputPreliminary
{
UpdateDomainlistCookieHiddens();
@sorted_page_list = @page_list;
$num_domains = @sorted_domain_list;
OutputFormAndMiscHiddens();
}
sub OutputPrimary
{
my $bbi = 0;
while (@blackbox_primary_lines[$bbi] !~ /Put out the primary results messages/) {print "@blackbox_primary_lines[$bbi]\n"; $bbi++;}
print "@blackbox_primary_lines[$bbi]\n";
$bbi++;
OutputResultsMessage();
while (@blackbox_primary_lines[$bbi] !~ /Start "primary results" table/) {print "@blackbox_primary_lines[$bbi]\n"; $bbi++;}
print "@blackbox_primary_lines[$bbi]\n";
$bbi++;
while (@blackbox_primary_lines[$bbi] !~ /Start loop through search for primary list of tlds/) {print "@blackbox_primary_lines[$bbi]\n"; $bbi++;}
print "@blackbox_primary_lines[$bbi]\n";
$bbi++;
PutOutResults();
print "$hidden_domains\n";
while (@blackbox_primary_lines[$bbi] !~ /End Holding Table Primary Output/) {print "@blackbox_primary_lines[$bbi]\n"; $bbi++;}
print "@blackbox_primary_lines[$bbi]\n";
$bbi++;
}
sub OutputSecondary
{
my $bbi = 0;
while (@blackbox_secondary_lines[$bbi] !~ /Start Secondary output results heading 1/) {print "@blackbox_secondary_lines[$bbi]\n"; $bbi++;}
print "@blackbox_secondary_lines[$bbi]\n";
$bbi++;
if ($lookandfeel{secondary_show} !~ /n/i)
{
BuildSecondaryOutput();
if ($something_new)
{
print <<EOF;
<table width="100%" border=0 cellspacing=0 cellpadding=0 bgcolor="$lookandfeel{secondary_header_bgcolor}">
<tr bgcolor="$lookandfeel{secondary_header_bgcolor}">
<td><font face=arial,helvetica color="$lookandfeel{secondary_header_text_color}"><b>$lookandfeel{secondary_header_text_text}</b></font></td>
<td></td>
</tr>
</table>
EOF
}
}
while (@blackbox_secondary_lines[$bbi] !~ /Start Secondary output results heading 2/) {print "@blackbox_secondary_lines[$bbi]\n"; $bbi++;}
print "@blackbox_secondary_lines[$bbi]\n";
$bbi++;
if ($lookandfeel{secondary_show} !~ /n/i and $something_new)
{
print "$secondary_output1";
}
while (@blackbox_secondary_lines[$bbi] !~ /Start Secondary output results body/) {print "@blackbox_secondary_lines[$bbi]\n"; $bbi++;}
print "@blackbox_secondary_lines[$bbi]\n";
$bbi++;
if ($lookandfeel{secondary_show} !~ /n/i and $something_new)
{
print "$secondary_output2";
while (@blackbox_secondary_lines[$bbi] !~ /Start Secondary output view more link/) {print "@blackbox_secondary_lines[$bbi]\n"; $bbi++;}
print "@blackbox_secondary_lines[$bbi]\n";
$bbi++;
print "$secondary_output3";
}
while (@blackbox_secondary_lines[$bbi] !~ /Start Secondary Hiddens/) {print "@blackbox_secondary_lines[$bbi]\n"; $bbi++;}
print "@blackbox_secondary_lines[$bbi]\n";
$bbi++;
if ($lookandfeel{secondary_show} !~ /n/i and $something_new)
{
if ($aForm{'view_more.x'})
{
$num_domains = $aForm{num_domains};
foreach $oingotld (@oingo_tldfields) {$oingo_tld_fields .= $oingotld . ",";}
chop $oingo_tld_fields; # Remove last comma
}
print " <input type = \"hidden\" name = \"oingo_tld_fields\" value = \"$oingo_tld_fields\">\n";
print "$hidden_domains\n";
}
while (@blackbox_secondary_lines[$bbi] !~ /End Holding Table Secondary Output/) {print "@blackbox_secondary_lines[$bbi]\n"; $bbi++;}
print "@blackbox_secondary_lines[$bbi]\n";
$bbi++;
}
sub OutputViewMore
{
OutputFormAndMiscHiddens();
OutputSecondary();
OutputButtonsResults();
OutputEndForm();
}
sub OutputUserid
{
my $bbi = 0;
AccessUDB();
BuildUseridDomainstubList();
# $aForm{name} = $yid;
while (@blackbox_userid_lines[$bbi] !~ /Start Userid output results heading 1/) {print "@blackbox_userid_lines[$bbi]\n"; $bbi++;}
print "@blackbox_userid_lines[$bbi]\n";
$bbi++;
my $colspan = $#tld + 2;
print <<EOF;
<table width="100%" border=0 cellspacing=0 cellpadding=0 bgcolor="$userid_bgcolor">
<tr bgcolor="$userid_bgcolor">
<td><font face=arial,helvetica color="$userid_text_color">$userid_heading</font></td>
<td></td>
</tr>
</table>
EOF
while (@blackbox_userid_lines[$bbi] !~ /Start Userid output results body/) {print "@blackbox_userid_lines[$bbi]\n"; $bbi++;}
print "@blackbox_userid_lines[$bbi]\n";
$bbi++;
if ($lookandfeel{user_show_landing} =~ /y/i) {BuildHeaderRow();}
foreach $userid_domainstub (@userid_domainstub_list) {BuildPrimaryContentRowUserid("$userid_domainstub");}
while (@blackbox_userid_lines[$bbi] !~ /Start Userid Hiddens/) {print "@blackbox_userid_lines[$bbi]\n"; $bbi++;}
print "@blackbox_userid_lines[$bbi]\n";
$bbi++;
print "$hidden_domains\n";
while (@blackbox_userid_lines[$bbi] !~ /End Holding Table Userid Output/) {print "@blackbox_userid_lines[$bbi]\n"; $bbi++;}
print "@blackbox_userid_lines[$bbi]\n";
$bbi++;
}
sub SetupUseridAppearance
{
$userid_heading = '';
if ($landing)
{
$lookandfeel{user_border_color} = $lookandfeel{user_landing_border_color};
$userid_heading = $lookandfeel{user_landing_header_text_text};
$userid_bgcolor = $lookandfeel{user_landing_header_bgcolor};
$userid_text_color = $lookandfeel{user_landing_header_text_color};
}
else
{
$lookandfeel{user_border_color} = $lookandfeel{user_results_border_color};
$userid_heading = $lookandfeel{user_results_header_text_text};
$userid_bgcolor = $lookandfeel{user_results_header_bgcolor};
$userid_text_color = $lookandfeel{user_results_header_text_color};
}
if ($lookandfeel{user_landing_header_text_bold} =~ /on/)
{$userid_heading = "<b>$userid_heading</b>";}
}
sub AccessUDB
{
my $udb = new UDB_access();
$udb->uid("y.$yid");
$udb->add_keys("demog");
my $demog = $udb->get("demog");
if ($udb->{ERROR})
{
# comment this out or log it when going live
# print "ERROR: $udb->{ERROR}";
# exit;
}
# print "demog = $demog<br>\n";
@udb_keys = split /\cA/,$demog;
foreach $key (@udb_keys)
{
my @temp = split /\cB/,$key;
$udb_data{$temp[0]} = $temp[1];
}
$first_name = lc($udb_data{'FN'});
$last_name = lc($udb_data{'LN'});
$first_initial = substr($first_name,0,1);
}
sub BuildUseridDomainstubList
{
@userid_domainstub_list = ("$last_name", "$first_name", "$first_initial$last_name",
"$first_name$last_name", "$last_name$first_name");
my $work_yid = lc($yid);
$work_yid =~ s/_/-/g;
# Yahoo! ID might match one of other entries based on name. If so, omit it.
my $dup = 0;
foreach $entry (@userid_domainstub_list)
{
if ($work_yid eq $entry) {$dup = 1; last;}
}
if (not $dup) {$userid_domainstub_list[$#userid_domainstub_list+1] = $work_yid;}
}
sub OutputReview
{
my $bbi = 0;
while (@blackbox_review_lines[$bbi] !~ /Start Holding Table Review Output/) {$bbi++;}
print "@blackbox_review_lines[$bbi]\n"; # Put out comment line
$bbi++;
while (@blackbox_review_lines[$bbi] !~ /Start Review table/) {print "@blackbox_review_lines[$bbi]\n"; $bbi++;}
print "@blackbox_review_lines[$bbi]\n"; # Put out comment line
$bbi++;
print "@blackbox_review_lines[$bbi]\n"; # Put out table tag
$bbi++;
PutReviewForm();
if ($cookie_domains[0]) {OutputButtonsReview();}
while (@blackbox_review_lines[$bbi] !~ /End Holding Table Review Output/) {print "@blackbox_review_lines[$bbi]\n"; $bbi++;}
print "@blackbox_review_lines[$bbi]\n";
$bbi++;
}
sub OutputSearchagain
{
my $bbi = 0;
while (@blackbox_searchagain_start_lines[$bbi] ne '') {print "@blackbox_searchagain_start_lines[$bbi]\n"; $bbi++;}
$bbi = 0;
if ($lookandfeel{searchagain_type} =~ /box/)
{
while (@blackbox_searchagain_middle_lines[$bbi] !~ /Set up form for subsequent search/) {print "@blackbox_searchagain_middle_lines[$bbi]\n"; $bbi++;}
print "@blackbox_searchagain_middle_lines[$bbi]\n";
OutputFormAndMiscHiddensSearchbox();
if ($error_exists)
{
while (@blackbox_searchagain_middle_lines[$bbi] !~ /searchagain message color: display_searchtext/) {print "@blackbox_searchagain_middle_lines[$bbi]\n"; $bbi++;}
print "@blackbox_searchagain_middle_lines[$bbi]\n";
$bbi++;
@blackbox_searchagain_middle_lines[$bbi] =~ s/color=".*"/color="$lookandfeel{error_text_color}"/ig;
@blackbox_searchagain_middle_lines[$bbi] =~ s/<b>.*<\/b>/<b>$msg<\/b>/ig;
print "@blackbox_searchagain_middle_lines[$bbi]\n";
$bbi++;
}
while (@blackbox_searchagain_middle_lines[$bbi] !~ /End searchagain = box/) {print "@blackbox_searchagain_middle_lines[$bbi]\n"; $bbi++;}
print "@blackbox_searchagain_middle_lines[$bbi]\n";
$bbi++;
}
elsif ($lookandfeel{searchagain_type} =~ /link/)
{
if ($error_exists)
{
while (@blackbox_searchagain_middle_lines[$bbi] !~ /ALL three are included here/) {print "@blackbox_searchagain_middle_lines[$bbi]\n"; $bbi++;}
print "@blackbox_searchagain_middle_lines[$bbi]\n";
$bbi++;
print "<font face=\"arial\" color=\"$lookandfeel{error_text_color}\"><b>$msg</b></font>";
}
# Bypass searchagain = box
while (@blackbox_searchagain_middle_lines[$bbi] !~ /Start searchagain = link/) {$bbi++;}
$bbi++;
while (@blackbox_searchagain_middle_lines[$bbi] !~ /End searchagain = link/) {print "@blackbox_searchagain_middle_lines[$bbi]\n"; $bbi++;}
print "@blackbox_searchagain_middle_lines[$bbi]\n";
}
else
{
if ($error_exists)
{
while (@blackbox_searchagain_middle_lines[$bbi] !~ /ALL three are included here/) {print "@blackbox_searchagain_middle_lines[$bbi]\n"; $bbi++;}
print "@blackbox_searchagain_middle_lines[$bbi]\n";
$bbi++;
print "<font face=\"arial\" color=\"$lookandfeel{error_text_color}\"><b>$msg</b></font>";
}
while (@blackbox_searchagain_middle_lines[$bbi] !~ /Start searchagain = none/) {$bbi++;}
print "@blackbox_searchagain_middle_lines[$bbi]\n";
$bbi++;
print "@blackbox_searchagain_middle_lines[$bbi]\n";
}
$bbi = 0;
while (@blackbox_searchagain_end_lines[$bbi] ne '') {print "@blackbox_searchagain_end_lines[$bbi]\n"; $bbi++;}
}
sub OutputBeacon
{
if ($landing and $lookandfeel{user_show_landing} =~ /n/i) {return;}
my $bbi = 0;
while (@blackbox_beacon_lines[$bbi] !~ /Start Beacon/) {print "@blackbox_beacon_lines[$bbi]\n"; $bbi++;}
print "@blackbox_beacon_lines[$bbi]\n"; $bbi++; # Print comment line
print "@blackbox_beacon_lines[$bbi]\n"; $bbi++; # Print <tr>
print "@blackbox_beacon_lines[$bbi]\n"; $bbi++; # Print <td>
if ($aForm{update_my_list} or $aForm{review_my_list} or $aForm{update_my_list_review})
{
print <<EOF;
<img alt="Yahoo Image" width=1 height=1 border=0 src="http://pclick.yahoo.com/p/s=$lookandfeel{data_beacon_reviewlist}/lng=us/rand=$ran">
EOF
return;
}
elsif ($aForm{'view_more.x'} or $aForm{update_my_list_viewmore})
{
print <<EOF;
<img alt="Yahoo Image" width=1 height=1 border=0 src="http://pclick.yahoo.com/p/s=$lookandfeel{data_beacon_viewmore}/lng=us/rand=$ran">
EOF
return;
}
# Viewing results
if ($tld_not_found) # Unsupported or garbage tld entered
{
print <<EOF;
<img alt="Yahoo Image" width=1 height=1 border=0 src="http://pclick.yahoo.com/p/s=$lookandfeel{data_beacon_none}/lng=us/rand=$ran">
EOF
}
elsif (! $avails_here) # None available
{
print <<EOF;
<img alt="Yahoo Image" width=1 height=1 border=0 src="http://pclick.yahoo.com/p/s=$lookandfeel{data_beacon_none}/lng=us/rand=$ran">
EOF
}
elsif ($status eq "A") # Yours is available
{
print <<EOF;
<img alt="Yahoo Image" width=1 height=1 border=0 src="http://pclick.yahoo.com/p/s=$lookandfeel{data_beacon_yes}/lng=us/rand=$ran">
EOF
}
else # Yours isn't available, but another *is*
{
print <<EOF;
<img alt="Yahoo Image" width=1 height=1 border=0 src="http://pclick.yahoo.com/p/s=$lookandfeel{data_beacon_other}/lng=us/rand=$ran">
EOF
}
while (@blackbox_beacon_lines[$bbi] !~ /End Beacon/) {print "@blackbox_beacon_lines[$bbi]\n"; $bbi++;}
print "@blackbox_beacon_lines[$bbi]\n"; $bbi++;
}
sub OutputButtonsResults
{
my $bbi = 0;
while (@blackbox_resultsubmit_lines[$bbi] !~ /Start Result Submit Buttons/) {print "@blackbox_resultsubmit_lines[$bbi]\n"; $bbi++;}
print "@blackbox_resultsubmit_lines[$bbi]\n";
$bbi++;
if ($avails_here or $secondary_avails_here or $cookie_domains[0])
{
print <<EOF;
<tr>
<td>
<table width="100%">
EOF
}
if ($avails_here or $secondary_avails_here)
{
if (not $landing)
{
print <<EOF;
<tr>
<td align = center>
<font size = $lookandfeel{nextstep_msg_size} color = $lookandfeel{nextstep_msg_color} face = arial,helvetica>
<b>$lookandfeel{nextstep_msg_text}</b>
</font>
</td>
</tr>
EOF
}
print <<EOF;
<tr>
<td align = center>
<table>
<tr>
EOF
PutNextStepButton();
if ($cookie_domains[0] and not $landing) {PutReviewButton();}
}
elsif ($cookie_domains[0])
{
print <<EOF;
<tr>
<td align = center>
<table>
<tr>
EOF
PutReviewButton();
}
if ($avails_here or $secondary_avails_here or $cookie_domains[0])
{
print <<EOF;
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
EOF
}
while (@blackbox_resultsubmit_lines[$bbi] !~ /End Result Submit Buttons/) {print "@blackbox_resultsubmit_lines[$bbi]\n"; $bbi++;}
print "@blackbox_resultsubmit_lines[$bbi]\n";
$bbi++;
}
sub OutputEnd
{
my $bbi = 0;
while (@blackbox_end_lines[$bbi]) {print "@blackbox_end_lines[$bbi]\n"; $bbi++;}
}
sub OutputEndForm
{
print <<EOF;
</form>
EOF
}
sub SetupQuerystring
{
# Action = 2 because they can't supply a domain name when using the link
$searchlink_url = "http://whois.domains.yahoo.com/cgi-bin/domain_search.cgi";
$searchlink_querystring = "?action=2&property=domains&template=$aForm{template}&promotion_code=$aForm{promotion_code}";
$blackbox_html =~ s/searchlink_href/$searchlink_url$searchlink_querystring/ig;
}
#############################################################################################
sub BuildSecondaryOutput
{
# Not ideal, but we call and parse on view_more now, so we get field list built.
# originally, we didn't call/parse on view_more, 'cause we had hardcoded list
# of Oingo tld's (and fields in general). Even generating list of tld's from
# list of primary tld's doesn't work properly for Oingo results because we
# might see primary tld's that Oingo doesn't recognize. If that were the case,
# the secondary (Oingo) results would contain bogus columns for tld's in the
# primary list but not recognized by Oingo. So, there's now a hidden field
# with the domain name, which the Oingo call can use when it's a view_more.
if (not $aForm{'view_more.x'}) {CallOingo(); ParseOingo();}
if ($something_new)
{
if ($aForm{'view_more.x'}) {BuildOingoOutputViewMore();}
else {BuildOingoOutput();}
}
}
sub CallOingo
{
my $domain = "";
if ($aForm{'view_more.x'}) {$domain = $aForm{name};} else {$domain = $name;}
my $oingo_cid = "YAHO4210";
$oingo_uid = "$ENV{REMOTE_ADDR}";
$oingo_uid =~ s/^\d+\.\d+\.//; # Agreement is to just give 'em last two components of IP
my $URL = 'domain.oingo.com/2.0/dsxml.cgi';
#my $URL = "www.nameboy.com/xboy/xsearch.php";
foreach $primary_tld (@tld) {$secondary_tlds .= "&tld=$primary_tld";}
my $contentdata = "uid=$oingo_uid&cid=$oingo_cid&s=$domain&fm=ds4$secondary_tlds";
#my $contentdata = "primary=$domain&affid=YAHOOTEST";
my $ua = new LWP::UserAgent;
$ua->timeout(10);
$ua->agent("Yahoo! Domain Search" . $ua->agent);
my $req = new HTTP::Request 'GET' => "http://$URL?$contentdata";
$req->header('Accept' => 'text/html');
# send request
my $res = $ua->request($req);
# check the outcome
if ($res->is_success)
{
# Everything ok
# print "Oingo success!<br>";
CutLogRec1("y");
}
else
{
# Failed
# print "Oingo error!<br>";
CutLogRec1("n");
}
($a,$raw_oingo_data) = split /]>/, $res->content;
$raw_oingo_data =~ s/<//g;
$raw_oingo_data =~ s/\/>//g;
@raw_oingo_data = split /DOMAINS\s*/, $raw_oingo_data;
}
sub ParseOingo
{
# Create array of hashes, one hash per domain result
my $line;
# Skip first entry, which has "oingo_domainsense" and
# next entry. We skip that next entry because its
# results are redundant, having the same domain and
# some or all of the tld's as our primary results.
# Robyn, on 4/25/01, assured me that no tld in the
# secondary (Oingo) set of tld's would be in that set
# but not in the primary (default) set of tld's.
# This way we avoid displaying a row of secondary
# results that has domain.tlds we've already seen above
# in the primary results --- if there were even one
# tld in the Oingo tld list that wasn't in the primary
# tld list, we'd need to show its result, and therefore
# the row that it's in, and thus the redundant results.
# Robyn was aware of this when giving the above decree.
my $first_oingo_parse = 1;
$oingo_tld_fields = "";
for ($i = 2; $i < $#raw_oingo_data; $i++)
{
$line = $raw_oingo_data[$i];
if ($line =~ /oingo_domainsense/) {next;}
$line =~ s/^<//;
$line =~ s/\/>?//;
(@work_line) = split / /, $line;
my %work_hash;
my $i = 0;
my $yes_row = 0;
foreach $key (@work_line)
{
if ($key =~ /=/)
{
($name,$value) = split /=/,$key;
$value =~ s/"//g;
$work_hash{$name} = $value;
# If any tld result for row is "not registered," put out row
if ($i >= $num_oingo_fields_before_tlds and $value =~ /n/)
{
$yes_row = 1;
}
if ($first_oingo_parse)
{
push (@oingo_result_fields,$name);
# Determine Oingo tld's dynamically from results.
# Submit all tld's from primary list to Oingo. Parse
# Oingo results to see which tld's it recognizes.
# Add those tld's to list of Oingo tld fields.
if ($i >= $num_oingo_fields_before_tlds) # It's a tld
{$oingo_tld_fields .= $name . ",";}
}
}
$i++;
}
if ($first_oingo_parse)
{
$first_oingo_parse = 0;
chop $oingo_tld_fields; # Remove last comma
# (Re)sequence the Oingo tld fields so that they're in
# the same order as the primary ones.
my $d_tld, $work_list;
foreach $d_tld (@tld)
{
if ($oingo_tld_fields =~ $d_tld) {$work_list .= $d_tld . ",";}
}
chop $work_list; # Remove last comma
$oingo_tld_fields = $work_list;
@oingo_tld_field_array = split /,/, $oingo_tld_fields;
}
# This uses a "reference" - see Perl manual p. 244.
# It allows us to have array entries that are hashes,
# like putting the *address* of the hash in, rather
# than the hash itself.
if ($yes_row) {push(@oingo_results,\%work_hash);}
}
$num_oingo_tldfields = $#oingo_result_fields - $num_oingo_fields_before_tlds + 1;
$num_secondary_cols = $#oingo_result_fields - 1; # One col for domain name, one each for tld's
# More than just com/net/org returned, so show secondary results
if ($#oingo_results > 0) {$something_new = 1;}
# More than just first page's worth returned, so allow view more.
# $#oingo_results is relative to 0, so if 2 results, this is 1;
# We need more than 1 (com/net/org result) + $num_secondary_rows_page1 to
# allow view more, so if $num_secondary_rows_page1 = 3, we need > 4 results.
# This means $#oingo_results needs to be > 3.
if ($#oingo_results > $num_secondary_rows_page1) {$something_more = 1;}
# The following example shows how to access the referenced hash entries
# for ($i = 0; $i <= $#oingo_results; $i++)
# {
# for ($j = 0; $j <= $#oingo_result_fields; $j++)
# {
# print "$oingo_result_fields[$j] = $oingo_results[$i]{$oingo_result_fields[$j]}<br>";
# }
# }
}
sub BuildOingoOutput
{
$secondary_output = "";
$page_start, $page_end;
$page_start = 0;
$page_end = $num_secondary_rows_page1 - 1;
# Go through all secondary domains
# Update domain list and hiddens
# But only output rows for those in curr page (1st or more page)
for ($i = 0; $i <= $#oingo_results; $i++)
{
$secondary_output2 .= BuildContentRow("$i");
}
if ($something_more) {$secondary_output3 .= BuildFooterRow();}
}
sub BuildOingoOutputViewMore
{
CutLogRec1("v");
$secondary_output = "";
$page_start, $page_end;
$num_oingo_tldfields = $#oingo_tldfields + 1;
$num_secondary_cols = $num_oingo_tldfields + 1;
$page_start = $num_primary_domains + ($num_secondary_rows_page1 * $num_oingo_tldfields);
$page_end = $aForm{num_domains} - 1;
if (not $max_viewmore_rows
or $aForm{num_domains} < $page_start + ($max_viewmore_rows * $num_oingo_tldfields))
{
$page_end = $aForm{num_domains} - 1;
}
else
{
$page_end = $page_start + (($max_viewmore_rows - 1) * $num_oingo_tldfields);
}
$secondary_output1 .= BuildHeaderRowViewMore();
# Go through all secondary domains
# Update domain list and hiddens
# But only output rows for those in curr page (1st or more page)
# Note: take $num_primary_domains hiddens to process FIRST "row" (not actually output)
$secondary_output2 .= BuildContentRowViewMore("0");
# Note: take $num_oingo_tldfields hiddens at a time to build row
for ($i = $num_primary_domains; $i <= $aForm{num_domains} - $num_primary_domains; $i += $num_primary_domains)
# for ($i = $num_primary_domains; $i <= $aForm{num_domains} - $num_oingo_tldfields; $i += $num_oingo_tldfields)
{
$secondary_output2 .= BuildContentRowViewMore("$i");
}
}
sub BuildHeaderRowViewMore
{
my $i;
my $row = "";
$bgcolor = $lookandfeel{oddrow_color};
$color_gender = "even";
$row .= " <tr bgcolor=\"$bgcolor\"><td> </td>";
for ($i = 0; $i <= $#oingo_tldfields; $i++)
{
$row .= "<td align=\"center\"><font size = -1 face = arial,helvetica>\.<b>$oingo_tldfields[$i]</b></font></td>";
}
$row .= "</tr>\n";
return "$row";
}
sub BuildContentRow
{
my $sub = $_[0];
my $i;
my $row = "";
my $domain = "";
my $tld = "";
my $start_num = $num_oingo_fields_before_tlds;
my $end_num = $#oingo_result_fields;
$domain .= $oingo_results[$sub]{$oingo_result_fields[0]};
if ($sub >= $page_start and $sub <= $page_end)
{
if ($color_gender eq "odd")
{
$bgcolor = $lookandfeel{oddrow_color};
$color_gender = "even";
}
else
{
$bgcolor = $lookandfeel{evenrow_color};
$color_gender = "odd";
}
$row .= " <tr bgcolor=\"$bgcolor\"><td><font size = -1 face = arial,helvetica>$domain</font></td>";
}
# Put out a cell for each TLD for a row within curr page.
# Also update domain list and hiddens whether on curr page or not.
foreach $primary_tld (@tld) # Primary tld in ASI results?
{
my $tld_found = 0;
foreach $asi_tld (@oingo_tld_field_array) # Primary tld in ASI results?
{
if ($primary_tld eq $asi_tld) {$tld_found = 1; last;}
}
my $work_domain = $domain . "." . $primary_tld;
my $non_asi_tld_avail = 0;
if (not $tld_found)
{
if ($sub >= $page_start and $sub <= $page_end)
{
if (not (IsDelegated("$work_domain","127.0.0.1")))
{$non_asi_tld_avail = 1;}
# $row .= "<td width=\"1%\" align=\"center\" bgcolor=\"eeeeee\"><img src=\"/Templates/img/1x1.gif\" width=35 height=1 alt=\"\" border=\"0\"><br></td>";
}
}
if (
(not $tld_found and $non_asi_tld_avail)
or $oingo_results[$sub]{$primary_tld} =~ /n/
) # Avail
{
if ($sub >= $page_start and $sub <= $page_end)
{
$row .= "<td width=\"1%\" align=\"center\"><img src=\"/Templates/img/1x1.gif\" width=35 height=1 alt=\"\" border=\"0\"><br><input type = \"checkbox\" name = \"$work_domain\"></font></td>";
}
$domain_list[$#domain_list+1] = "A" . $work_domain . "NU";
# $domain_list[$#domain_list+1] = "A" . $work_domain . "NU" if $tld_found;
$secondary_avails_here = 1;
}
else
{
if ($sub >= $page_start and $sub <= $page_end)
{
$row .= "<td width=\"1%\" align=\"center\"><img src=\"/Templates/img/1x1.gif\" width=35 height=1 alt=\"\" border=\"0\"><br><font size = -2 face = arial,helvetica color=black>Taken</font></td>";
}
$domain_list[$#domain_list+1] = "R" . $work_domain . "NU";
# $domain_list[$#domain_list+1] = "R" . $work_domain . "NU" if $tld_found;
}
# if ($tld_found) # If not in ASI, will throw off view more, so omit
# {
$hidden_name = "domain" . "$#domain_list";
$hidden_domains .= "
<input type = \"hidden\" name = \"$hidden_name\" value = \"$domain_list[$#domain_list]\">";
# }
}
$num_domains = $#domain_list + 1; # 0 thru last num = last num + 1
if ($sub >= $page_start and $sub <= $page_end)
{
$row .= "</tr>\n";
}
return "$row";
}
sub BuildContentRowViewMore
{
my $sub = $_[0];
my $i;
my $row = "";
my $domain = "";
my $tld = "";
my $start_num = 0;
my $end_num;
# my $end_num = $#oingo_tldfields;
# First time in, use # of dflt tld's because can be diff from # secondary tld's
$end_num = $num_primary_domains - 1;
# if ($sub == 0) {$end_num = $num_primary_domains - 1;} else {$end_num = $#oingo_tldfields;}
$sorted_domain_list[$sub] =~ /^(\w)(.+)\..*(\w)(\w)$/;
$domain = $2;
if ($sub >= $page_start and $sub <= $page_end)
{
if ($color_gender eq "odd")
{
$bgcolor = $lookandfeel{oddrow_color};
$color_gender = "even";
}
else
{
$bgcolor = $lookandfeel{evenrow_color};
$color_gender = "odd";
}
$row .= " <tr bgcolor=\"$bgcolor\"><td><font size = -1 face = arial,helvetica>$domain</font></td>";
}
# Put out a cell for each TLD for a row within curr page.
# Also update domain list and hiddens whether on curr page or not.
for ($i = $start_num; $i <= $end_num; $i++)
{
# Step from 0 to n-1 thru row's tlds
my $ind = $i;
# Tld may not be 3 characters
$sorted_domain_list[$sub + $ind] =~ /^(\w)(.+)\.(.+)(\w)(\w)$/;
# $sorted_domain_list[$sub + $ind] =~ /^(\w)(.+)\..*(\w)(\w)$/;
$work_status = $1;
$domain = $2;
$curr_tld = $3;
$work_selected = $5;
# $work_selected = $4;
$tld = $oingo_tldfields[$i];
my $work_domain = $domain . "." . $tld;
next if $aForm{oingo_tld_fields} !~ /$curr_tld/;
if ($work_status =~ /A/) # Avail
{
if ($sub >= $page_start and $sub <= $page_end)
{
$row .= "<td width=\"1%\" align=\"center\"><img src=\"/Templates/img/1x1.gif\" width=35 height=1 alt=\"\" border=\"0\"><br><input type = \"checkbox\" name = \"$work_domain\"></td>";
}
$domain_list[$#domain_list+1] = "A" . $work_domain . "NU";
$secondary_avails_here = 1;
}
else
{
if ($sub >= $page_start and $sub <= $page_end)
{
$row .= "<td width=\"1%\" align=\"center\"><img src=\"/Templates/img/1x1.gif\" width=35 height=1 alt=\"\" border=\"0\"><br><font size = -2 face = arial,helvetica color=black>Taken</font></td>";
}
$domain_list[$#domain_list+1] = "R" . $work_domain . "NU";
}
}
$num_domains = $#domain_list + 1; # 0 thru last num = last num + 1
if ($sub >= $page_start and $sub <= $page_end)
{
$row .= "</tr>\n";
}
return "$row";
}
sub BuildFooterRow
{
my $row = "";
$row .= " <tr bgcolor=\"#ffffff\"><td colspan=$num_secondary_cols align=right><input type=\"image\" name=\"view_more\" src=\"/Templates/img/viewmore.gif\" value=\"$lookandfeel{viewmore_button_text}\" vspace=0 border=0></td></tr>\n";
# $row .= " <tr bgcolor=\"#ffffff\"><td colspan=$num_secondary_cols align=right><input type=\"submit\" name=\"view_more\" value=\"$lookandfeel{viewmore_button_text}\"></td></tr>\n";
return "$row";
}
#############################################################################################
sub Form1
{
if ($aForm{name} eq "" and $aForm{whois} ne "") {$aForm{name} = $aForm{whois};} # trackstar
&EditForm1Input;
}
sub EditInput
{
if ($aForm{name} eq "") {Error("1"); ExitScript();}
$name = $aForm{name};
$name =~ s/^http:\/\///;
$name =~ s/www\.//;
$name =~ s/[^a-zA-Z0-9\-\.]//g;
$name =~ /^([a-zA-Z0-9\-]+)(\..*)*/; # name.name_rest
$name = $1;
$name_rest = $2;
while ($name =~ /^-/ or $name =~ /-$/)
{
$name =~ s/^-//g; # Clean up pre-tld part
$name =~ s/-$//g; # Clean up pre-tld part
}
if (length($name) < 1) {Error("7"); ExitScript();}
if (length($name) > 63) {Error("4"); ExitScript();}
if ($name =~ /[^a-zA-Z0-9\-]/) {Error("5"); ExitScript();}
if ($name =~ /^\-/ or $name =~ /\-$/) {Error("6"); ExitScript();}
}
sub EditForm1Input
{
# &CutLogRec1;
EditInput();
if ($name_rest eq "\.") {$name_rest = "";}
$name_rest_save = $name_rest;
$name_rest = lc($name_rest);
# If name_rest null, check ext; else if in tld list, go on; else use name.com
if ($name_rest eq "")
{
# edit tld
# if one selected (not Select TLD or ---------) use it
# else default to .com
$ext = $aForm{ext};
$ext =~ tr/A-Z/a-z/;
if ($ext =~ /\.xxx/)
{
if ($default_tlds[0]) {$ext = "\." . $default_tlds[0];}
else {$ext = "\.com";}
}
}
else
{
$tld_not_found = 1;
for ($i = 0; $i <= $#tld; $i++)
{
if ($name_rest eq "\.$tld[$i]")
{
$tld_not_found = 0;
last;
}
}
# if ($name_rest eq "\.com" or $name_rest eq "\.net" or $name_rest eq "\.org")
if (not $tld_not_found) {$ext = $name_rest;}
elsif ($default_tlds[0]) {$ext = "\." . $default_tlds[0];}
else {$ext = "\.com";}
}
$prefix = $name;
$name .= $ext;
$domain = $name;
# we now have domain.tld
for ($i = 0; $i <= $#tld; $i++)
{
$domain_list[$i] = $prefix . "\.$tld[$i]";
if ($ext eq "\.$tld[$i]") {$tld_requested = $i;}
}
SetPrelimStatus();
@sorted_domain_list = @domain_list;
}
sub PutOutResults
{
BuildHeaderRow();
BuildPrimaryContentRow();
}
sub BuildHeaderRow
{
my $i;
my $row = "";
$bgcolor = $lookandfeel{oddrow_color};
$color_gender = "even";
$row .= " <tr bgcolor=\"$bgcolor\"><td> </td>\n";
for ($i = 0; $i <= $#tld; $i++)
{
$row .= " <td width=\"1%\" align=\"center\"><img src=\"/Templates/img/1x1.gif\" width=35 height=1 alt=\"\" border=\"0\"><br><font size = -1 face = arial,helvetica>\.<b>$tld[$i]</b></font></td>\n";
}
$row .= " </tr>\n";
print "$row";
}
sub BuildPrimaryContentRow
{
my $i;
my $row = "";
$sorted_page_list[0] =~ /^(\w)(.+)\w(\w)$/;
$work_domain = $2;
$work_domain =~ s/(.*)\.(.*)$/$1/;
if ($color_gender eq "odd")
{
$bgcolor = $lookandfeel{oddrow_color};
$color_gender = "even";
}
else
{
$bgcolor = $lookandfeel{evenrow_color};
$color_gender = "odd";
}
$row .= " <tr bgcolor=\"$bgcolor\"><td><font size = -1 face = arial,helvetica>$work_domain</font></td>\n";
for ($i = 0; $i < @sorted_page_list; $i++)
{
$sorted_page_list[$i] =~ /^(\w)(.+)\w(\w)$/;
my $status = $1;
my $domain = $2;
my $selected = $3;
my $checked = '';
if ($status eq "A")
{
$ext =~ /\.(.*)/; # test below thinks dot in $ext = "any", so
$ext_tld = $1; # omit then re-prepend as "dot"
# How can $3 be 'S' if this must be 1st time? Keep anyway...
if ($selected eq "S" or ($domain =~ /\.$ext_tld/ and not $tld_not_found))
{
$checked = "checked";
}
# If no tld was specified in the ext field or as part of the name field,
# checkmark all available tld's that are in list of default tld's.
elsif ($aForm{ext} =~ /xxx/ and not $name_rest_save)
{
foreach $default_tld (@default_tlds)
{
if ($domain =~ /\.$default_tld/)
{$checked = "checked"; last;}
}
}
$row .= " <td width=\"1%\" align=\"center\"><img src=\"/Templates/img/1x1.gif\" width=35 height=1 alt=\"\" border=\"0\"><br><input type = \"checkbox\" name = \"$domain\" $checked></td>\n";
# available("$domain","$3");
}
else
{
$row .= " <td width=\"1%\" align=\"center\"><img src=\"/Templates/img/1x1.gif\" width=35 height=1 alt=\"\" border=\"0\"><br><font size = -2 face = arial,helvetica color=black>Taken</font></td>\n";
# registered("$domain");
}
}
print "$row </tr>\n";
return;
}
sub BuildPrimaryContentRowUserid
{
my $domainstub = shift;
my $i;
my $row = "";
if ($color_gender eq "odd")
{
$bgcolor = $lookandfeel{oddrow_color};
$color_gender = "even";
}
else
{
$bgcolor = $lookandfeel{evenrow_color};
$color_gender = "odd";
}
$row = " <tr bgcolor=\"$bgcolor\"><td><font size = -1 face = arial,helvetica>$domainstub</font></td>\n";
# Add each tld to a domain stub (e.g. myname -> myname.com, myname.net, etc)
for ($i = 0; $i <= $#tld; $i++)
{
$work_domain = $domainstub . "\.$tld[$i]";
$entry = SetPrelimStatusUserid($work_domain);
$entry =~ /^(\w)(.+)\w(\w)$/;
my $status = $1;
if ($status eq "A")
{
$row .= " <td width=\"1%\" align=\"center\"><img src=\"/Templates/img/1x1.gif\" width=35 height=1 alt=\"\" border=\"0\"><br><input type = \"checkbox\" name = \"$work_domain\"></td>\n";
}
else
{
$row .= " <td width=\"1%\" align=\"center\"><img src=\"/Templates/img/1x1.gif\" width=35 height=1 alt=\"\" border=\"0\"><br><font size = -2 face = arial,helvetica color=black>Taken</font></td>\n";
}
$hidden_name = "domain" . "$#domain_list";
$hidden_domains .= "
<input type = \"hidden\" name = \"$hidden_name\" value = \"$domain_list[$#domain_list]\">";
$num_domains++;
}
print "$row </tr>\n";
@sorted_domain_list = @domain_list;
return;
}
sub OutputResultsMessage
{
$sorted_page_list[$tld_requested] =~ /^(\w)(.+)\w(\w)$/;
my $status = $1;
my $domain = $2;
if ($tld_not_found) # Unsupported or garbage tld entered
{
if ($name_rest =~ /\.biz/ or $name_rest =~ /\.info/)
{
$lookandfeel{msg1_futuretld_text} =~ s/offer/offer $name_rest/;
print <<EOF;
<tr>
<td colspan = 3><div align="$lookandfeel{msg1_align}">
<font size = $lookandfeel{msg1_futuretld_size} face = arial,helvetica color = $lookandfeel{msg1_futuretld_color}>
<b>$lookandfeel{msg1_futuretld_text}</b></font></div>
<div align="$lookandfeel{msg2_align}">
<font size = $lookandfeel{msg2_futuretld_size} face = arial,helvetica color = $lookandfeel{msg2_futuretld_color}>
$lookandfeel{msg2_futuretld_text}</font></div>
</td>
</tr>
EOF
}
else
{
$lookandfeel{msg1_badtld_text} =~ s/specified/specified ($name_rest_save)/;
print <<EOF;
<tr>
<td colspan = 3><div align="$lookandfeel{msg1_align}">
<font size = $lookandfeel{msg1_badtld_size} face = arial,helvetica color = $lookandfeel{msg1_badtld_color}>
<b>$lookandfeel{msg1_badtld_text}</b></font></div>
<div align="$lookandfeel{msg2_align}">
<font size = $lookandfeel{msg2_badtld_size} face = arial,helvetica color = $lookandfeel{msg2_badtld_color}>
$lookandfeel{msg2_badtld_text}</font></div>
</td>
</tr>
EOF
}
}
elsif (! $avails_here) # None available
{
print <<EOF;
<tr>
<td colspan = 3><div align="$lookandfeel{msg1_align}">
<font size = $lookandfeel{msg1_none_size} face = arial,helvetica color = $lookandfeel{msg1_none_color}>
<b>$lookandfeel{msg1_none_text}</b></font></div>
<div align="$lookandfeel{msg2_align}">
<font size = $lookandfeel{msg2_none_size} face = arial,helvetica color = $lookandfeel{msg2_none_color}>
$lookandfeel{msg2_none_text}</font></div>
</td>
</tr>
EOF
}
elsif ($status eq "A") # Yours is available
{
print <<EOF;
<tr>
<td colspan = 3><div align="$lookandfeel{msg1_align}">
<font size = $lookandfeel{msg1_yes_size} face = arial,helvetica color = $lookandfeel{msg1_yes_color}>
<b>$lookandfeel{msg1_yes_text}</b></font></div>
<div align="$lookandfeel{msg2_align}">
<font size = $lookandfeel{msg2_yes_size} face = arial,helvetica color = $lookandfeel{msg2_yes_color}>
$lookandfeel{msg2_yes_text}</font></div>
</td>
</tr>
EOF
}
else # Yours isn't available, but another *is*
{
$lookandfeel{msg2_other_text} =~ s/domain/$domain/; # Replace string "domain" with variable's value
print <<EOF;
<tr>
<td colspan = 3><div align="$lookandfeel{msg1_align}">
<font size = $lookandfeel{msg1_other_size} face = arial,helvetica color = $lookandfeel{msg1_other_color}>
<b>$lookandfeel{msg1_other_text}</b></font></div>
<div align="$lookandfeel{msg2_align}">
<font size = $lookandfeel{msg2_other_size} face = arial,helvetica color = $lookandfeel{msg2_other_color}>
$lookandfeel{msg2_other_text}</font></div>
</td>
</tr>
EOF
&nb