allow signup to specify agentnum
[freeside.git] / fs_signup / FS-SignupClient / cgi / signup.cgi
1 #!/usr/bin/perl -Tw
2 #
3 # $Id: signup.cgi,v 1.21 2002-04-16 00:02:26 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   ( $ac, $exch, $loc ) = ( $pop->{'ac'}, $pop->{'exch'}, $pop->{'loc'} );
241
242   my $pkg = ( grep { $_->{'pkgpart'} eq $pkgpart } @$packages )[0]->{'pkg'};
243
244   if ( $ieak_template
245        && $user_agent->platform eq 'ia32'
246        && $user_agent->os =~ /^win/
247        && ($user_agent->browser)[0] eq 'IE'
248      )
249   { #send an IEAK config
250     print $cgi->header('application/x-Internet-signup'),
251           $ieak_template->fill_in();
252   } elsif ( $cck_template
253             && $user_agent->platform eq 'ia32'
254             && $user_agent->os =~ /^win/
255             && ($user_agent->browser)[0] eq 'Netscape'
256           )
257   { #send a Netscape config
258     my $cck_data = $cck_template->fill_in();
259     print $cgi->header('application/x-netscape-autoconfigure-dialer-v2'),
260           map {
261             m/(.*)\s+(.*)$/;
262             pack("N", length($1)). $1. pack("N", length($2)). $2;
263           } split(/\n/, $cck_data);
264
265   } else { #send a simple confirmation
266     print $cgi->header( '-expires' => 'now' ),
267           $success_template->fill_in();
268   }
269 }
270
271 sub pop_info {
272   my $popnum = shift;
273   my $pop;
274   foreach $pop ( @{$pops} ) {
275     if ( $pop->{'popnum'} == $popnum ) { return $pop; }
276   }
277   '';
278 }
279
280 #horrible false laziness with FS/FS/svc_acct_pop.pm::popselector
281 sub popselector {
282   my( $popnum, $state ) = @_;
283
284   return '<INPUT TYPE="hidden" NAME="popnum" VALUE="">' unless @$pops;
285   return $pops->[0]{city}. ', '. $pops->[0]{state}.
286          ' ('. $pops->[0]{ac}. ')/'. $pops->[0]{exch}.
287          '<INPUT TYPE="hidden" NAME="popnum" VALUE="'. $pops->[0]{popnum}. '">'
288     if scalar(@$pops) == 1;
289
290   my %pop = ();
291   push @{ $pop{$_->{state}} }, $_ foreach @$pops;
292
293   my $text = <<END;
294     <SCRIPT>
295     function opt(what,href,text) {
296       var optionName = new Option(text, href, false, false)
297       var length = what.length;
298       what.options[length] = optionName;
299     }
300     
301     function popstate_changed(what) {
302       state = what.options[what.selectedIndex].text;
303       for (var i = what.form.popnum.length;i > 0;i--)
304                 what.form.popnum.options[i] = null;
305       what.form.popnum.options[0] = new Option("", "", false, true);
306 END
307
308   foreach my $popstate ( sort { $a cmp $b } keys %pop ) {
309     $text .= "\nif ( state == \"$popstate\" ) {\n";
310
311     foreach my $pop ( @{$pop{$popstate}}) {
312       my $o_popnum = $pop->{popnum};
313       my $poptext =  $pop->{city}. ', '. $pop->{state}.
314                      ' ('. $pop->{ac}. ')/'. $pop->{exch};
315
316       $text .= "opt(what.form.popnum, \"$o_popnum\", \"$poptext\");\n"
317     }
318     $text .= "}\n";
319   }
320
321   $text .= "}\n</SCRIPT>\n";
322
323   $text .=
324     qq!<SELECT NAME="popstate" SIZE=1 onChange="popstate_changed(this)">!.
325     qq!<OPTION> !;
326   $text .= "<OPTION>$_" foreach sort { $a cmp $b } keys %pop;
327   $text .= '</SELECT>'; #callback? return 3 html pieces?  #'</TD><TD>';
328
329   $text .= qq!<SELECT NAME="popnum" SIZE=1><OPTION> !;
330   foreach my $pop ( @$pops ) {
331     $text .= qq!<OPTION VALUE="!. $pop->{popnum}. '"'.
332              ( ( $popnum && $pop->{popnum} == $popnum ) ? ' SELECTED' : '' ). ">".
333              $pop->{city}. ', '. $pop->{state}.
334                ' ('. $pop->{ac}. ')/'. $pop->{exch};
335   }
336   $text .= '</SELECT>';
337
338   $text;
339 }
340
341 sub expselect {
342   my $prefix = shift;
343   my $date = shift || '';
344   my( $m, $y ) = ( 0, 0 );
345   if ( $date  =~ /^(\d{4})-(\d{2})-\d{2}$/ ) { #PostgreSQL date format
346     ( $m, $y ) = ( $2, $1 );
347   } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
348     ( $m, $y ) = ( $1, $3 );
349   }
350   my $return = qq!<SELECT NAME="$prefix!. qq!_month" SIZE="1">!;
351   for ( 1 .. 12 ) {
352     $return .= "<OPTION";
353     $return .= " SELECTED" if $_ == $m;
354     $return .= ">$_";
355   }
356   $return .= qq!</SELECT>/<SELECT NAME="$prefix!. qq!_year" SIZE="1">!;
357   for ( 2001 .. 2037 ) {
358     $return .= "<OPTION";
359     $return .= " SELECTED" if $_ == $y;
360     $return .= ">$_";
361   }
362   $return .= "</SELECT>";
363
364   $return;
365 }
366
367 sub success_default { #html to use if you don't specify a success file
368   <<'END';
369 <HTML><HEAD><TITLE>Signup successful</TITLE></HEAD>
370 <BODY BGCOLOR="#e8e8e8"><FONT SIZE=7>Signup successful</FONT><BR><BR>
371 Thanks for signing up!
372 <BR><BR>
373 Signup information for <%= $email_name %>:
374 <BR><BR>
375 Username: <%= $username %><BR>
376 Password: <%= $password %><BR>
377 Access number: (<%= $ac %>) / $exch - $local<BR>
378 Package: <%= $pkg %><BR>
379 </BODY></HTML>
380 END
381 }
382
383 sub signup_default { #html to use if you don't specify a template file
384   <<'END';
385 <HTML><HEAD><TITLE>ISP Signup form</TITLE></HEAD>
386 <BODY BGCOLOR="#e8e8e8"><FONT SIZE=7>ISP Signup form</FONT><BR><BR>
387 <FONT SIZE="+1" COLOR="#ff0000"><%= $error %></FONT>
388 <FORM ACTION="<%= $self_url %>" METHOD=POST>
389 <INPUT TYPE="hidden" NAME="magic" VALUE="process">
390 <INPUT TYPE="hidden" NAME="ref" VALUE="<%= $referral_custnum %>">
391 <INPUT TYPE="hidden" NAME="ss" VALUE="">
392 Contact Information
393 <TABLE BGCOLOR="#c0c0c0" BORDER=0 CELLSPACING=0 WIDTH="100%">
394 <TR>
395   <TH ALIGN="right"><font color="#ff0000">*</font>Contact name<BR>(last, first)</TH>
396   <TD COLSPAN=5><INPUT TYPE="text" NAME="last" VALUE="<%= $last %>">,
397                 <INPUT TYPE="text" NAME="first" VALUE="<%= $first %>"></TD>
398 </TR>
399 <TR>
400   <TD ALIGN="right">Company</TD>
401   <TD COLSPAN=5><INPUT TYPE="text" NAME="company" SIZE=70 VALUE="<%= $company %>"></TD>
402 </TR>
403 <TR>
404   <TH ALIGN="right"><font color="#ff0000">*</font>Address</TH>
405   <TD COLSPAN=5><INPUT TYPE="text" NAME="address1" SIZE=70 VALUE="<%= $address1 %>"></TD>
406 </TR>
407 <TR>
408   <TD ALIGN="right">&nbsp;</TD>
409   <TD COLSPAN=5><INPUT TYPE="text" NAME="address2" SIZE=70 VALUE="<%= $address2 %>"></TD>
410 </TR>
411 <TR>
412   <TH ALIGN="right"><font color="#ff0000">*</font>City</TH>
413   <TD><INPUT TYPE="text" NAME="city" VALUE="<%= $city %>"></TD>
414   <TH ALIGN="right"><font color="#ff0000">*</font>State/Country</TH>
415   <TD><SELECT NAME="state" SIZE="1">
416
417   <%=
418     foreach ( @{$locales} ) {
419       $OUT .= '<OPTION';
420       $OUT .= ' SELECTED' if ( $state eq $_->{'state'}
421                                && $county eq $_->{'county'}
422                                && $country eq $_->{'country'}
423                              );
424       $OUT .= '>'. $_->{'state'};
425       $OUT .= ' ('. $_->{'county'}. ')' if $_->{'county'};
426       $OUT .= ' / '. $_->{'country'};
427     }
428   %>
429
430   </SELECT></TD>
431   <TH><font color="#ff0000">*</font>Zip</TH>
432   <TD><INPUT TYPE="text" NAME="zip" SIZE=10 VALUE="<%= $zip %>"></TD>
433 </TR>
434 <TR>
435   <TD ALIGN="right">Day Phone</TD>
436   <TD COLSPAN=5><INPUT TYPE="text" NAME="daytime" VALUE="<%= $daytime %>" SIZE=18></TD>
437 </TR>
438 <TR>
439   <TD ALIGN="right">Night Phone</TD>
440   <TD COLSPAN=5><INPUT TYPE="text" NAME="night" VALUE="<%= $night %>" SIZE=18></TD>
441 </TR>
442 <TR>
443   <TD ALIGN="right">Fax</TD>
444   <TD COLSPAN=5><INPUT TYPE="text" NAME="fax" VALUE="<%= $fax %>" SIZE=12></TD>
445 </TR>
446 </TABLE><font color="#ff0000">*</font> required fields<BR>
447 <BR>Billing information<TABLE BGCOLOR="#c0c0c0" BORDER=0 CELLSPACING=0 WIDTH="100%">
448 <TR><TD>
449
450   <%=
451     $OUT .= '<INPUT TYPE="checkbox" NAME="invoicing_list_POST" VALUE="POST"';
452     my @invoicing_list = split(', ', $invoicing_list );
453     $OUT .= ' CHECKED'
454       if ! @invoicing_list || grep { $_ eq 'POST' } @invoicing_list;
455     $OUT .= '>';
456   %>
457
458   Postal mail invoice
459 </TD></TR>
460 <TR><TD>Email invoice <INPUT TYPE="text" NAME="invoicing_list" VALUE="<%= join(', ', grep { $_ ne 'POST' } split(', ', $invoicing_list ) ) %>">
461 </TD></TR>
462 <%= scalar(@payby) > 1 ? '<TR><TD>Billing type</TD></TR>' : '' %>
463 </TABLE>
464 <TABLE BGCOLOR="#c0c0c0" BORDER=1 WIDTH="100%">
465 <TR>
466
467   <%=
468
469     my $cardselect = '<SELECT NAME="CARD_type"><OPTION></OPTION>';
470     my %types = (
471                   'VISA' => 'VISA card',
472                   'MasterCard' => 'MasterCard',
473                   'Discover' => 'Discover card',
474                   'American Express' => 'American Express card',
475                 );
476     foreach ( keys %types ) {
477       $selected = $cgi->param('CARD_type') eq $types{$_} ? 'SELECTED' : '';
478       $cardselect .= qq!<OPTION $selected VALUE="$types{$_}">$_</OPTION>!;
479     }
480     $cardselect .= '</SELECT>';
481   
482     my %payby = (
483       '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="">!,
484       '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">!,
485       '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"),
486       'PREPAY' => qq!Prepaid card<BR><font color="#ff0000">*</font><INPUT TYPE="text" NAME="PREPAY_payinfo" VALUE="" MAXLENGTH=80>!,
487     );
488
489     my %paybychecked = (
490       '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">!,
491       '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">!,
492       '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),
493       'PREPAY' => qq!Prepaid card<BR><font color="#ff0000">*</font><INPUT TYPE="text" NAME="PREPAY_payinfo" VALUE="$payinfo" MAXLENGTH=80>!,
494     );
495
496     for (@payby) {
497       if ( scalar(@payby) == 1) {
498         $OUT .= '<TD VALIGN=TOP>'.
499                 qq!<INPUT TYPE="hidden" NAME="payby" VALUE="$_">!.
500                 "$paybychecked{$_}</TD>";
501       } else {
502         $OUT .= qq!<TD VALIGN=TOP><INPUT TYPE="radio" NAME="payby" VALUE="$_"!;
503         if ($payby eq $_) {
504           $OUT .= qq! CHECKED> $paybychecked{$_}</TD>!;
505         } else {
506           $OUT .= qq!> $payby{$_}</TD>!;
507         }
508
509       }
510     }
511   %>
512
513 </TR></TABLE><font color="#ff0000">*</font> required fields for each billing type
514 <BR><BR>First package
515 <TABLE BGCOLOR="#c0c0c0" BORDER=0 CELLSPACING=0 WIDTH="100%">
516 <TR>
517   <TD COLSPAN=2><SELECT NAME="pkgpart"><OPTION VALUE="">(none)
518
519   <%=
520     foreach my $package ( @{$packages} ) {
521       $OUT .= '<OPTION VALUE="'. $package->{'pkgpart'}. '"';
522       $OUT .= ' SELECTED' if $pkgpart && $package->{'pkgpart'} == $pkgpart;
523       $OUT .= '>'. $package->{'pkg'};
524     }
525   %>
526
527   </SELECT></TD>
528 </TR>
529 <TR>
530   <TD ALIGN="right">Username</TD>
531   <TD><INPUT TYPE="text" NAME="username" VALUE="<%= $username %>"></TD>
532 </TR>
533 <TR>
534   <TD ALIGN="right">Password</TD>
535   <TD><INPUT TYPE="password" NAME="_password" VALUE="<%= $password %>"></TD>
536 </TR>
537 <TR>
538   <TD ALIGN="right">Re-enter Password</TD>
539   <TD><INPUT TYPE="password" NAME="_password2" VALUE="<%= $password2 %>"></TD>
540 </TR>
541 <%=
542   if ( $init_data->{'security_phrase'} ) {
543     $OUT .= <<ENDOUT;
544 <TR>
545   <TD ALIGN="right">Security Phrase</TD>
546   <TD><INPUT TYPE="text" NAME="sec_phrase" VALUE="$sec_phrase">
547   </TD>
548 </TR>
549 ENDOUT
550   } else {
551     $OUT .= '<INPUT TYPE="hidden" NAME="sec_phrase" VALUE="">';
552   }
553 %>
554 <%=
555   if ( scalar(@$pops) ) {
556     $OUT .= '<TR><TD ALIGN="right">Access number</TD><TD>'.
557             popselector($popnum). '</TD></TR>';
558   } else {
559     $OUT .= popselector($popnum);
560   }
561 %>
562 </TABLE>
563 <BR><BR><INPUT TYPE="submit" VALUE="Signup">
564 </FORM></BODY></HTML>
565 END
566 }