From 294b8c0914f497b7714bad51dfb000d33e843995 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 30 Aug 2001 16:23:32 +0000 Subject: [PATCH] update signup server: template form and success html, document --- fs_signup/FS-SignupClient/cgi/signup.cgi | 382 ++++++++++++++++------------- fs_signup/FS-SignupClient/cgi/signup.html | 149 +++++++++++ fs_signup/FS-SignupClient/cgi/success.html | 4 + httemplate/docs/signup.html | 2 + 4 files changed, 367 insertions(+), 170 deletions(-) create mode 100755 fs_signup/FS-SignupClient/cgi/signup.html create mode 100644 fs_signup/FS-SignupClient/cgi/success.html diff --git a/fs_signup/FS-SignupClient/cgi/signup.cgi b/fs_signup/FS-SignupClient/cgi/signup.cgi index 5d024a812..0da960579 100755 --- a/fs_signup/FS-SignupClient/cgi/signup.cgi +++ b/fs_signup/FS-SignupClient/cgi/signup.cgi @@ -1,18 +1,19 @@ #!/usr/bin/perl -Tw # -# $Id: signup.cgi,v 1.10 2001-08-28 16:58:08 ivan Exp $ +# $Id: signup.cgi,v 1.11 2001-08-30 16:23:32 ivan Exp $ use strict; -use vars qw( @payby $cgi $locales $packages $pops $r $error +use vars qw( @payby $cgi $locales $packages $pops $error $last $first $ss $company $address1 $address2 $city $state $county $country $zip $daytime $night $fax $invoicing_list $payby $payinfo $paydate $payname $referral_custnum $pkgpart $username $password $popnum $ieak_file $ieak_template $cck_file $cck_template + $signup_html $signup_template $success_html $success_template $ac $exch $loc + $self_url ); -use subs qw( print_form print_okay expselect ); - +use subs qw( print_form print_okay expselect signup_default success_default ); use CGI; use CGI::Carp qw(fatalsToBrowser); use HTTP::Headers::UserAgent 2.00; @@ -28,6 +29,8 @@ use Text::Template; $ieak_file = '/usr/local/freeside/ieak.template'; $cck_file = '/usr/local/freeside/cck.template'; +$signup_html = '/usr/local/freeside/signup.html'; +$success_html = '/usr/local/freeside/success.html'; if ( -e $ieak_file ) { my $ieak_txt = Text::Template::_load_text($ieak_file) @@ -39,6 +42,7 @@ if ( -e $ieak_file ) { } else { $ieak_template = ''; } + if ( -e $cck_file ) { my $cck_txt = Text::Template::_load_text($cck_file) or die $Text::Template::ERROR; @@ -50,6 +54,42 @@ if ( -e $cck_file ) { $cck_template = ''; } +if ( -e $signup_html ) { + my $signup_txt = Text::Template::_load_text($signup_html) + or die $Text::Template::ERROR; + $signup_txt =~ /^(.*)$/s; #untaint the template source - it's trusted + $signup_txt = $1; + $signup_template = new Text::Template ( TYPE => 'STRING', + SOURCE => $signup_txt, + DELIMITERS => [ '<%=', '%>' ] + ) + or die $Text::Template::ERROR; +} else { + $signup_template = new Text::Template ( TYPE => 'STRING', + SOURCE => &signup_default, + DELIMITERS => [ '<%=', '%>' ] + ) + or die $Text::Template::ERROR; +} + +if ( -e $success_html ) { + my $success_txt = Text::Template::_load_text($signup_html) + or die $Text::Template::ERROR; + $success_txt =~ /^(.*)$/s; #untaint the template source - it's trusted + $success_txt = $1; + $success_template = new Text::Template ( TYPE => 'STRING', + SOURCE => $success_txt, + DELIMITERS => [ '<%=', '%>' ], + ) + or die $Text::Template::ERROR; +} else { + $success_template = new Text::Template ( TYPE => 'STRING', + SOURCE => &success_default, + DELIMITERS => [ '<%=', '%>' ], + ) + or die $Text::Template::ERROR; +} + ( $locales, $packages, $pops ) = signup_info(); $cgi = new CGI; @@ -137,168 +177,13 @@ if ( defined $cgi->param('magic') ) { sub print_form { - my $r = qq!*!; $cgi->delete('ref'); - my $self_url = $cgi->self_url; - - print $cgi->header( '-expires' => 'now' ), <ISP Signup form -ISP Signup form

