root/releases/0.1.2a/units/invite/invite_join.php

Revision 2, 3.5 kB (checked in by sven, 3 years ago)

importing elgg-0.1.1a

Line 
1 <?php
2
3     // Join
4         
5         $sitename = sitename;
6             
7         if (isset($_REQUEST['invitecode'])) {
8             
9             $code = addslashes($_REQUEST['invitecode']);
10             $details = db_query("select * from invitations where code = '$code'");
11             if (sizeof($details) > 0) {
12                 
13                 $details = $details[0];
14                 
15                 if (isset($_REQUEST['join_name'])) {
16                     $name = stripslashes($_REQUEST['join_name']);
17                 } else {
18                     $name = stripslashes($details->name);
19                 }
20                 
21                 if (isset($_REQUEST['join_username'])) {
22                     $username = stripslashes($_REQUEST['join_username']);
23                 } else {
24                     $username = "";
25                     $namebits = explode(" ", $name);
26                     foreach($namebits as $key => $bit) {
27                         if ($key == 0) {
28                             $username .= strtolower($bit);
29                         } else {
30                             $username .= strtolower(substr($bit,0,1));
31                         }
32                     }
33                     $username = preg_replace("/[^A-Za-z]/","",$username);
34                 }
35                 
36                 $invite_id = (int) ($details->ident);
37                 
38                 $run_result .= <<< END
39                 
40     <p>
41         Thank you for registering for an account with $sitename! Registration is completely free, but before
42         you confirm your details, please take a moment to read the following documents:
43     </p>
44     <ul>
45         <li><a href="/content/terms.php" target="_blank">$sitename terms and conditions</a></li>
46         <li><a href="/content/privacy.php" target="_blank">Privacy policy</a></li>
47     </ul>
48     <p>
49         Submitting the form below indicates acceptance of these terms. Please note that currently you must
50         be at least 13 years of age to join the site.
51     </p>
52
53     <form action="" method="post">
54                 
55 END;
56                 
57                 $run_result .= run("templates:draw", array(
58                                                 'context' => 'databoxvertical',
59                                                 'name' => '<b>Your name</b>',
60                                                 'contents' => run("display:input_field",array("join_name",$name,"text"))
61                     )
62                     );
63                 $run_result .= run("templates:draw", array(
64                                                 'context' => 'databoxvertical',
65                                                 'name' => '<b>Your username</b><br /><i>Must be letters only</i>',
66                                                 'contents' => run("display:input_field",array("join_username",$username,"text"))
67                     )
68                     );
69                 $run_result .= run("templates:draw", array(
70                                                 'context' => 'databoxvertical',
71                                                 'name' => '<b>Enter a password</b>',
72                                                 'contents' => run("display:input_field",array("join_password1","","password"))
73                     )
74                     );
75                 $run_result .= run("templates:draw", array(
76                                                 'context' => 'databoxvertical',
77                                                 'name' => '<b>Your password again for verification purposes</b>',
78                                                 'contents' => run("display:input_field",array("join_password2","","password"))
79                     )
80                     );
81                 $run_result .= <<< END
82             <p align="center">
83                 <input type="checkbox" name="over13" value="yes" /> <b>I am at least thirteen years of age.</b>
84             </p>
85             <p align="center">
86                 <input type="hidden" name="action" value="invite_join" />
87                 <input type="submit" value="Join" />
88             </p>
89         </form>
90                 
91 END;
92
93             } else {
94                 
95                 $run_result .= <<< END
96                 
97     <p>
98         Your invitation code appears to be invalid. Codes only last for seven days; it's possible that
99         yours is older. If you still want to join $sitename, it may be worth getting in touch with the person
100         who invited you.
101     </p>
102                 
103 END;
104                 
105             }
106             
107         } else {
108             
109                 $run_result .= <<< END
110                 
111     <p>
112         For the moment, joining $sitename requires a specially tailored invite code. If you know someone
113         who's a member, it may be worth asking them for one.
114     </p>
115                 
116 END;
117             
118         }
119
120 ?>
Note: See TracBrowser for help on using the browser.