1819e7c86145cba3980bfaaf97054d8390d326fc
[freeside.git] / fs_signup / FS-SignupClient / cgi / signup.cgi
1 #!/usr/bin/perl -Tw
2 #
3 # $Id: signup.cgi,v 1.22 2002-04-17 11:43:37 ivan Exp $
4
5 use strict;
6 use vars qw( @payby $cgi $locales $packages $pops $init_data $error
7              $last $first $ss $company $address1 $address2 $city $state $county
8              $country $zip $daytime $night $fax $invoicing_list $payby $payinfo
9              $paydate $payname $referral_custnum
10              $pkgpart $username $password $password2 $sec_phrase $popnum
11              $agentnum
12              $ieak_file $ieak_template $cck_file $cck_template
13              $signup_html $signup_template $success_html $success_template
14              $ac $exch $loc
15              $self_url
16            );
17 use subs qw( print_form print_okay expselect signup_default success_default );
18 use CGI;
19 #use CGI::Carp qw(fatalsToBrowser);
20 use Text::Template;
21 use Business::CreditCard;
22 use HTTP::Headers::UserAgent 2.00;
23 use FS::SignupClient 0.03 qw( signup_info new_customer );
24
25 #acceptable payment methods
26 #
27 #@payby = qw( CARD BILL COMP );
28 #@payby = qw( CARD BILL );
29 #@payby = qw( CARD );
30 @payby = qw( CARD PREPAY );
31
32 $ieak_file = '/usr/local/freeside/ieak.template';
33 $cck_file = '/usr/local/freeside/cck.template';
34 $signup_html = '/usr/local/freeside/signup.html';
35 $success_html = '/usr/local/freeside/success.html';
36
37 if ( -e $ieak_file ) {
38   my $ieak_txt = Text::Template::_load_text($ieak_file)
39     or die $Text::Template::ERROR;
40   $ieak_txt =~ /^(.*)$/s; #untaint the template source - it's trusted
41   $ieak_txt = $1;
42   $ieak_template = new Text::Template ( TYPE => 'STRING', SOURCE => $ieak_txt )
43     or die $Text::Template::ERROR;
44 } else {
45   $ieak_template = '';
46 }
47
48 if ( -e $cck_file ) {
49   my $cck_txt = Text::Template::_load_text($cck_file)
50     or die $Text::Template::ERROR;
51   $cck_txt =~ /^(.*)$/s; #untaint the template source - it's trusted
52   $cck_txt = $1;
53   $cck_template = new Text::Template ( TYPE => 'STRING', SOURCE => $cck_txt )
54     or die $Text::Template::ERROR;
55 } else {
56   $cck_template = '';
57 }
58
59 if ( -e $signup_html ) {
60   my $signup_txt = Text::Template::_load_text($signup_html)
61     or die $Text::Template::ERROR;
62   $signup_txt =~ /^(.*)$/s; #untaint the template source - it's trusted
63   $signup_txt = $1;
64   $signup_template = new Text::Template ( TYPE => 'STRING',
65                                           SOURCE => $signup_txt,
66                                           DELIMITERS => [ '<%=', '%>' ]
67                                         )
68     or die $Text::Template::ERROR;
69 } else {
70   $signup_template = new Text::Template ( TYPE => 'STRING',
71                                           SOURCE => &signup_default,
72                                           DELIMITERS => [ '<%=', '%>' ]
73                                         )
74     or die $Text::Template::ERROR;
75 }
76
77 if ( -e $success_html ) {
78   my $success_txt = Text::Template::_load_text($success_html)
79     or die $Text::Template::ERROR;
80   $success_txt =~ /^(.*)$/s; #untaint the template source - it's trusted
81   $success_txt = $1;
82   $success_template = new Text::Template ( TYPE => 'STRING',
83                                            SOURCE => $success_txt,
84                                            DELIMITERS => [ '<%=', '%>' ],
85                                          )
86     or die $Text::Template::ERROR;
87 } else {
88   $success_template = new Text::Template ( TYPE => 'STRING',
89                                            SOURCE => &success_default,
90                                            DELIMITERS => [ '<%=', '%>' ],
91                                          )
92     or die $Text::Template::ERROR;
93 }
94
95 ( $locales, $packages, $pops, $init_data ) = signup_info();
96 @payby = @{$init_data->{'payby'}} if @{$init_data->{'payby'}};
97
98 $cgi = new CGI;
99
100 if ( defined $cgi->param('magic') ) {
101   if ( $cgi->param('magic') eq 'process' ) {
102
103     $cgi->param('state') =~ /^(\w*)( \(([\w ]+)\))? ?\/ ?(\w+)$/
104       or die "Oops, illegal \"state\" param: ". $cgi->param('state');
105     $state = $1;
106     $county = $3 || '';
107     $country = $4;
108
109     $payby = $cgi->param('payby');
110     $payinfo = $cgi->param( $payby. '_payinfo' );
111     $paydate =
112       $cgi->param( $payby. '_month' ). '-'. $cgi->param( $payby. '_year' );
113     $payname = $cgi->param( $payby. '_payname' );
114
115     if ( $invoicing_list = $cgi->param('invoicing_list') ) {
116       $invoicing_list .= ', POST' if $cgi->param('invoicing_list_POST');
117     } else {
118       $invoicing_list = 'POST';
119     }
120
121     $error = '';
122
123     if ( $cgi->param('_password') ne $cgi->param('_password2') ) {
124       $error = $init_data->{msgcat}{passwords_dont_match}; #msgcat
125       $password  = '';
126       $password2 = '';
127     } else {
128       $password2 = $cgi->param('_password2');
129
130       if ( $payby eq 'CARD' && $cgi->param('CARD_type') ) {
131         $payinfo =~ s/\D//g;
132
133         $payinfo =~ /^(\d{13,16})$/
134           or $error ||= $init_data->{msgcat}{invalid_card}; #. $self->payinfo;
135         $payinfo = $1;
136         validate($payinfo)
137           or $error ||= $init_data->{msgcat}{invalid_card}; #. $self->payinfo;
138         cardtype($payinfo) eq $cgi->param('CARD_type')
139           or $error ||= $init_data->{msgcat}{not_a}. $cgi->param('CARD_type');
140       }
141
142       $error ||= new_customer ( {
143         'last'             => $last             = $cgi->param('last'),
144         'first'            => $first            = $cgi->param('first'),
145         'ss'               => $ss               = $cgi->param('ss'),
146         'company'          => $company          = $cgi->param('company'),
147         'address1'         => $address1         = $cgi->param('address1'),
148         'address2'         => $address2         = $cgi->param('address2'),
149         'city'             => $city             = $cgi->param('city'),
150         'county'           => $county,
151         'state'            => $state,
152         'zip'              => $zip              = $cgi->param('zip'),
153         'country'          => $country,
154         'daytime'          => $daytime          = $cgi->param('daytime'),
155         'night'            => $night            = $cgi->param('night'),
156         'fax'              => $fax              = $cgi->param('fax'),
157         'payby'            => $payby,
158         'payinfo'          => $payinfo,
159         'paydate'          => $paydate,
160         'payname'          => $payname,
161         'invoicing_list'   => $invoicing_list,
162         'referral_custnum' => $referral_custnum = $cgi->param('ref'),
163         'pkgpart'          => $pkgpart          = $cgi->param('pkgpart'),
164         'username'         => $username         = $cgi->param('username'),
165         'sec_phrase'       => $sec_phrase       = $cgi->param('sec_phrase'),
166         '_password'        => $password         = $cgi->param('_password'),
167         'popnum'           => $popnum           = $cgi->param('popnum'),
168         'agentnum'         => $agentnum         = $cgi->param('agentnum'),
169       } );
170
171     }
172     
173     if ( $error ) {
174       print_form();
175     } else {
176       print_okay();
177     }
178
179   } else {
180     die "unrecognized magic: ". $cgi->param('magic');
181   }
182 } else {
183   $error = '';
184   $last = '';
185   $first = '';
186   $ss = '';
187   $company = '';
188   $address1 = '';
189   $address2 = '';
190   $city = '';
191   $state = '';
192   $county = '';
193   $country = '';
194   $zip = '';
195   $daytime = '';
196   $night = '';
197   $fax = '';
198   $invoicing_list = '';
199   $payby = '';
200   $payinfo = '';
201   $paydate = '';
202   $payname = '';
203   $pkgpart = '';
204   $username = '';
205   $password = '';
206   $password2 = '';
207   $sec_phrase = '';
208   $popnum = '';
209   $referral_custnum = $cgi->param('ref') || '';
210   print_form;
211 }
212
213 sub print_form {
214
215   $cgi->delete('ref');
216   $self_url = $cgi->self_url;
217
218   $error = "Error: $error" if $error;
219
220   print $cgi->header( '-expires' => 'now' ),
221         $signup_template->fill_in();
222
223 }
224
225 sub print_okay {
226   my $user_agent = new HTTP::Headers::UserAgent $ENV{HTTP_USER_AGENT};
227
228   $cgi->param('username') =~ /^(.+)$/
229     or die "fatal: invalid username got past FS::SignupClient::new_customer";
230   my $username = $1;
231   $cgi->param('_password') =~ /^(.+)$/
232     or die "fatal: invalid password got past FS::SignupClient::new_customer";
233   my $password = $1;
234   ( $cgi->param('first'). ' '. $cgi->param('last') ) =~ /^(.*)$/
235     or die "fatal: invalid email_name got past FS::SignupClient::new_customer";
236   my $email_name = $1;
237
238   my $pop = pop_info($cgi->param('popnum'));
239     #or die "fatal: invalid popnum got past FS::SignupClient::new_customer";
240   if ( $pop ) {
241     ( $ac, $exch, $loc ) = ( $pop->{'ac'}, $pop->{'exch'}, $pop->{'loc'} );
242   } else {
243     ( $ac, $exch, $loc ) = ( '', '', ''); #presumably you're not using them.
244   }
245
246   my $pkg = ( grep { $_->{'pkgpart'} eq $pkgpart } @$packages )[0]->{'pkg'};
247
248   if ( $ieak_template
249        && $user_agent->platform eq 'ia32'
250        && $user_agent->os =~ /^win/
251        && ($user_agent->browser)[0] eq 'IE'
252      )
253   { #send an IEAK config
254     print $cgi->header('application/x-Internet-signup'),
255           $ieak_template->fill_in();
256   } elsif ( $cck_template
257             && $user_agent->platform eq 'ia32'
258             && $user_agent->os =~ /^win/
259             && ($user_agent->browser)[0] eq 'Netscape'
260           )
261   { #send a Netscape config
262     my $cck_data = $cck_template->fill_in();
263     print $cgi->header('application/x-netscape-autoconfigure-dialer-v2'),
264           map {
265             m/(.*)\s+(.*)$/;
266             pack("N", length($1)). $1. pack("N", length($2)). $2;
267           } split(/\n/, $cck_data);
268
269   } else { #send a simple confirmation
270     print $cgi->header( '-expires' => 'now' ),
271           $success_template->fill_in();
272   }
273 }
274
275 sub pop_info {
276   my $popnum = shift;
277   my $pop;
278   foreach $pop ( @{$pops} ) {
279     if ( $pop->{'popnum'} == $popnum ) { return $pop; }
280   }
281   '';
282 }
283
284 #horrible false laziness with FS/FS/svc_acct_pop.pm::popselector
285 sub popselector {
286   my( $popnum, $state ) = @_;
287
288   return '<INPUT TYPE="hidden" NAME="popnum" VALUE="">' unless @$pops;
289   return $pops->[0]{city}. ', '. $pops->[0]{state}.
290          ' ('. $pops->[0]{ac}. ')/'. $pops->[0]{exch}.
291          '<INPUT TYPE="hidden" NAME="popnum" VALUE="'. $pops->[0]{popnum}. '">'
292     if scalar(@$pops) == 1;
293
294   my %pop = ();
295   push @{ $pop{$_->{state}} }, $_ foreach @$pops;
296
297   my $text = <<END;
298     <SCRIPT>
299     function opt(what,href,text) {
300       var optionName = new Option(text, href, false, false)
301       var length = what.length;
302       what.options[length] = optionName;
303     }
304     
305     function popstate_changed(what) {
306       state = what.options[what.selectedIndex].text;
307       for (var i = what.form.popnum.length;i > 0;i--)
308                 what.form.popnum.options[i] = null;
309       what.form.popnum.options[0] = new Option("", "", false, true);
310 END
311
312   foreach my $popstate ( sort { $a cmp $b } keys %pop ) {
313     $text .= "\nif ( state == \"$popstate\" ) {\n";
314
315     foreach my $pop ( @{$pop{$popstate}}) {
316       my $o_popnum = $pop->{popnum};
317       my $poptext =  $pop->{city}. ', '. $pop->{state}.
318                      ' ('. $pop->{ac}. ')/'. $pop->{exch};
319
320       $text .= "opt(what.form.popnum, \"$o_popnum\", \"$poptext\");\n"
321     }
322     $text .= "}\n";
323   }
324
325   $text .= "}\n</SCRIPT>\n";
326
327   $text .=
328     qq!<SELECT NAME="popstate" SIZE=1 onChange="popstate_changed(this)">!.
329     qq!<OPTION> !;
330   $text .= "<OPTION>$_" foreach sort { $a cmp $b } keys %pop;
331   $text .= '</SELECT>'; #callback? return 3 html pieces?  #'</TD><TD>';
332
333   $text .= qq!<SELECT NAME="popnum" SIZE=1><OPTION> !;
334   foreach my $pop ( @$pops ) {
335     $text .= qq!<OPTION VALUE="!. $pop->{popnum}. '"'.
336              ( ( $popnum && $pop->{popnum} == $popnum ) ? ' SELECTED' : '' ). ">".
337              $pop->{city}. ', '. $pop->{state}.
338                ' ('. $pop->{ac}. ')/'. $pop->{exch};
339   }
340   $text .= '</SELECT>';
341
342   $text;
343 }
344
345 sub expselect {
346   my $prefix = shift;
347   my $date = shift || '';
348   my( $m, $y ) = ( 0, 0 );
349   if ( $date  =~ /^(\d{4})-(\d{2})-\d{2}$/ ) { #PostgreSQL date format
350     ( $m, $y ) = ( $2, $1 );
351   } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
352     ( $m, $y ) = ( $1, $3 );
353   }
354   my $return = qq!<SELECT NAME="$prefix!. qq!_month" SIZE="1">!;
355   for ( 1 .. 12 ) {
356     $return .= "<OPTION";
357     $return .= " SELECTED" if $_ == $m;
358     $return .= ">$_";
359   }
360   $return .= qq!</SELECT>/<SELECT NAME="$prefix!. qq!_year" SIZE="1">!;
361   for ( 2001 .. 2037 ) {
362     $return .= "<OPTION";
363     $return .= " SELECTED" if $_ == $y;
364     $return .= ">$_";
365   }
366   $return .= "</SELECT>";
367
368   $return;
369 }
370
371 sub success_default { #html to use if you don't specify a success file
372   <<'END';
373 <HTML><HEAD><TITLE>Signup successful</TITLE></HEAD>
374 <BODY BGCOLOR="#e8e8e8"><FONT SIZE=7>Signup successful</FONT><BR><BR>
375 Thanks for signing up!
376 <BR><BR>
377 Signup information for <%= $email_name %>:
378 <BR><BR>
379 Username: <%= $username %><BR>
380 Password: <%= $password %><BR>
381 Access number: (<%= $ac %>) / $exch - $local<BR>
382 Package: <%= $pkg %><BR>
383 </BODY></HTML>
384 END
385 }
386
387 sub signup_default { #html to use if you don't specify a template file
388   <<'END';
389 <HTML><HEAD><TITLE>ISP Signup form</TITLE></HEAD>
390 <BODY BGCOLOR="#e8e8e8"><FONT SIZE=7>ISP Signup form</FONT><BR><BR>
391 <FONT SIZE="+1" COLOR="#ff0000"><%= $error %></FONT>
392 <FORM ACTION="<%= $self_url %>" METHOD=POST>
393 <INPUT TYPE="hidden" NAME="magic" VALUE="process">
394 <INPUT TYPE="hidden" NAME="ref" VALUE="<%= $referral_custnum %>">
395 <INPUT TYPE="hidden" NAME="ss" VALUE="">
396 Contact Information
397 <TABLE BGCOLOR="#c0c0c0" BORDER=0 CELLSPACING=0 WIDTH="100%">
398 <TR>
399   <TH ALIGN="right"><font color="#ff0000">*</font>Contact name<BR>(last, first)</TH>
400   <TD COLSPAN=5><INPUT TYPE="text" NAME="last" VALUE="<%= $last %>">,
401                 <INPUT TYPE="text" NAME="first" VALUE="<%= $first %>"></TD>
402 </TR>
403 <TR>
404   <TD ALIGN="right">Company</TD>
405   <TD COLSPAN=5><INPUT TYPE="text" NAME="company" SIZE=70 VALUE="<%= $company %>"></TD>
406 </TR>
407 <TR>
408   <TH ALIGN="right"><font color="#ff0000">*</font>Address</TH>
409   <TD COLSPAN=5><INPUT TYPE="text" NAME="address1" SIZE=70 VALUE="<%= $address1 %>"></TD>
410 </TR>
411 <TR>
412   <TD ALIGN="right">&nbsp;</TD>
413   <TD COLSPAN=5><INPUT TYPE="text" NAME="address2" SIZE=70 VALUE="<%= $address2 %>"></TD>
414 </TR>
415 <TR>
416   <TH ALIGN="right"><font color="#ff0000">*</font>City</TH>
417   <TD><INPUT TYPE="text" NAME="city" VALUE="<%= $city %>"></TD>
418   <TH ALIGN="right"><font color="#ff0000">*</font>State/Country</TH>
419   <TD><SELECT NAME="state" SIZE="1">
420
421   <%=
422     foreach ( @{$locales} ) {
423       $OUT .= '<OPTION';
424       $OUT .= ' SELECTED' if ( $state eq $_->{'state'}
425                                && $county eq $_->{'county'}
426                                && $country eq $_->{'country'}
427                              );
428       $OUT .= '>'. $_->{'state'};
429       $OUT .= ' ('. $_->{'county'}. ')' if $_->{'county'};
430       $OUT .= ' / '. $_->{'country'};
431     }
432   %>
433
434   </SELECT></TD>
435   <TH><font color="#ff0000">*</font>Zip</TH>
436   <TD><INPUT TYPE="text" NAME="zip" SIZE=10 VALUE="<%= $zip %>"></TD>
437 </TR>
438 <TR>
439   <TD ALIGN="right">Day Phone</TD>
440   <TD COLSPAN=5><INPUT TYPE="text" NAME="daytime" VALUE="<%= $daytime %>" SIZE=18></TD>
441 </TR>
442 <TR>
443   <TD ALIGN="right">Night Phone</TD>
444   <TD COLSPAN=5><INPUT TYPE="text" NAME="night" VALUE="<%= $night %>" SIZE=18></TD>
445 </TR>
446 <TR>
447   <TD ALIGN="right">Fax</TD>
448   <TD COLSPAN=5><INPUT TYPE="text" NAME="fax" VALUE="<%= $fax %>" SIZE=12></TD>
449 </TR>
450 </TABLE><font color="#ff0000">*</font> required fields<BR>
451 <BR>Billing information<TABLE BGCOLOR="#c0c0c0" BORDER=0 CELLSPACING=0 WIDTH="100%">
452 <TR><TD>
453
454   <%=
455     $OUT .= '<INPUT TYPE="checkbox" NAME="invoicing_list_POST" VALUE="POST"';
456     my @invoicing_list = split(', ', $invoicing_list );
457     $OUT .= ' CHECKED'
458       if ! @invoicing_list || grep { $_ eq 'POST' } @invoicing_list;
459     $OUT .= '>';
460   %>
461
462   Postal mail invoice
463 </TD></TR>
464 <TR><TD>Email invoice <INPUT TYPE="text" NAME="invoicing_list" VALUE="<%= join(', ', grep { $_ ne 'POST' } split(', ', $invoicing_list ) ) %>">
465 </TD></TR>
466 <%= scalar(@payby) > 1 ? '<TR><TD>Billing type</TD></TR>' : '' %>
467 </TABLE>
468 <TABLE BGCOLOR="#c0c0c0" BORDER=1 WIDTH="100%">
469 <TR>
470
471   <%=
472
473     my $cardselect = '<SELECT NAME="CARD_type"><OPTION></OPTION>';
474     my %types = (
475                   'VISA' => 'VISA card',
476                   'MasterCard' => 'MasterCard',
477                   'Discover' => 'Discover card',
478                   'American Express' => 'American Express card',
479                 );
480     foreach ( keys %types ) {
481       $selected = $cgi->param('CARD_type') eq $types{$_} ? 'SELECTED' : '';
482       $cardselect .= qq!<OPTION $selected VALUE="$types{$_}">$_</OPTION>!;
483     }
484     $cardselect .= '</SELECT>';
485   
486     my %payby = (
487       'CARD' => qq!Credit card<BR><font color="#ff0000">*</font>$cardselect<INPUT TYPE="text" NAME="CARD_payinfo" VALUE="" MAXLENGTH=19><BR><font color="#ff0000">*</font>Exp !. expselect("CARD"). qq!<BR><font color="#ff0000">*</font>Name on card<BR><INPUT TYPE="text" NAME="CARD_payname" VALUE="">!,
488       'BILL' => qq!Billing<BR>P.O. <INPUT TYPE="text" NAME="BILL_payinfo" VALUE=""><BR><font color="#ff0000">*</font>Exp !. expselect("BILL", "12-2037"). qq!<BR><font color="#ff0000">*</font>Attention<BR><INPUT TYPE="text" NAME="BILL_payname" VALUE="Accounts Payable">!,
489       'COMP' => qq!Complimentary<BR><font color="#ff0000">*</font>Approved by<INPUT TYPE="text" NAME="COMP_payinfo" VALUE=""><BR><font color="#ff0000">*</font>Exp !. expselect("COMP"),
490       'PREPAY' => qq!Prepaid card<BR><font color="#ff0000">*</font><INPUT TYPE="text" NAME="PREPAY_payinfo" VALUE="" MAXLENGTH=80>!,
491     );
492
493     my %paybychecked = (
494       'CARD' => qq!Credit card<BR><font color="#ff0000">*</font>$cardselect<INPUT TYPE="text" NAME="CARD_payinfo" VALUE="$payinfo" MAXLENGTH=19><BR><font color="#ff0000">*</font>Exp !. expselect("CARD", $paydate). qq!<BR><font color="#ff0000">*</font>Name on card<BR><INPUT TYPE="text" NAME="CARD_payname" VALUE="$payname">!,
495       'BILL' => qq!Billing<BR>P.O. <INPUT TYPE="text" NAME="BILL_payinfo" VALUE="$payinfo"><BR><font color="#ff0000">*</font>Exp !. expselect("BILL", $paydate). qq!<BR><font color="#ff0000">*</font>Attention<BR><INPUT TYPE="text" NAME="BILL_payname" VALUE="$payname">!,
496       'COMP' => qq!Complimentary<BR><font color="#ff0000">*</font>Approved by<INPUT TYPE="text" NAME="COMP_payinfo" VALUE="$payinfo"><BR><font color="#ff0000">*</font>Exp !. expselect("COMP", $paydate),
497       'PREPAY' => qq!Prepaid card<BR><font color="#ff0000">*</font><INPUT TYPE="text" NAME="PREPAY_payinfo" VALUE="$payinfo" MAXLENGTH=80>!,
498     );
499
500     for (@payby) {
501       if ( scalar(@payby) == 1) {
502         $OUT .= '<TD VALIGN=TOP>'.
503                 qq!<INPUT TYPE="hidden" NAME="payby" VALUE="$_">!.
504                 "$paybychecked{$_}</TD>";
505       } else {
506         $OUT .= qq!<TD VALIGN=TOP><INPUT TYPE="radio" NAME="payby" VALUE="$_"!;
507         if ($payby eq $_) {
508           $OUT .= qq! CHECKED> $paybychecked{$_}</TD>!;
509         } else {
510           $OUT .= qq!> $payby{$_}</TD>!;
511         }
512
513       }
514     }
515   %>
516
517 </TR></TABLE><font color="#ff0000">*</font> required fields for each billing type
518 <BR><BR>First package
519 <TABLE BGCOLOR="#c0c0c0" BORDER=0 CELLSPACING=0 WIDTH="100%">
520 <TR>
521   <TD COLSPAN=2><SELECT NAME="pkgpart"><OPTION VALUE="">(none)
522
523   <%=
524     foreach my $package ( @{$packages} ) {
525       $OUT .= '<OPTION VALUE="'. $package->{'pkgpart'}. '"';
526       $OUT .= ' SELECTED' if $pkgpart && $package->{'pkgpart'} == $pkgpart;
527       $OUT .= '>'. $package->{'pkg'};
528     }
529   %>
530
531   </SELECT></TD>
532 </TR>
533 <TR>
534   <TD ALIGN="right">Username</TD>
535   <TD><INPUT TYPE="text" NAME="username" VALUE="<%= $username %>"></TD>
536 </TR>
537 <TR>
538   <TD ALIGN="right">Password</TD>
539   <TD><INPUT TYPE="password" NAME="_password" VALUE="<%= $password %>"></TD>
540 </TR>
541 <TR>
542   <TD ALIGN="right">Re-enter Password</TD>
543   <TD><INPUT TYPE="password" NAME="_password2" VALUE="<%= $password2 %>"></TD>
544 </TR>
545 <%=
546   if ( $init_data->{'security_phrase'} ) {
547     $OUT .= <<ENDOUT;
548 <TR>
549   <TD ALIGN="right">Security Phrase</TD>
550   <TD><INPUT TYPE="text" NAME="sec_phrase" VALUE="$sec_phrase">
551   </TD>
552 </TR>
553 ENDOUT
554   } else {
555     $OUT .= '<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">';
556   }
557 %>
558 <%=
559   if ( scalar(@$pops) ) {
560     $OUT .= '<TR><TD ALIGN="right">Access number</TD><TD>'.
561             popselector($popnum). '</TD></TR>';
562   } else {
563     $OUT .= popselector($popnum);
564   }
565 %>
566 </TABLE>
567 <BR><BR><INPUT TYPE="submit" VALUE="Signup">
568 </FORM></BODY></HTML>
569 END
570 }