-END - - print qq!Error: $error! if $error; - - print < - - -Contact Information - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
${r}Contact name
(last, first)
, - SS#
Company
${r}Address
 
${r}City${r}State/Country${r}Zip
Day Phone
Night Phone
Fax
$r required fields
-
Billing information -!; - - print <
-END - - print qq!Postal mail invoice
Email invoice ', - qq!
Billing type
- - -END - - my %payby = ( - 'CARD' => qq!Credit card
${r}
${r}Exp !. expselect("CARD"). qq!
${r}Name on card
!, - 'BILL' => qq!Billing
P.O.
${r}Exp !. expselect("BILL", "12-2037"). qq!
${r}Attention
!, - 'COMP' => qq!Complimentary
${r}Approved by
${r}Exp !. expselect("COMP"), - 'PREPAY' => qq!Prepaid card
${r}!, - ); - - my %paybychecked = ( - 'CARD' => qq!Credit card
${r}
${r}Exp !. expselect("CARD", $paydate). qq!
${r}Name on card
!, - 'BILL' => qq!Billing
P.O.
${r}Exp !. expselect("BILL", $paydate). qq!
${r}Attention
!, - 'COMP' => qq!Complimentary
${r}Approved by
${r}Exp !. expselect("COMP", $paydate), - 'PREPAY' => qq!Prepaid card
${r}!, - ); - - for (@payby) { - print qq!!; - } else { - print qq!> $payby{$_}!; - } - } + $self_url = $cgi->self_url; - print <
$paybychecked{$_}
$r required fields for each billing type -

First package - - - - - - - - - - - - - - - - -
Username
Password - (blank to generate)
POP
-

- -END + print $cgi->header( '-expires' => 'now' ), + $signup_template->fill_in(); } @@ -341,13 +226,8 @@ sub print_okay { } split(/\n/, $cck_data); } else { #send a simple confirmation - print $cgi->header( '-expires' => 'now' ), <Signup successful -Signup successful

-blah blah blah - - -END + print $cgi->header( '-expires' => 'now' ), + $success_template->fill_in(); } } @@ -386,3 +266,165 @@ sub expselect { $return; } +sub success_default { #html to use if you don't specify a success file + <<'END'; +Signup successful +Signup successful

+Thanks for signing up! + +END +} + +sub signup_default { #html to use if you don't specify a template file + <<'END'; +ISP Signup form +ISP Signup form

+<%= $error %> +
+ + + +Contact Information + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
*Contact name
(last, first)
, +
Company
*Address
 
*City*State/Country*Zip
Day Phone
Night Phone
Fax
* required fields
+
Billing information + + +
+ + <%= + $OUT .= ' + + Postal mail invoice +
Email invoice +
Billing type
+ + + + <%= + my %payby = ( + 'CARD' => qq!Credit card
*
*Exp !. expselect("CARD"). qq!
*Name on card
!, + 'BILL' => qq!Billing
P.O.
*Exp !. expselect("BILL", "12-2037"). qq!
*Attention
!, + 'COMP' => qq!Complimentary
*Approved by
*Exp !. expselect("COMP"), + 'PREPAY' => qq!Prepaid card
*!, + ); + + my %paybychecked = ( + 'CARD' => qq!Credit card
*
*Exp !. expselect("CARD", $paydate). qq!
*Name on card
!, + 'BILL' => qq!Billing
P.O.
*Exp !. expselect("BILL", $paydate). qq!
*Attention
!, + 'COMP' => qq!Complimentary
*Approved by
*Exp !. expselect("COMP", $paydate), + 'PREPAY' => qq!Prepaid card
*!, + ); + + for (@payby) { + $OUT .= qq!!; + } else { + $OUT .= qq!> $payby{$_}!; + } + } + %> + +
$paybychecked{$_}
* required fields for each billing type +

