OSDN Git Service

本家Nucleus CMSの開発を補助するためにコミット
[nucleus-jp/nucleus-next.git] / createaccount.php
1 <?php
2 /*
3  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4  * Copyright (C) 2002-20011 The Nucleus Group
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  * (see nucleus/documentation/index.html#license for more info)
11  */
12
13 /**
14  * Registration form for new users
15  * @license http://nucleuscms.org/license.txt GNU General Public License
16  * @copyright Copyright (C) 2002-20011 The Nucleus Group
17  * @version $Id: createaccount.php 1624 2012-01-09 11:36:20Z sakamocchi $
18  */
19
20         require_once "./config.php";
21         //include $DIR_LIBS."ACTION.php";
22         include_libs('ACTION.php',false,false);
23         
24         if (isset ($_POST['showform']) && $_POST['showform']==1) {
25                 $showform = 1;
26         }
27         else {
28                 $showform = 0;
29         }
30         sendContentType('text/html', 'createaccount');
31 ?>
32 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
33 <html>
34 <head>
35         <title>Create Member Account</title>
36         <style type="text/css">@import url(nucleus/styles/manual.css);</style>
37 </head>
38 <body>
39
40         <h1>Create Account</h1>
41
42 <?php
43         // show form only if Visitors are allowed to create a Member Account
44         if ($CONF['AllowMemberCreate']==1) { 
45                 // if the form is shown the first time no POST data 
46                 // will be added as value for the input fields
47                 if ($showform==0) {
48 ?>
49
50         <form method="post" action="createaccount.php">
51
52         <div>
53         <input type="hidden" name="showform" value="1" />
54         <input type="hidden" name="action" value="createaccount" />
55         
56                 Login Name (required): 
57                 <br />
58                 <input name="name" size="32" maxlength="32" /> <small>(only a-z, 0-9)</small>
59                 <br />
60                 <br />          
61                 Real Name (required): 
62                 <br />
63                 <input name="realname" size="40" />
64                 <br />
65                 <br />          
66                 Email (required):
67                 <br />
68                 <input name="email" size="40" /> <small>(must be valid, because an activation link will be sent over there)</small>
69                 <br />
70                 <br />          
71                 URL: 
72                 <br />
73                 <input name="url" size="60" />
74                 <br />
75                 <?php
76                 // add extra fields from Plugins, like NP_Profile
77                 $manager->notify('RegistrationFormExtraFields', array('type' => 'createaccount.php', 'prelabel' => '', 'postlabel' => '<br />', 'prefield' => '', 'postfield' => '<br /><br />'));
78                 // add a Captcha challenge or something else
79                 global $manager;
80                 $manager->notify('FormExtra', array('type' => 'membermailform-notloggedin'));
81                 ?>
82                 <br />
83                 <br />                                          
84                 <input type="submit" value="Create Account" />
85         </div>
86
87         </form>
88 <?php
89                 } // close if showfrom ...
90                 else {
91                 // after the from is sent it will be validated
92                 // POST data will be added as value to treat the user with care (;-))
93         
94                 $a = new ACTION();
95
96                 // if createAccount fails it returns an error message 
97                 $message = $a->createAccount();
98
99                 echo '<span style="font-weight:bold; color:red;">'.$message.'</span><br /><br />'; 
100 ?>
101         
102                 <form method="post" action="createaccount.php">
103
104         <div>
105         <input type="hidden" name="showform" value="1" />
106         <input type="hidden" name="action" value="createaccount" />
107         
108                 Login Name (required): 
109                 <br />
110                 <input name="name" size="32" maxlength="32" <?php if(isset($_POST['name'])){echo 'value="'.i18n::hsc($_POST['name']).'"';}?>/> <small>(only a-z, 0-9)</small>
111                 <br />
112                 <br />          
113                 Real Name (required): 
114                 <br />
115                 <input name="realname" size="40" <?php if(isset($_POST['realname'])){echo 'value="'.i18n::hsc($_POST['realname']).'"';}?>/>
116                 <br />
117                 <br />          
118                 Email (required):
119                 <br />
120                 <input name="email" size="40" <?php if(isset($_POST['email'])){echo 'value="'.i18n::hsc($_POST['email']).'"';}?>/> <small>(must be valid, because an activation link will be sent over there)</small>
121                 <br />
122                 <br />          
123                 URL: 
124                 <br />
125                 <input name="url" size="60" <?php if(isset($_POST['url'])){echo 'value="'.i18n::hsc($_POST['url']).'"';}?>/>
126                 <br />
127                 <?php
128                 // add extra fields from plugin, like NP_Profile
129                 $manager->notify('RegistrationFormExtraFields', array('type' => 'createaccount.php', 'prelabel' => '', 'postlabel' => '<br />', 'prefield' => '', 'postfield' => '<br /><br />'));
130                 // add a Captcha challenge or something else
131                 global $manager;
132                 $manager->notify('FormExtra', array('type' => 'membermailform-notloggedin'));
133                 ?>
134                 <br />
135                 <br />
136                 <input type="submit" value="Create Account" />
137         </div>
138
139         </form>
140 <?php
141                 }       // close else showform ...
142
143 }
144 else { 
145         echo 'Visitors are not allowed to create a Member Account.<br /><br />';
146         echo 'Please contact the website administrator for more information.';
147 }
148 ?>
149         
150         
151 </body>
152 </html>