punbb/register.php
changeset 6 5e1f1e916419
parent 5 e3d7322305bf
child 7 98bbc533541c
equal deleted inserted replaced
5:e3d7322305bf 6:5e1f1e916419
     1 <?php
       
     2 /***********************************************************************
       
     3 
       
     4   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)
       
     5 
       
     6   This file is part of PunBB.
       
     7 
       
     8   PunBB is free software; you can redistribute it and/or modify it
       
     9   under the terms of the GNU General Public License as published
       
    10   by the Free Software Foundation; either version 2 of the License,
       
    11   or (at your option) any later version.
       
    12 
       
    13   PunBB is distributed in the hope that it will be useful, but
       
    14   WITHOUT ANY WARRANTY; without even the implied warranty of
       
    15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    16   GNU General Public License for more details.
       
    17 
       
    18   You should have received a copy of the GNU General Public License
       
    19   along with this program; if not, write to the Free Software
       
    20   Foundation, Inc., 59 Temple Place, Suite 330, Boston,
       
    21   MA  02111-1307  USA
       
    22 
       
    23 ************************************************************************/
       
    24 
       
    25 
       
    26 //define('PUN_ROOT', './');
       
    27 //require PUN_ROOT.'include/common.php';
       
    28 
       
    29 global $pun_db, $pun_user, $pun_config, $lang_common;
       
    30 
       
    31 
       
    32 
       
    33 // If we are logged in, we shouldn't be here
       
    34 if (!$pun_user['is_guest'])
       
    35 {
       
    36 	header('Location: index.php');
       
    37 	exit;
       
    38 }
       
    39 
       
    40 // Load the register.php language file
       
    41 require PUN_ROOT.'lang/'.$pun_user['language'].'/register.php';
       
    42 
       
    43 // Load the register.php/profile.php language file
       
    44 require PUN_ROOT.'lang/'.$pun_user['language'].'/prof_reg.php';
       
    45 
       
    46 if ($pun_config['o_regs_allow'] == '0')
       
    47 	message($lang_register['No new regs']);
       
    48 
       
    49 
       
    50 // User pressed the cancel button
       
    51 if (isset($_GET['cancel']))
       
    52 	pun_redirect('index.php', $lang_register['Reg cancel redirect']);
       
    53 
       
    54 
       
    55 else if ($pun_config['o_rules'] == '1' && !isset($_GET['agree']) && !isset($_POST['form_sent']))
       
    56 {
       
    57 	$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_register['Register'];
       
    58 	require PUN_ROOT.'header.php';
       
    59 
       
    60 ?>
       
    61 <div class="blockform">
       
    62 	<h2><span><?php echo $lang_register['Forum rules'] ?></span></h2>
       
    63 	<div class="box">
       
    64 		<form method="get" action="register.php">
       
    65 			<div class="inform">
       
    66 				<fieldset>
       
    67 					<legend><?php echo $lang_register['Rules legend'] ?></legend>
       
    68 					<div class="infldset">
       
    69 						<p><?php echo $pun_config['o_rules_message'] ?></p>
       
    70 					</div>
       
    71 				</fieldset>
       
    72 			</div>
       
    73 			<p><input type="submit" name="agree" value="<?php echo $lang_register['Agree'] ?>" /><input type="submit" name="cancel" value="<?php echo $lang_register['Cancel'] ?>" /></p>
       
    74 		</form>
       
    75 	</div>
       
    76 </div>
       
    77 <?php
       
    78 
       
    79 	require PUN_ROOT.'footer.php';
       
    80 }
       
    81 
       
    82 
       
    83 else if (isset($_POST['form_sent']))
       
    84 {
       
    85 	// Check that someone from this IP didn't register a user within the last hour (DoS prevention)
       
    86 	$result = $pun_db->query('SELECT 1 FROM '.$pun_db->prefix.'users WHERE registration_ip=\''.get_remote_address().'\' AND registered>'.(time() - 3600)) or error('Unable to fetch user info', __FILE__, __LINE__, $pun_db->error());
       
    87 
       
    88 	if ($pun_db->num_rows($result))
       
    89 		message('A new user was registered with the same IP address as you within the last hour. To prevent registration flooding, at least an hour has to pass between registrations from the same IP. Sorry for the inconvenience.');
       
    90 
       
    91 
       
    92 	$username = pun_trim($_POST['req_username']);
       
    93 	$email1 = strtolower(trim($_POST['req_email1']));
       
    94 
       
    95 	if ($pun_config['o_regs_verify'] == '1')
       
    96 	{
       
    97 		$email2 = strtolower(trim($_POST['req_email2']));
       
    98 
       
    99 		$password1 = random_pass(8);
       
   100 		$password2 = $password1;
       
   101 	}
       
   102 	else
       
   103 	{
       
   104 		$password1 = trim($_POST['req_password1']);
       
   105 		$password2 = trim($_POST['req_password2']);
       
   106 	}
       
   107 
       
   108 	// Convert multiple whitespace characters into one (to prevent people from registering with indistinguishable usernames)
       
   109 	$username = preg_replace('#\s+#s', ' ', $username);
       
   110 
       
   111 	// Validate username and passwords
       
   112 	if (strlen($username) < 2)
       
   113 		message($lang_prof_reg['Username too short']);
       
   114 	else if (pun_strlen($username) > 25)	// This usually doesn't happen since the form element only accepts 25 characters
       
   115 	    message($lang_common['Bad request']);
       
   116 	else if (strlen($password1) < 4)
       
   117 		message($lang_prof_reg['Pass too short']);
       
   118 	else if ($password1 != $password2)
       
   119 		message($lang_prof_reg['Pass not match']);
       
   120 	else if (!strcasecmp($username, 'Guest') || !strcasecmp($username, $lang_common['Guest']))
       
   121 		message($lang_prof_reg['Username guest']);
       
   122 	else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $username))
       
   123 		message($lang_prof_reg['Username IP']);
       
   124 	else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false)
       
   125 		message($lang_prof_reg['Username reserved chars']);
       
   126 	else if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[quote=|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $username))
       
   127 		message($lang_prof_reg['Username BBCode']);
       
   128 
       
   129 	// Check username for any censored words
       
   130 	if ($pun_config['o_censoring'] == '1')
       
   131 	{
       
   132 		// If the censored username differs from the username
       
   133 		if (censor_words($username) != $username)
       
   134 			message($lang_register['Username censor']);
       
   135 	}
       
   136 
       
   137 	// Check that the username (or a too similar username) is not already registered
       
   138 	$result = $pun_db->query('SELECT username FROM '.$pun_db->prefix.'users WHERE UPPER(username)=UPPER(\''.$pun_db->escape($username).'\') OR UPPER(username)=UPPER(\''.$pun_db->escape(preg_replace('/[^\w]/', '', $username)).'\')') or error('Unable to fetch user info', __FILE__, __LINE__, $pun_db->error());
       
   139 
       
   140 	if ($pun_db->num_rows($result))
       
   141 	{
       
   142 		$busy = $pun_db->result($result);
       
   143 		message($lang_register['Username dupe 1'].' '.pun_htmlspecialchars($busy).'. '.$lang_register['Username dupe 2']);
       
   144 	}
       
   145 
       
   146 
       
   147 	// Validate e-mail
       
   148 	require PUN_ROOT.'include/email.php';
       
   149 
       
   150 	if (!is_valid_email($email1))
       
   151 		message($lang_common['Invalid e-mail']);
       
   152 	else if ($pun_config['o_regs_verify'] == '1' && $email1 != $email2)
       
   153 		message($lang_register['E-mail not match']);
       
   154 
       
   155 	// Check it it's a banned e-mail address
       
   156 	if (is_banned_email($email1))
       
   157 	{
       
   158 		if ($pun_config['p_allow_banned_email'] == '0')
       
   159 			message($lang_prof_reg['Banned e-mail']);
       
   160 
       
   161 		$banned_email = true;	// Used later when we send an alert e-mail
       
   162 	}
       
   163 	else
       
   164 		$banned_email = false;
       
   165 
       
   166 	// Check if someone else already has registered with that e-mail address
       
   167 	$dupe_list = array();
       
   168 
       
   169 	$result = $pun_db->query('SELECT username FROM '.$pun_db->prefix.'users WHERE email=\''.$email1.'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $pun_db->error());
       
   170 	if ($pun_db->num_rows($result))
       
   171 	{
       
   172 		if ($pun_config['p_allow_dupe_email'] == '0')
       
   173 			message($lang_prof_reg['Dupe e-mail']);
       
   174 
       
   175 		while ($cur_dupe = $pun_db->fetch_assoc($result))
       
   176 			$dupe_list[] = $cur_dupe['username'];
       
   177 	}
       
   178 
       
   179 	// Make sure we got a valid language string
       
   180 	if (isset($_POST['language']))
       
   181 	{
       
   182 		$language = preg_replace('#[\.\\\/]#', '', $_POST['language']);
       
   183 		if (!file_exists(PUN_ROOT.'lang/'.$language.'/common.php'))
       
   184 				message($lang_common['Bad request']);
       
   185 	}
       
   186 	else
       
   187 		$language = $pun_config['o_default_lang'];
       
   188 
       
   189 	$timezone = round($_POST['timezone'], 1);
       
   190 	$save_pass = (!isset($_POST['save_pass']) || $_POST['save_pass'] != '1') ? '0' : '1';
       
   191 
       
   192 	$email_setting = intval($_POST['email_setting']);
       
   193 	if ($email_setting < 0 || $email_setting > 2) $email_setting = 1;
       
   194 
       
   195 	// Insert the new user into the database. We do this now to get the last inserted id for later use.
       
   196 	$now = time();
       
   197 
       
   198 	$intial_group_id = ($pun_config['o_regs_verify'] == '0') ? $pun_config['o_default_user_group'] : PUN_UNVERIFIED;
       
   199 	$password_hash = pun_hash($password1);
       
   200 
       
   201 	// Add the user
       
   202 	$pun_db->query('INSERT INTO '.$pun_db->prefix.'users (username, group_id, password, email, email_setting, save_pass, timezone, language, style, registered, registration_ip, last_visit) VALUES(\''.$pun_db->escape($username).'\', '.$intial_group_id.', \''.$password_hash.'\', \''.$email1.'\', '.$email_setting.', '.$save_pass.', '.$timezone.' , \''.$pun_db->escape($language).'\', \''.$pun_config['o_default_style'].'\', '.$now.', \''.get_remote_address().'\', '.$now.')') or error('Unable to create user', __FILE__, __LINE__, $pun_db->error());
       
   203 	$new_uid = $pun_db->insert_id();
       
   204 
       
   205 
       
   206 	// If we previously found out that the e-mail was banned
       
   207 	if ($banned_email && $pun_config['o_mailing_list'] != '')
       
   208 	{
       
   209 		$mail_subject = 'Alert - Banned e-mail detected';
       
   210 		$mail_message = 'User \''.$username.'\' registered with banned e-mail address: '.$email1."\n\n".'User profile: '.$pun_config['o_base_url'].'/profile.php?id='.$new_uid."\n\n".'-- '."\n".'Forum Mailer'."\n".'(Do not reply to this message)';
       
   211 
       
   212 		pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message);
       
   213 	}
       
   214 
       
   215 	// If we previously found out that the e-mail was a dupe
       
   216 	if (!empty($dupe_list) && $pun_config['o_mailing_list'] != '')
       
   217 	{
       
   218 		$mail_subject = 'Alert - Duplicate e-mail detected';
       
   219 		$mail_message = 'User \''.$username.'\' registered with an e-mail address that also belongs to: '.implode(', ', $dupe_list)."\n\n".'User profile: '.$pun_config['o_base_url'].'/profile.php?id='.$new_uid."\n\n".'-- '."\n".'Forum Mailer'."\n".'(Do not reply to this message)';
       
   220 
       
   221 		pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message);
       
   222 	}
       
   223 
       
   224 	// Should we alert people on the admin mailing list that a new user has registered?
       
   225 	if ($pun_config['o_regs_report'] == '1')
       
   226 	{
       
   227 		$mail_subject = 'Alert - New registration';
       
   228 		$mail_message = 'User \''.$username.'\' registered in the forums at '.$pun_config['o_base_url']."\n\n".'User profile: '.$pun_config['o_base_url'].'/profile.php?id='.$new_uid."\n\n".'-- '."\n".'Forum Mailer'."\n".'(Do not reply to this message)';
       
   229 
       
   230 		pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message);
       
   231 	}
       
   232 
       
   233 	// Must the user verify the registration or do we log him/her in right now?
       
   234 	if ($pun_config['o_regs_verify'] == '1')
       
   235 	{
       
   236 		// Load the "welcome" template
       
   237 		$mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$pun_user['language'].'/mail_templates/welcome.tpl'));
       
   238 
       
   239 		// The first row contains the subject
       
   240 		$first_crlf = strpos($mail_tpl, "\n");
       
   241 		$mail_subject = trim(substr($mail_tpl, 8, $first_crlf-8));
       
   242 		$mail_message = trim(substr($mail_tpl, $first_crlf));
       
   243 
       
   244 		$mail_subject = str_replace('<board_title>', $pun_config['o_board_title'], $mail_subject);
       
   245 		$mail_message = str_replace('<base_url>', $pun_config['o_base_url'].'/', $mail_message);
       
   246 		$mail_message = str_replace('<username>', $username, $mail_message);
       
   247 		$mail_message = str_replace('<password>', $password1, $mail_message);
       
   248 		$mail_message = str_replace('<login_url>', $pun_config['o_base_url'].'/login.php', $mail_message);
       
   249 		$mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message);
       
   250 
       
   251 		pun_mail($email1, $mail_subject, $mail_message);
       
   252 
       
   253 		message($lang_register['Reg e-mail'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.', true);
       
   254 	}
       
   255 
       
   256 	pun_setcookie($new_uid, $password_hash, ($save_pass != '0') ? $now + 31536000 : 0);
       
   257 
       
   258 	pun_redirect('index.php', $lang_register['Reg complete']);
       
   259 }
       
   260 
       
   261 
       
   262 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_register['Register'];
       
   263 $required_fields = array('req_username' => $lang_common['Username'], 'req_password1' => $lang_common['Password'], 'req_password2' => $lang_prof_reg['Confirm pass'], 'req_email1' => $lang_common['E-mail'], 'req_email2' => $lang_common['E-mail'].' 2');
       
   264 $focus_element = array('register', 'req_username');
       
   265 require PUN_ROOT.'header.php';
       
   266 
       
   267 ?>
       
   268 <div class="blockform">
       
   269 	<h2><span><?php echo $lang_register['Register'] ?></span></h2>
       
   270 	<div class="box">
       
   271 		<form id="register" method="post" action="register.php?action=register" onsubmit="this.register.disabled=true;if(process_form(this)){return true;}else{this.register.disabled=false;return false;}">
       
   272 			<div class="inform">
       
   273 				<div class="forminfo">
       
   274 					<h3><?php echo $lang_common['Important information'] ?></h3>
       
   275 					<p><?php echo $lang_register['Desc 1'] ?></p>
       
   276 					<p><?php echo $lang_register['Desc 2'] ?></p>
       
   277 				</div>
       
   278 				<fieldset>
       
   279 					<legend><?php echo $lang_register['Username legend'] ?></legend>
       
   280 					<div class="infldset">
       
   281 						<input type="hidden" name="form_sent" value="1" />
       
   282 						<label><strong><?php echo $lang_common['Username'] ?></strong><br /><input type="text" name="req_username" size="25" maxlength="25" /><br /></label>
       
   283 					</div>
       
   284 				</fieldset>
       
   285 			</div>
       
   286 <?php if ($pun_config['o_regs_verify'] == '0'): ?>			<div class="inform">
       
   287 				<fieldset>
       
   288 					<legend><?php echo $lang_register['Pass legend 1'] ?></legend>
       
   289 					<div class="infldset">
       
   290 						<label class="conl"><strong><?php echo $lang_common['Password'] ?></strong><br /><input type="password" name="req_password1" size="16" maxlength="16" /><br /></label>
       
   291 						<label class="conl"><strong><?php echo $lang_prof_reg['Confirm pass'] ?></strong><br /><input type="password" name="req_password2" size="16" maxlength="16" /><br /></label>
       
   292 						<p class="clearb"><?php echo $lang_register['Pass info'] ?></p>
       
   293 					</div>
       
   294 				</fieldset>
       
   295 			</div>
       
   296 <?php endif; ?>			<div class="inform">
       
   297 				<fieldset>
       
   298 					<legend><?php echo ($pun_config['o_regs_verify'] == '1') ? $lang_prof_reg['E-mail legend 2'] : $lang_prof_reg['E-mail legend'] ?></legend>
       
   299 					<div class="infldset">
       
   300 <?php if ($pun_config['o_regs_verify'] == '1'): ?>			<p><?php echo $lang_register['E-mail info'] ?></p>
       
   301 <?php endif; ?>					<label><strong><?php echo $lang_common['E-mail'] ?></strong><br />
       
   302 						<input type="text" name="req_email1" size="50" maxlength="50" /><br /></label>
       
   303 <?php if ($pun_config['o_regs_verify'] == '1'): ?>						<label><strong><?php echo $lang_register['Confirm e-mail'] ?></strong><br />
       
   304 						<input type="text" name="req_email2" size="50" maxlength="50" /><br /></label>
       
   305 <?php endif; ?>					</div>
       
   306 				</fieldset>
       
   307 			</div>
       
   308 			<div class="inform">
       
   309 				<fieldset>
       
   310 					<legend><?php echo $lang_prof_reg['Localisation legend'] ?></legend>
       
   311 					<div class="infldset">
       
   312 						<label><?php echo $lang_prof_reg['Timezone'] ?>: <?php echo $lang_prof_reg['Timezone info'] ?>
       
   313 						<br /><select id="time_zone" name="timezone">
       
   314 							<option value="-12"<?php if ($pun_config['o_server_timezone'] == -12 ) echo ' selected="selected"' ?>>-12</option>
       
   315 							<option value="-11"<?php if ($pun_config['o_server_timezone'] == -11) echo ' selected="selected"' ?>>-11</option>
       
   316 							<option value="-10"<?php if ($pun_config['o_server_timezone'] == -10) echo ' selected="selected"' ?>>-10</option>
       
   317 							<option value="-9.5"<?php if ($pun_config['o_server_timezone'] == -9.5) echo ' selected="selected"' ?>>-9.5</option>
       
   318 							<option value="-9"<?php if ($pun_config['o_server_timezone'] == -9 ) echo ' selected="selected"' ?>>-09</option>
       
   319 							<option value="-8.5"<?php if ($pun_config['o_server_timezone'] == -8.5) echo ' selected="selected"' ?>>-8.5</option>
       
   320 							<option value="-8"<?php if ($pun_config['o_server_timezone'] == -8 ) echo ' selected="selected"' ?>>-08 PST</option>
       
   321 							<option value="-7"<?php if ($pun_config['o_server_timezone'] == -7 ) echo ' selected="selected"' ?>>-07 MST</option>
       
   322 							<option value="-6"<?php if ($pun_config['o_server_timezone'] == -6 ) echo ' selected="selected"' ?>>-06 CST</option>
       
   323 							<option value="-5"<?php if ($pun_config['o_server_timezone'] == -5 ) echo ' selected="selected"' ?>>-05 EST</option>
       
   324 							<option value="-4"<?php if ($pun_config['o_server_timezone'] == -4 ) echo ' selected="selected"' ?>>-04 AST</option>
       
   325 							<option value="-3.5"<?php if ($pun_config['o_server_timezone'] == -3.5) echo ' selected="selected"' ?>>-3.5</option>
       
   326 							<option value="-3"<?php if ($pun_config['o_server_timezone'] == -3 ) echo ' selected="selected"' ?>>-03 ADT</option>
       
   327 							<option value="-2"<?php if ($pun_config['o_server_timezone'] == -2 ) echo ' selected="selected"' ?>>-02</option>
       
   328 							<option value="-1"<?php if ($pun_config['o_server_timezone'] == -1) echo ' selected="selected"' ?>>-01</option>
       
   329 							<option value="0"<?php if ($pun_config['o_server_timezone'] == 0) echo ' selected="selected"' ?>>00 GMT</option>
       
   330 							<option value="1"<?php if ($pun_config['o_server_timezone'] == 1) echo ' selected="selected"' ?>>+01 CET</option>
       
   331 							<option value="2"<?php if ($pun_config['o_server_timezone'] == 2 ) echo ' selected="selected"' ?>>+02</option>
       
   332 							<option value="3"<?php if ($pun_config['o_server_timezone'] == 3 ) echo ' selected="selected"' ?>>+03</option>
       
   333 							<option value="3.5"<?php if ($pun_config['o_server_timezone'] == 3.5 ) echo ' selected="selected"' ?>>+03.5</option>
       
   334 							<option value="4"<?php if ($pun_config['o_server_timezone'] == 4 ) echo ' selected="selected"' ?>>+04</option>
       
   335 							<option value="4.5"<?php if ($pun_config['o_server_timezone'] == 4.5 ) echo ' selected="selected"' ?>>+04.5</option>
       
   336 							<option value="5"<?php if ($pun_config['o_server_timezone'] == 5 ) echo ' selected="selected"' ?>>+05</option>
       
   337 							<option value="5.5"<?php if ($pun_config['o_server_timezone'] == 5.5 ) echo ' selected="selected"' ?>>+05.5</option>
       
   338 							<option value="6"<?php if ($pun_config['o_server_timezone'] == 6 ) echo ' selected="selected"' ?>>+06</option>
       
   339 							<option value="6.5"<?php if ($pun_config['o_server_timezone'] == 6.5 ) echo ' selected="selected"' ?>>+06.5</option>
       
   340 							<option value="7"<?php if ($pun_config['o_server_timezone'] == 7 ) echo ' selected="selected"' ?>>+07</option>
       
   341 							<option value="8"<?php if ($pun_config['o_server_timezone'] == 8 ) echo ' selected="selected"' ?>>+08</option>
       
   342 							<option value="9"<?php if ($pun_config['o_server_timezone'] == 9 ) echo ' selected="selected"' ?>>+09</option>
       
   343 							<option value="9.5"<?php if ($pun_config['o_server_timezone'] == 9.5 ) echo ' selected="selected"' ?>>+09.5</option>
       
   344 							<option value="10"<?php if ($pun_config['o_server_timezone'] == 10) echo ' selected="selected"' ?>>+10</option>
       
   345 							<option value="10.5"<?php if ($pun_config['o_server_timezone'] == 10.5 ) echo ' selected="selected"' ?>>+10.5</option>
       
   346 							<option value="11"<?php if ($pun_config['o_server_timezone'] == 11) echo ' selected="selected"' ?>>+11</option>
       
   347 							<option value="11.5"<?php if ($pun_config['o_server_timezone'] == 11.5 ) echo ' selected="selected"' ?>>+11.5</option>
       
   348 							<option value="12"<?php if ($pun_config['o_server_timezone'] == 12 ) echo ' selected="selected"' ?>>+12</option>
       
   349 							<option value="13"<?php if ($pun_config['o_server_timezone'] == 13 ) echo ' selected="selected"' ?>>+13</option>
       
   350 							<option value="14"<?php if ($pun_config['o_server_timezone'] == 14 ) echo ' selected="selected"' ?>>+14</option>
       
   351 						</select>
       
   352 						<br /></label>
       
   353 <?php
       
   354 
       
   355 		$languages = array();
       
   356 		$d = dir(PUN_ROOT.'lang');
       
   357 		while (($entry = $d->read()) !== false)
       
   358 		{
       
   359 			if ($entry != '.' && $entry != '..' && is_dir(PUN_ROOT.'lang/'.$entry) && file_exists(PUN_ROOT.'lang/'.$entry.'/common.php'))
       
   360 				$languages[] = $entry;
       
   361 		}
       
   362 		$d->close();
       
   363 
       
   364 		// Only display the language selection box if there's more than one language available
       
   365 		if (count($languages) > 1)
       
   366 		{
       
   367 
       
   368 ?>
       
   369 							<label><?php echo $lang_prof_reg['Language'] ?>: <?php echo $lang_prof_reg['Language info'] ?>
       
   370 							<br /><select name="language">
       
   371 <?php
       
   372 
       
   373 			while (list(, $temp) = @each($languages))
       
   374 			{
       
   375 				if ($pun_config['o_default_lang'] == $temp)
       
   376 					echo "\t\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.$temp.'</option>'."\n";
       
   377 				else
       
   378 					echo "\t\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.$temp.'</option>'."\n";
       
   379 			}
       
   380 
       
   381 ?>
       
   382 							</select>
       
   383 							<br /></label>
       
   384 <?php
       
   385 
       
   386 		}
       
   387 ?>
       
   388 					</div>
       
   389 				</fieldset>
       
   390 			</div>
       
   391 			<div class="inform">
       
   392 				<fieldset>
       
   393 					<legend><?php echo $lang_prof_reg['Privacy options legend'] ?></legend>
       
   394 					<div class="infldset">
       
   395 						<p><?php echo $lang_prof_reg['E-mail setting info'] ?></p>
       
   396 						<div class="rbox">
       
   397 							<label><input type="radio" name="email_setting" value="0" /><?php echo $lang_prof_reg['E-mail setting 1'] ?><br /></label>
       
   398 							<label><input type="radio" name="email_setting" value="1" checked="checked" /><?php echo $lang_prof_reg['E-mail setting 2'] ?><br /></label>
       
   399 							<label><input type="radio" name="email_setting" value="2" /><?php echo $lang_prof_reg['E-mail setting 3'] ?><br /></label>
       
   400 						</div>
       
   401 						<p><?php echo $lang_prof_reg['Save user/pass info'] ?></p>
       
   402 						<div class="rbox">
       
   403 							<label><input type="checkbox" name="save_pass" value="1" checked="checked" /><?php echo $lang_prof_reg['Save user/pass'] ?><br /></label>
       
   404 						</div>
       
   405 					</div>
       
   406 				</fieldset>
       
   407 			</div>
       
   408 			<p><input type="submit" name="register" value="<?php echo $lang_register['Register'] ?>" /></p>
       
   409 		</form>
       
   410 	</div>
       
   411 </div>
       
   412 <?php
       
   413 
       
   414 require PUN_ROOT.'footer.php';