First package + + + + + + + + + + + + + + + + +
Username
Password + (blank to generate)
POP
+

+
+END +} diff --git a/fs_signup/FS-SignupClient/cgi/signup.html b/fs_signup/FS-SignupClient/cgi/signup.html new file mode 100755 index 000000000..bc02db230 --- /dev/null +++ b/fs_signup/FS-SignupClient/cgi/signup.html @@ -0,0 +1,149 @@ +ISP Signup form +ISP Signup form

+<%= $error %> +
+ + + +Contact Information + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
*Contact name
(last, first)
, +
Company
*Address
 
*City*State/Country*Zip
Day Phone
Night Phone
Fax
* required fields
+
Billing information + + +
+ + <%= + $OUT .= ' + + Postal mail invoice +
Email invoice +
Billing type
+ + + + <%= + my %payby = ( + 'CARD' => qq!Credit card
*
*Exp !. expselect("CARD"). qq!
*Name on card
!, + 'BILL' => qq!Billing
P.O.
*Exp !. expselect("BILL", "12-2037"). qq!
*Attention
!, + 'COMP' => qq!Complimentary
*Approved by
*Exp !. expselect("COMP"), + 'PREPAY' => qq!Prepaid card
*!, + ); + + my %paybychecked = ( + 'CARD' => qq!Credit card
*
*Exp !. expselect("CARD", $paydate). qq!
*Name on card
!, + 'BILL' => qq!Billing
P.O.
*Exp !. expselect("BILL", $paydate). qq!
*Attention
!, + 'COMP' => qq!Complimentary
*Approved by
*Exp !. expselect("COMP", $paydate), + 'PREPAY' => qq!Prepaid card
*!, + ); + + for (@payby) { + $OUT .= qq!!; + } else { + $OUT .= qq!> $payby{$_}!; + } + } + %> + +
$paybychecked{$_}
* required fields for each billing type +

First package + + + + + + + + + + + + + + + + +
Username
Password + (blank to generate)
POP
+

+
diff --git a/fs_signup/FS-SignupClient/cgi/success.html b/fs_signup/FS-SignupClient/cgi/success.html new file mode 100644 index 000000000..6bc2d1fd7 --- /dev/null +++ b/fs_signup/FS-SignupClient/cgi/success.html @@ -0,0 +1,4 @@ +Signup successful +Signup successful

+Thanks for signing up! + diff --git a/httemplate/docs/signup.html b/httemplate/docs/signup.html index ae5f63f15..f99b7ebb5 100644 --- a/httemplate/docs/signup.html +++ b/httemplate/docs/signup.html @@ -53,6 +53,8 @@ Optional:
  • $email_name - first and last name (an example file is included as fs_signup/cck.template). See the Netscape documentation for more information. +
  • If you create a /usr/local/freeside/signup.html file on the external machine, it will be used as a template for the form HTML. This requires the template to be constructed appropriately; probably best to start with the example file included as fs_signup/FS-SignupClient/cgi/signup.html. +
  • If you create a /usr/local/freeside/success.html file on the external machine, it will be used as the success HTML page. Although template substiutions are available, a regular HTML file will work fine here, unlike signup.html. An example file is included as fs_signup/FS-SignupClient/cgi/success.html
  • If there are any entries in the prepay_credit table, a user can enter a string matching the identifier column to receive the credit specified in the amount column, and/or the time specified in the seconds column (for use with the session monitor), after which that identifier is no longer valid. This can be used to implement pre-paid "calling card" type signups. The bin/generate-prepay script can be used to populate the prepay_credit table. -- 2.11.0