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