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