25e2c639297ce53d02bf48d243e732b0423f346b
[clearscm.git] / maps / bin / registerform.cgi
1 #!/usr/bin/perl
2 ################################################################################
3 #
4 # File:         $RCSfile: registerform.cgi,v $
5 # Revision:     $Revision: 1.1 $
6 # Description:  Register a MAPS user
7 # Author:       Andrew@DeFaria.com
8 # Created:      Mon Jan 16 20:25:32 PST 2006
9 # Modified:     $Date: 2013/06/12 14:05:47 $
10 # Language:     perl
11 #
12 # (c) Copyright 2000-2006, Andrew@DeFaria.com, all rights reserved.
13 #
14 ################################################################################
15 use strict;
16 use warnings;
17
18 use FindBin;
19 local $0 = $FindBin::Script;
20
21 use CGI qw/:standard *table start_div end_div/;
22
23 use lib "$FindBin::Bin/../lib";
24
25 use MAPS;
26 use MAPSWeb;
27
28 my $userid   = param ('userid');
29 my $Userid   = ucfirst $userid;
30 my $sender   = param ('sender');
31 my $errormsg = param ('errormsg');
32
33 sub MyHeading {
34   print
35     header     (-title  => "MAPS Registration"),
36     start_html (-title  => "MAPS Registration",
37                 -author => "Andrew\@DeFaria.com",
38                 -style  => {-src => "/maps/css/MAPSPlain.css"},
39                 -script => [{ -language => "JavaScript1.2",
40                 -src    => "/maps/JavaScript/MAPSUtils.js"},
41                   { -language => "JavaScript1.2",
42                 -src    => "/maps/JavaScript/CheckRegistration.js"}
43                 ]);
44   print
45     h2 ({-class => "header", -align => "center"},
46       "Mail Authorization and Permission System");
47
48   if ($errormsg) {
49     DisplayError $errormsg;
50     exit;
51   } # if
52 } # MyHeading
53
54 sub Body {
55   print start_div {-class => "content"};
56   print p ("${Userid}'s email is protected by MAPS, a spam elimination
57             system. In order to email $Userid you must register. You need
58             only register once to be added to ${Userid}'s <i>white list</i>,
59             thereafter you should have no problems emailing them. This is not
60             unlike the acceptance procedure for many instant messaging clients.");
61   print p ("Please enter your full name and click on Register to complete the
62             registration.");
63   print start_form {
64     -method   => "post",
65     -action   => "register.cgi",
66     -onSubmit => "return validate (this);"
67   };
68   print start_table {
69     -cellpadding => 2,
70     -cellspacing => 0,
71     -border      => 0,
72     -align       => "center",
73     -width       => "360"
74   };
75   print hidden (-name  => "userid",
76                 -value => "$userid");
77   print Tr [
78     td ({-class => "header"}, "Full name:") .
79     td (textfield {-class => "inputfield",
80                    -size  => 50,
81                    -name  => "fullname"})
82   ];
83   print hidden (-name  => "sender",
84                 -value => "$userid");
85   print end_table;
86   print p {-align  => "center"},
87     submit (-name  => "submit",
88             -value => "Register");
89   print end_form;
90   print p ("Tired of dealing with unsolicited email (AKA SPAM)? Want to know
91             more about MAPS, the Mail Authorization and Permission System for
92             eliminating SPAM? Click",
93             a ({-href   => "/maps/",
94                 -target => "_blank"},
95                 "here"),
96             "to find out more.");
97   print start_table {
98     -cellpadding => 2,
99     -cellspacing => 0,
100     -border      => 1,
101     -align       => "center",
102     -width       => "50%"
103   };
104   print Tr [
105     td ({-class => "note",
106          -align => "center"}, "Note")
107   ];
108   print Tr [
109     td ({-class => "notetext"}, 
110     "This registration process is instantaneous however we reserve the
111      right to remove you from the ${Userid}'s white list should you abuse
112      this privilege.")
113   ];
114   print end_table;
115   print end_div;
116
117   return;
118 } # Body
119
120 if (!$userid) {
121   $errormsg = "Internal error: Userid not specified";
122 } else {
123   if (!UserExists ($userid)) {
124     $errormsg = "Sorry but $userid is no longer a MAPS user";
125   } # if
126 }
127
128 MyHeading;
129 Body;
130 Footing;