home *** CD-ROM | disk | FTP | other *** search
/ Excalibur 71 / Excalibur_71_cd2.bin / Microsoft_Internet_50 / ieak5.exe / RCDATA / CABINET / reconfg2.pl < prev    next >
Perl Script  |  1999-02-24  |  4KB  |  136 lines

  1. #!/usr/bin/perl
  2. # Written by Edward C Kubaitis
  3.  
  4.  
  5. # The host URL of the Signup Files
  6. $hostURL="http://myserver";
  7.  
  8. # Parse the CGI input
  9. $BACKURL=&parse_input;
  10.  
  11. # Check if email name is in use
  12. &check_email;
  13.  
  14. # Start HTML output
  15. &startHTML;
  16.  
  17. # Display the HTML head
  18. &headHTML;
  19.  
  20. # Display the HTML body
  21.  
  22. if ($email_inuse eq "yes"){$ERROR=1;&errorHTML;}
  23. elsif ($pid_notnew eq "yes"){$ERROR=2;&errorHTML;}
  24. else { &bodyHTML;}
  25.  
  26. # End HTML output
  27. &endHTML;
  28.  
  29. # Exit the CGI
  30. &quit;
  31.  
  32. ##########################################################
  33. sub startHTML {
  34.     print "Content-type: text/html\n\n";print "<HTML>\n";
  35. }
  36. ##########################################################
  37. sub endHTML {
  38.     print "</html>\n";
  39. }
  40. ##########################################################
  41. sub quit {
  42.     exit(0);
  43. }
  44. ##########################################################
  45. sub parse_input {
  46.     @pairs = split(/&/, $ENV{'QUERY_STRING'});
  47.  
  48.     foreach $pair (@pairs) {
  49.        ($name, $value) = split(/=/, $pair);
  50.     $ABACKURL=$ABACKURL+"$name=$value\&";
  51.        # Un-Webify plus signs and %-encoding
  52.        $value =~ tr/+/ /;
  53.           $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  54.           $value =~ s/<!--(.|\n)*-->//g;
  55.           if ($allow_html != 1) {
  56.           $value =~ s/<([^>]|\n)*>//g;
  57.           }
  58.          if ($value eq ""){$value=" ";}
  59.        $FORM{$name} = $value;
  60.  
  61.     }
  62. chop($ABACKURL);return $ABACKURL;
  63. }
  64. ##########################################################
  65. sub bodyHTML {
  66.  
  67. print "<BODY bgColor=THREEDFACE color=WINDOWTEXT>\n";
  68. print "<FONT style=\"font: 8pt ' ms sans serif' black\">\n";
  69.  
  70. print "<FORM NAME=\"PAGEID\" ACTION=\"PAGE2\" STYLE=\"background:transparent\"></FORM>\n";
  71. print "<FORM NAME=\"BACK\" ACTION=\"$hostURL/reconfg1.pl?$BACKURL\" STYLE=\"background:transparent\"></FORM>\n";
  72. print "<FORM NAME=\"PAGETYPE\" ACTION=\"\" STYLE=\"background:transparent\"></FORM>\n";
  73. print "<FORM NAME=\"NEXT\" ACTION=$hostURL/reconfg3.pl STYLE=\"background:transparent\">\n";
  74. print "<B>Re-Establishing Your Internet Services Internet Account</B><BR>\n";
  75. print "Please select the telephone number you wish to use.<BR>\n";
  76. print "<SELECT NAME=\"POPSELECTION\">\n";
  77. print "<OPTION VALUE=\"1\" >800 555 5555 Nation Wide 56K X2\n";
  78. print "<OPTION VALUE=\"2\" >206 555 5555 Seattle 56K X2\n";
  79. print "<OPTION VALUE=\"3\" >425 555 5555 Redmond 56K X2\n";
  80. print "<OPTION VALUE=\"4\" >800 555 5555 Nation Wide ISDN\n";
  81. print "<OPTION VALUE=\"5\" >206 555 5555 Seattle ISDN\n";
  82. print "<OPTION VALUE=\"6\" >425 555 5555 Redmond ISDN\n";
  83. print "</SELECT>\n";
  84. print "<INPUT TYPE=\"HIDDEN\" NAME=\"EMAILNAME\" VALUE=\"FORM{'EMAILNAME'}\">\n";
  85. print "<INPUT TYPE=\"HIDDEN\" NAME=\"EMAILPASSWORD\" VALUE=\"FORM{'EMAILPASSWORD'}\">\n";
  86. print "<INPUT TYPE=\"HIDDEN\" NAME=\"POPSELECTION\" VALUE=\"FORM{'POPSELECTION'}\">\n";
  87. print "</FORM>\n";
  88. print "</BODY>\n";
  89.  
  90.  
  91. }
  92. ##########################################################
  93. sub headHTML {
  94.  
  95. print "<HEAD>\n";
  96. print "<TITLE>IEAK Sample Reconfiguration Signup Page 2</TITLE>\n";
  97. print "</HEAD>\n";
  98.  
  99. }
  100. ##########################################################
  101. sub check_email {
  102.  
  103. # Check a database or finger to see if the email name is already
  104. # being used. If so set a flag
  105.  
  106. # Here is a sample of how to do the check on a unix machine.
  107. # Larger ISPs might want to check with a database
  108.  
  109. # $check = 'finger $FORM{'EMAILNAME'}';
  110. # if ($check =~ "no such user."){ $email_inuse="no";}
  111. # else { $email_inuse="yes";}
  112.  
  113. # no means it is not in use
  114. $email_inuse="no";
  115.  
  116. # yes means it is in use
  117.  
  118. }
  119. ##########################################################
  120. sub errorHTML {
  121.  
  122. print "<BODY>\n";
  123. print "<FORM NAME=\"PAGEID\" ACTION=\"ERROR1\" STYLE=\"background:transparent\"></FORM>\n";
  124. print "<FORM NAME=\"BACK\" ACTION=\"$hostURL/reconfg1.pl\" STYLE=\"background:transparent\"></FORM>\n";
  125. print "<FORM NAME=\"PAGETYPE\" ACTION=\"\" STYLE=\"background:transparent\"></FORM>\n";
  126. print "<FORM NAME=\"NEXT\" ACTION=\"$hostURL/reconfg1.pl\" STYLE=\"background:transparent\">\n";
  127.  
  128. if ($ERROR == 1){
  129. print "This E-Mail Name is already in use. Please choose another Name.<P>\n";
  130. }
  131.  
  132. print "</BODY>\n";
  133.  
  134. }
  135. ##########################################################
  136.