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