home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1999 May
/
PCWorld_1999-05_cd.bin
/
Komunik
/
MSIE5
/
ieak5.exe
/
RCDATA
/
CABINET
/
reconfg2.pl
< prev
next >
Wrap
Perl Script
|
1999-02-24
|
4KB
|
136 lines
#!/usr/bin/perl
# Written by Edward C Kubaitis
# The host URL of the Signup Files
$hostURL="http://myserver";
# Parse the CGI input
$BACKURL=&parse_input;
# Check if email name is in use
&check_email;
# Start HTML output
&startHTML;
# Display the HTML head
&headHTML;
# Display the HTML body
if ($email_inuse eq "yes"){$ERROR=1;&errorHTML;}
elsif ($pid_notnew eq "yes"){$ERROR=2;&errorHTML;}
else { &bodyHTML;}
# End HTML output
&endHTML;
# Exit the CGI
&quit;
##########################################################
sub startHTML {
print "Content-type: text/html\n\n";print "<HTML>\n";
}
##########################################################
sub endHTML {
print "</html>\n";
}
##########################################################
sub quit {
exit(0);
}
##########################################################
sub parse_input {
@pairs = split(/&/, $ENV{'QUERY_STRING'});
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$ABACKURL=$ABACKURL+"$name=$value\&";
# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
if ($allow_html != 1) {
$value =~ s/<([^>]|\n)*>//g;
}
if ($value eq ""){$value=" ";}
$FORM{$name} = $value;
}
chop($ABACKURL);return $ABACKURL;
}
##########################################################
sub bodyHTML {
print "<BODY bgColor=THREEDFACE color=WINDOWTEXT>\n";
print "<FONT style=\"font: 8pt ' ms sans serif' black\">\n";
print "<FORM NAME=\"PAGEID\" ACTION=\"PAGE2\" STYLE=\"background:transparent\"></FORM>\n";
print "<FORM NAME=\"BACK\" ACTION=\"$hostURL/reconfg1.pl?$BACKURL\" STYLE=\"background:transparent\"></FORM>\n";
print "<FORM NAME=\"PAGETYPE\" ACTION=\"\" STYLE=\"background:transparent\"></FORM>\n";
print "<FORM NAME=\"NEXT\" ACTION=$hostURL/reconfg3.pl STYLE=\"background:transparent\">\n";
print "<B>Re-Establishing Your Internet Services Internet Account</B><BR>\n";
print "Please select the telephone number you wish to use.<BR>\n";
print "<SELECT NAME=\"POPSELECTION\">\n";
print "<OPTION VALUE=\"1\" >800 555 5555 Nation Wide 56K X2\n";
print "<OPTION VALUE=\"2\" >206 555 5555 Seattle 56K X2\n";
print "<OPTION VALUE=\"3\" >425 555 5555 Redmond 56K X2\n";
print "<OPTION VALUE=\"4\" >800 555 5555 Nation Wide ISDN\n";
print "<OPTION VALUE=\"5\" >206 555 5555 Seattle ISDN\n";
print "<OPTION VALUE=\"6\" >425 555 5555 Redmond ISDN\n";
print "</SELECT>\n";
print "<INPUT TYPE=\"HIDDEN\" NAME=\"EMAILNAME\" VALUE=\"FORM{'EMAILNAME'}\">\n";
print "<INPUT TYPE=\"HIDDEN\" NAME=\"EMAILPASSWORD\" VALUE=\"FORM{'EMAILPASSWORD'}\">\n";
print "<INPUT TYPE=\"HIDDEN\" NAME=\"POPSELECTION\" VALUE=\"FORM{'POPSELECTION'}\">\n";
print "</FORM>\n";
print "</BODY>\n";
}
##########################################################
sub headHTML {
print "<HEAD>\n";
print "<TITLE>IEAK Sample Reconfiguration Signup Page 2</TITLE>\n";
print "</HEAD>\n";
}
##########################################################
sub check_email {
# Check a database or finger to see if the email name is already
# being used. If so set a flag
# Here is a sample of how to do the check on a unix machine.
# Larger ISPs might want to check with a database
# $check = 'finger $FORM{'EMAILNAME'}';
# if ($check =~ "no such user."){ $email_inuse="no";}
# else { $email_inuse="yes";}
# no means it is not in use
$email_inuse="no";
# yes means it is in use
}
##########################################################
sub errorHTML {
print "<BODY>\n";
print "<FORM NAME=\"PAGEID\" ACTION=\"ERROR1\" STYLE=\"background:transparent\"></FORM>\n";
print "<FORM NAME=\"BACK\" ACTION=\"$hostURL/reconfg1.pl\" STYLE=\"background:transparent\"></FORM>\n";
print "<FORM NAME=\"PAGETYPE\" ACTION=\"\" STYLE=\"background:transparent\"></FORM>\n";
print "<FORM NAME=\"NEXT\" ACTION=\"$hostURL/reconfg1.pl\" STYLE=\"background:transparent\">\n";
if ($ERROR == 1){
print "This E-Mail Name is already in use. Please choose another Name.<P>\n";
}
print "</BODY>\n";
}
##########################################################