don't populate the whole initial list if there are tons of POPs
[freeside.git] / fs_signup / FS-SignupClient / cgi / signup.cgi
1 #!/usr/bin/perl -Tw
2 #
3 # $Id: signup.cgi,v 1.39 2003-07-04 01:37:46 ivan Exp $
4
5 use strict;
6 use vars qw( @payby $cgi $locales $packages
7              $pops %pop %popnum2pop
8              $init_data $error
9              $last $first $ss $company $address1 $address2 $city $state $county
10              $country $zip $daytime $night $fax $invoicing_list $payby $payinfo
11              $paydate $payname $referral_custnum
12              $pkgpart $username $password $password2 $sec_phrase $popnum
13              $agentnum
14              $ieak_file $ieak_template $cck_file $cck_template
15              $signup_html $signup_template
16              $success_html $success_template
17              $decline_html $decline_template
18              $ac $exch $loc
19              $email_name $pkg
20              $self_url
21            );
22 use subs qw( print_form print_okay print_decline
23              success_default decline_default
24              expselect );
25 use CGI;
26 #use CGI::Carp qw(fatalsToBrowser);
27 use Text::Template;
28 use Business::CreditCard;
29 use HTTP::Headers::UserAgent 2.00;
30 use FS::SignupClient 0.03 qw( signup_info new_customer );
31
32 #acceptable payment methods
33 #
34 #@payby = qw( CARD BILL COMP );
35 #@payby = qw( CARD BILL );
36 #@payby = qw( CARD );
37 @payby = qw( CARD PREPAY );
38
39 $ieak_file = '/usr/local/freeside/ieak.template';
40 $cck_file = '/usr/local/freeside/cck.template';
41 $signup_html = -e 'signup.html'
42                  ? 'signup.html'
43                  : '/usr/local/freeside/signup.html';
44 $success_html = -e 'success.html'
45                   ? 'success.html'
46                   : '/usr/local/freeside/success.html';
47 $decline_html = -e 'decline.html'
48                   ? 'decline.html'
49                   : '/usr/local/freeside/decline.html';
50
51
52 if ( -e $ieak_file ) {
53   my $ieak_txt = Text::Template::_load_text($ieak_file)
54     or die $Text::Template::ERROR;
55   $ieak_txt =~ /^(.*)$/s; #untaint the template source - it's trusted
56   $ieak_txt = $1;
57   $ieak_txt =~ s/\r//g; # don't double \r on old templates
58   $ieak_txt =~ s/\n/\r\n/g;
59   $ieak_template = new Text::Template ( TYPE => 'STRING', SOURCE => $ieak_txt )
60     or die $Text::Template::ERROR;
61 } else {
62   $ieak_template = '';
63 }
64
65 if ( -e $cck_file ) {
66   my $cck_txt = Text::Template::_load_text($cck_file)
67     or die $Text::Template::ERROR;
68   $cck_txt =~ /^(.*)$/s; #untaint the template source - it's trusted
69   $cck_txt = $1;
70   $cck_template = new Text::Template ( TYPE => 'STRING', SOURCE => $cck_txt )
71     or die $Text::Template::ERROR;
72 } else {
73   $cck_template = '';
74 }
75
76 $agentnum = '';
77 if ( -e $signup_html ) {
78   my $signup_txt = Text::Template::_load_text($signup_html)
79     or die $Text::Template::ERROR;
80   $signup_txt =~ /^(.*)$/s; #untaint the template source - it's trusted
81   $signup_txt = $1;
82   $signup_template = new Text::Template ( TYPE => 'STRING',
83                                           SOURCE => $signup_txt,
84                                           DELIMITERS => [ '<%=', '%>' ]
85                                         )
86     or die $Text::Template::ERROR;
87   if ( $signup_txt =~
88          /<\s*INPUT TYPE="?hidden"?\s+NAME="?agentnum"?\s+VALUE="?(\d+)"?\s*>/si
89   ) {
90     $agentnum = $1;
91   }
92 } else {
93   #too much maintenance hassle to keep in this file
94   die "can't find ./signup.html or /usr/local/freeside/signup.html";
95   #$signup_template = new Text::Template ( TYPE => 'STRING',
96   #                                        SOURCE => &signup_default,
97   #                                        DELIMITERS => [ '<%=', '%>' ]
98   #                                      )
99   #  or die $Text::Template::ERROR;
100 }
101
102 if ( -e $success_html ) {
103   my $success_txt = Text::Template::_load_text($success_html)
104     or die $Text::Template::ERROR;
105   $success_txt =~ /^(.*)$/s; #untaint the template source - it's trusted
106   $success_txt = $1;
107   $success_template = new Text::Template ( TYPE => 'STRING',
108                                            SOURCE => $success_txt,
109                                            DELIMITERS => [ '<%=', '%>' ],
110                                          )
111     or die $Text::Template::ERROR;
112 } else {
113   $success_template = new Text::Template ( TYPE => 'STRING',
114                                            SOURCE => &success_default,
115                                            DELIMITERS => [ '<%=', '%>' ],
116                                          )
117     or die $Text::Template::ERROR;
118 }
119
120 if ( -e $decline_html ) {
121   my $decline_txt = Text::Template::_load_text($decline_html)
122     or die $Text::Template::ERROR;
123   $decline_txt =~ /^(.*)$/s; #untaint the template source - it's trusted
124   $decline_txt = $1;
125   $decline_template = new Text::Template ( TYPE => 'STRING',
126                                            SOURCE => $decline_txt,
127                                            DELIMITERS => [ '<%=', '%>' ],
128                                          )
129     or die $Text::Template::ERROR;
130 } else {
131   $decline_template = new Text::Template ( TYPE => 'STRING',
132                                            SOURCE => &decline_default,
133                                            DELIMITERS => [ '<%=', '%>' ],
134                                          )
135     or die $Text::Template::ERROR;
136 }
137
138
139 ( $locales, $packages, $pops, $init_data ) = signup_info();
140 @payby = @{$init_data->{'payby'}} if @{$init_data->{'payby'}};
141 $packages = $init_data->{agentnum2part_pkg}{$agentnum} if $agentnum;
142 %pop = ();
143 %popnum2pop = ();
144 foreach (@$pops) {
145   push @{ $pop{ $_->{state} }->{ $_->{ac} } }, $_;
146   $popnum2pop{$_->{popnum}} = $_;
147 }
148
149 $cgi = new CGI;
150
151 if ( defined $cgi->param('magic') ) {
152   if ( $cgi->param('magic') eq 'process' ) {
153
154     if ( $cgi->param('state') =~ /^(\w*)( \(([\w ]+)\))? ?\/ ?(\w+)$/ ) {
155       $state = $1;
156       $county = $3 || '';
157       $country = $4;
158     } elsif ( $cgi->param('state') =~ /^(\w*)$/ ) {
159       $state = $1;
160       $cgi->param('county') =~ /^([\w ]*)$/
161         or die "illegal county: ". $cgi->param('county');
162       $county = $1;
163       $cgi->param('country') =~ /^(\w+)$/
164         or die "illegal country: ". $cgi->param('country');
165       $country = $1;
166     } else {
167       die "illegal state: ". $cgi->param('state');
168     }
169
170     $payby = $cgi->param('payby');
171     if ( $payby eq 'CHEK' || $payby eq 'DCHK' ) {
172       #$payinfo = join('@', map { $cgi->param( $payby. "_payinfo$_" ) } (1,2) );
173       $payinfo = $cgi->param($payby. '_payinfo1'). '@'. 
174                  $cgi->param($payby. '_payinfo2');
175     } else {
176       $payinfo = $cgi->param( $payby. '_payinfo' );
177     }
178     $paydate =
179       $cgi->param( $payby. '_month' ). '-'. $cgi->param( $payby. '_year' );
180     $payname = $cgi->param( $payby. '_payname' );
181
182     if ( $invoicing_list = $cgi->param('invoicing_list') ) {
183       $invoicing_list .= ', POST' if $cgi->param('invoicing_list_POST');
184     } else {
185       $invoicing_list = 'POST';
186     }
187
188     $error = '';
189
190     $last             = $cgi->param('last');
191     $first            = $cgi->param('first');
192     $ss               = $cgi->param('ss');
193     $company          = $cgi->param('company');
194     $address1         = $cgi->param('address1');
195     $address2         = $cgi->param('address2');
196     $city             = $cgi->param('city');
197     #$county,
198     #$state,
199     $zip              = $cgi->param('zip');
200     #$country,
201     $daytime          = $cgi->param('daytime');
202     $night            = $cgi->param('night');
203     $fax              = $cgi->param('fax');
204     #$payby,
205     #$payinfo,
206     #$paydate,
207     #$payname,
208     #$invoicing_list,
209     $referral_custnum = $cgi->param('ref');
210     $pkgpart          = $cgi->param('pkgpart');
211     $username         = $cgi->param('username');
212     $sec_phrase       = $cgi->param('sec_phrase');
213     $password         = $cgi->param('_password');
214     $popnum           = $cgi->param('popnum');
215     #$agentnum, #         = $cgi->param('agentnum'),
216
217     if ( $cgi->param('_password') ne $cgi->param('_password2') ) {
218       $error = $init_data->{msgcat}{passwords_dont_match}; #msgcat
219       $password  = '';
220       $password2 = '';
221     } else {
222       $password2 = $cgi->param('_password2');
223
224       if ( $payby =~ /^(CARD|DCRD)$/ && $cgi->param('CARD_type') ) {
225         $payinfo =~ s/\D//g;
226
227         $payinfo =~ /^(\d{13,16})$/
228           or $error ||= $init_data->{msgcat}{invalid_card}; #. $self->payinfo;
229         $payinfo = $1;
230         validate($payinfo)
231           or $error ||= $init_data->{msgcat}{invalid_card}; #. $self->payinfo;
232         cardtype($payinfo) eq $cgi->param('CARD_type')
233           or $error ||= $init_data->{msgcat}{not_a}. $cgi->param('CARD_type');
234       }
235
236       $error ||= new_customer ( {
237         'last'             => $last,
238         'first'            => $first,
239         'ss'               => $ss,
240         'company'          => $company,
241         'address1'         => $address1,
242         'address2'         => $address2,
243         'city'             => $city,
244         'county'           => $county,
245         'state'            => $state,
246         'zip'              => $zip,
247         'country'          => $country,
248         'daytime'          => $daytime,
249         'night'            => $night,
250         'fax'              => $fax,
251         'payby'            => $payby,
252         'payinfo'          => $payinfo,
253         'paydate'          => $paydate,
254         'payname'          => $payname,
255         'invoicing_list'   => $invoicing_list,
256         'referral_custnum' => $referral_custnum,
257         'pkgpart'          => $pkgpart,
258         'username'         => $username,
259         'sec_phrase'       => $sec_phrase,
260         '_password'        => $password,
261         'popnum'           => $popnum,
262         'agentnum'         => $agentnum,
263       } );
264
265     }
266     
267     if ( $error eq '_decline' ) {
268       print_decline();
269     } elsif ( $error ) {
270       print_form();
271     } else {
272       print_okay();
273     }
274
275   } else {
276     die "unrecognized magic: ". $cgi->param('magic');
277   }
278 } else {
279   $error = '';
280   $last = '';
281   $first = '';
282   $ss = '';
283   $company = '';
284   $address1 = '';
285   $address2 = '';
286   $city = '';
287   $state = $init_data->{statedefault};
288   $county = '';
289   $country = $init_data->{countrydefault};
290   $zip = '';
291   $daytime = '';
292   $night = '';
293   $fax = '';
294   $invoicing_list = '';
295   $payby = '';
296   $payinfo = '';
297   $paydate = '';
298   $payname = '';
299   $pkgpart = '';
300   $username = '';
301   $password = '';
302   $password2 = '';
303   $sec_phrase = '';
304   $popnum = '';
305   $referral_custnum = $cgi->param('ref') || '';
306   print_form;
307 }
308
309 sub print_form {
310
311   $cgi->delete('ref');
312   $self_url = $cgi->self_url;
313
314   $error = "Error: $error" if $error;
315
316   print $cgi->header( '-expires' => 'now' ),
317         $signup_template->fill_in();
318
319 }
320
321 sub print_decline {
322   print $cgi->header( '-expires' => 'now' ),
323         $decline_template->fill_in();
324 }
325
326 sub print_okay {
327   my $user_agent = new HTTP::Headers::UserAgent $ENV{HTTP_USER_AGENT};
328
329   $cgi->param('username') =~ /^(.+)$/
330     or die "fatal: invalid username got past FS::SignupClient::new_customer";
331   my $username = $1;
332   $cgi->param('_password') =~ /^(.+)$/
333     or die "fatal: invalid password got past FS::SignupClient::new_customer";
334   my $password = $1;
335   ( $cgi->param('first'). ' '. $cgi->param('last') ) =~ /^(.*)$/
336     or die "fatal: invalid email_name got past FS::SignupClient::new_customer";
337   $email_name = $1; #global for template
338
339   my $pop = $popnum2pop{$cgi->param('popnum')};
340     #or die "fatal: invalid popnum got past FS::SignupClient::new_customer";
341   if ( $pop ) {
342     ( $ac, $exch, $loc ) = ( $pop->{'ac'}, $pop->{'exch'}, $pop->{'loc'} );
343   } else {
344     ( $ac, $exch, $loc ) = ( '', '', ''); #presumably you're not using them.
345   }
346
347   #global for template
348   $pkg = ( grep { $_->{'pkgpart'} eq $pkgpart } @$packages )[0]->{'pkg'};
349
350   if ( $ieak_template
351        && $user_agent->platform eq 'ia32'
352        && $user_agent->os =~ /^win/
353        && ($user_agent->browser)[0] eq 'IE'
354      )
355   { #send an IEAK config
356     print $cgi->header('application/x-Internet-signup'),
357           $ieak_template->fill_in();
358   } elsif ( $cck_template
359             && $user_agent->platform eq 'ia32'
360             && $user_agent->os =~ /^win/
361             && ($user_agent->browser)[0] eq 'Netscape'
362           )
363   { #send a Netscape config
364     my $cck_data = $cck_template->fill_in();
365     print $cgi->header('application/x-netscape-autoconfigure-dialer-v2'),
366           map {
367             m/(.*)\s+(.*)$/;
368             pack("N", length($1)). $1. pack("N", length($2)). $2;
369           } split(/\n/, $cck_data);
370
371   } else { #send a simple confirmation
372     print $cgi->header( '-expires' => 'now' ),
373           $success_template->fill_in();
374   }
375 }
376
377 #horrible false laziness with FS/FS/svc_acct_pop.pm::popselector
378 sub popselector {
379
380   my( $popnum ) = @_;
381
382   return '<INPUT TYPE="hidden" NAME="popnum" VALUE="">' unless @$pops;
383   return $pops->[0]{city}. ', '. $pops->[0]{state}.
384          ' ('. $pops->[0]{ac}. ')/'. $pops->[0]{exch}. '-'. $pops->[0]{loc}.
385          '<INPUT TYPE="hidden" NAME="popnum" VALUE="'. $pops->[0]{popnum}. '">'
386     if scalar(@$pops) == 1;
387
388   #my %pop = ();
389   #my %popnum2pop = ();
390   #foreach (@$pops) {
391   #  push @{ $pop{ $_->{state} }->{ $_->{ac} } }, $_;
392   #  $popnum2pop{$_->{popnum}} = $_;
393   #}
394
395   my $text = <<END;
396     <SCRIPT>
397     function opt(what,href,text) {
398       var optionName = new Option(text, href, false, false)
399       var length = what.length;
400       what.options[length] = optionName;
401     }
402
403     function acstate_changed(what) {
404       state = what.options[what.selectedIndex].text;
405       what.form.popac.options.length = 0
406       what.form.popac.options[0] = new Option("Area code", "-1", false, true);
407 END
408
409   foreach my $state ( sort { $a cmp $b } keys %pop ) {
410     $text .= "\nif ( state == \"$state\" ) {\n";
411
412     foreach my $ac ( sort { $a cmp $b } keys %{ $pop{$state} }) {
413       $text .= "opt(what.form.popac, \"$ac\", \"$ac\");\n";
414       if ($ac eq $cgi->param('popac')) {
415         $text .= "what.form.popac.options[what.form.popac.length-1].selected = true;\n";
416       }
417     }
418     $text .= "}\n";
419   }
420   $text .= "popac_changed(what.form.popac)}\n";
421
422   $text .= <<END;
423   function popac_changed(what) {
424     ac = what.options[what.selectedIndex].text;
425     what.form.popnum.options.length = 0;
426     what.form.popnum.options[0] = new Option("City", "-1", false, true);
427
428 END
429
430   foreach my $state ( keys %pop ) {
431     foreach my $popac ( keys %{ $pop{$state} } ) {
432       $text .= "\nif ( ac == \"$popac\" ) {\n";
433
434       foreach my $pop ( @{$pop{$state}->{$popac}}) {
435         my $o_popnum = $pop->{popnum};
436         my $poptext =  $pop->{city}. ', '. $pop->{state}.
437                        ' ('. $pop->{ac}. ')/'. $pop->{exch}. '-'. $pop->{loc};
438
439         $text .= "opt(what.form.popnum, \"$o_popnum\", \"$poptext\");\n";
440         if ($popnum == $o_popnum) {
441           $text .= "what.form.popnum.options[what.form.popnum.length-1].selected = true;\n";
442         }
443       }
444       $text .= "}\n";
445     }
446   }
447
448
449   $text .= "}\n</SCRIPT>\n";
450
451   $text .=
452     qq!<TABLE CELLPADDING="0"><TR><TD><SELECT NAME="acstate"! .
453     qq!SIZE=1 onChange="acstate_changed(this)"><OPTION VALUE=-1>State!;
454   $text .= "<OPTION" . ($_ eq $cgi->param('acstate') ? " SELECTED" : "") .
455            ">$_" foreach sort { $a cmp $b } keys %pop;
456   $text .= '</SELECT>'; #callback? return 3 html pieces?  #'</TD>';
457
458   $text .=
459     qq!<SELECT NAME="popac" SIZE=1 onChange="popac_changed(this)">!.
460     qq!<OPTION>Area code</SELECT></TR><TR VALIGN="top">!;
461
462   $text .= qq!<TR><TD><SELECT NAME="popnum" SIZE=1 STYLE="width: 20em"><OPTION>City!;
463
464
465   #comment this block to disable initial list polulation
466   if ( scalar( @$pops ) > 100 ) {
467     @initial_select = ( $popnum2pop{$popnum} );
468   } else {
469     @initial_select = $@pops;
470   }
471   foreach my $pop ( sort { $a->{state} cmp $b->{state} } @initial_select ) {
472     $text .= qq!<OPTION VALUE="!. $pop->{popnum}. '"'.
473              ( ( $popnum && $pop->{popnum} == $popnum ) ? ' SELECTED' : '' ). ">".
474              $pop->{city}. ', '. $pop->{state}.
475                ' ('. $pop->{ac}. ')/'. $pop->{exch}. '-'. $pop->{loc};
476   }
477
478   $text .= qq!</SELECT></TD></TR></TABLE>!;
479
480   $text;
481
482 }
483
484 sub expselect {
485   my $prefix = shift;
486   my $date = shift || '';
487   my( $m, $y ) = ( 0, 0 );
488   if ( $date  =~ /^(\d{4})-(\d{2})-\d{2}$/ ) { #PostgreSQL date format
489     ( $m, $y ) = ( $2, $1 );
490   } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
491     ( $m, $y ) = ( $1, $3 );
492   }
493   my $return = qq!<SELECT NAME="$prefix!. qq!_month" SIZE="1">!;
494   for ( 1 .. 12 ) {
495     $return .= "<OPTION";
496     $return .= " SELECTED" if $_ == $m;
497     $return .= ">$_";
498   }
499   $return .= qq!</SELECT>/<SELECT NAME="$prefix!. qq!_year" SIZE="1">!;
500   for ( 2001 .. 2037 ) {
501     $return .= "<OPTION";
502     $return .= " SELECTED" if $_ == $y;
503     $return .= ">$_";
504   }
505   $return .= "</SELECT>";
506
507   $return;
508 }
509
510 #false laziness w/FS::cust_main_county
511 sub regionselector {
512   my ( $selected_county, $selected_state, $selected_country,
513        $prefix, $onchange ) = @_;
514
515   my $prefix = '' unless defined $prefix;
516
517   my $countyflag = 0;
518
519   my %cust_main_county;
520
521 #  unless ( @cust_main_county ) { #cache 
522     #@cust_main_county = qsearch('cust_main_county', {} );
523     #foreach my $c ( @cust_main_county ) {
524     foreach my $c ( @$locales ) {
525       #$countyflag=1 if $c->county;
526       $countyflag=1 if $c->{county};
527       #push @{$cust_main_county{$c->country}{$c->state}}, $c->county;
528       #$cust_main_county{$c->country}{$c->state}{$c->county} = 1;
529       $cust_main_county{$c->{country}}{$c->{state}}{$c->{county}} = 1;
530     }
531 #  }
532   $countyflag=1 if $selected_county;
533
534   my $script_html = <<END;
535     <SCRIPT>
536     function opt(what,value,text) {
537       var optionName = new Option(text, value, false, false);
538       var length = what.length;
539       what.options[length] = optionName;
540     }
541     function ${prefix}country_changed(what) {
542       country = what.options[what.selectedIndex].text;
543       for ( var i = what.form.${prefix}state.length; i >= 0; i-- )
544           what.form.${prefix}state.options[i] = null;
545 END
546       #what.form.${prefix}state.options[0] = new Option('', '', false, true);
547
548   foreach my $country ( sort keys %cust_main_county ) {
549     $script_html .= "\nif ( country == \"$country\" ) {\n";
550     foreach my $state ( sort keys %{$cust_main_county{$country}} ) {
551       my $text = $state || '(n/a)';
552       $script_html .= qq!opt(what.form.${prefix}state, "$state", "$text");\n!;
553     }
554     $script_html .= "}\n";
555   }
556
557   $script_html .= <<END;
558     }
559     function ${prefix}state_changed(what) {
560 END
561
562   if ( $countyflag ) {
563     $script_html .= <<END;
564       state = what.options[what.selectedIndex].text;
565       country = what.form.${prefix}country.options[what.form.${prefix}country.selectedIndex].text;
566       for ( var i = what.form.${prefix}county.length; i >= 0; i-- )
567           what.form.${prefix}county.options[i] = null;
568 END
569
570     foreach my $country ( sort keys %cust_main_county ) {
571       $script_html .= "\nif ( country == \"$country\" ) {\n";
572       foreach my $state ( sort keys %{$cust_main_county{$country}} ) {
573         $script_html .= "\nif ( state == \"$state\" ) {\n";
574           #foreach my $county ( sort @{$cust_main_county{$country}{$state}} ) {
575           foreach my $county ( sort keys %{$cust_main_county{$country}{$state}} ) {
576             my $text = $county || '(n/a)';
577             $script_html .=
578               qq!opt(what.form.${prefix}county, "$county", "$text");\n!;
579           }
580         $script_html .= "}\n";
581       }
582       $script_html .= "}\n";
583     }
584   }
585
586   $script_html .= <<END;
587     }
588     </SCRIPT>
589 END
590
591   my $county_html = $script_html;
592   if ( $countyflag ) {
593     $county_html .= qq!<SELECT NAME="${prefix}county" onChange="$onchange">!;
594     $county_html .= '</SELECT>';
595   } else {
596     $county_html .=
597       qq!<INPUT TYPE="hidden" NAME="${prefix}county" VALUE="$selected_county">!;
598   }
599
600   my $state_html = qq!<SELECT NAME="${prefix}state" !.
601                    qq!onChange="${prefix}state_changed(this); $onchange">!;
602   foreach my $state ( sort keys %{ $cust_main_county{$selected_country} } ) {
603     my $text = $state || '(n/a)';
604     my $selected = $state eq $selected_state ? 'SELECTED' : '';
605     $state_html .= "\n<OPTION $selected VALUE=$state>$text</OPTION>"
606   }
607   $state_html .= '</SELECT>';
608
609   $state_html .= '</SELECT>';
610
611   my $country_html = qq!<SELECT NAME="${prefix}country" !.
612                      qq!onChange="${prefix}country_changed(this); $onchange">!;
613   my $countrydefault = $init_data->{countrydefault} || 'US';
614   foreach my $country (
615     sort { ($b eq $countrydefault) <=> ($a eq $countrydefault) or $a cmp $b }
616       keys %cust_main_county
617   ) {
618     my $selected = $country eq $selected_country ? ' SELECTED' : '';
619     $country_html .= "\n<OPTION$selected>$country</OPTION>"
620   }
621   $country_html .= '</SELECT>';
622
623   ($county_html, $state_html, $country_html);
624
625 }
626
627 sub success_default { #html to use if you don't specify a success file
628   <<'END';
629 <HTML><HEAD><TITLE>Signup successful</TITLE></HEAD>
630 <BODY BGCOLOR="#e8e8e8"><FONT SIZE=7>Signup successful</FONT><BR><BR>
631 Thanks for signing up!
632 <BR><BR>
633 Signup information for <%= $email_name %>:
634 <BR><BR>
635 Username: <%= $username %><BR>
636 Password: <%= $password %><BR>
637 Access number: (<%= $ac %>) / $exch - $local<BR>
638 Package: <%= $pkg %><BR>
639 </BODY></HTML>
640 END
641 }
642
643 sub decline_default { #html to use if there is a decline
644   <<'END';
645 <HTML><HEAD><TITLE>Processing error</TITLE></HEAD>
646 <BODY BGCOLOR="#e8e8e8"><FONT SIZE=7>Processing error</FONT><BR><BR>
647 There has been an error processing your account.  Please contact customer
648 support.
649 </BODY></HTML>
650 END
651 }
652