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