punbb/login.php
author Dan
Thu, 12 Jul 2007 01:04:01 -0400
changeset 2 a8a21e1c7afa
parent 0 f9ffdbd96607
permissions -rw-r--r--
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     1
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     2
/***********************************************************************
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     3
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     4
  Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     5
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     6
  This file is part of PunBB.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     7
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     8
  PunBB is free software; you can redistribute it and/or modify it
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     9
  under the terms of the GNU General Public License as published
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    10
  by the Free Software Foundation; either version 2 of the License,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    11
  or (at your option) any later version.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    12
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    13
  PunBB is distributed in the hope that it will be useful, but
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    14
  WITHOUT ANY WARRANTY; without even the implied warranty of
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    15
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    16
  GNU General Public License for more details.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    17
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    18
  You should have received a copy of the GNU General Public License
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    19
  along with this program; if not, write to the Free Software
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    20
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    21
  MA  02111-1307  USA
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    22
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    23
************************************************************************/
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    24
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    25
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    26
if (isset($_GET['action']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    27
	define('PUN_QUIET_VISIT', 1);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    28
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    29
//define('PUN_ROOT', './');
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    30
//require PUN_ROOT.'include/common.php';
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    31
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    32
global $pun_db, $pun_user, $pun_config, $lang_common;
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    33
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    34
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    35
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    36
// Load the login.php language file
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    37
require PUN_ROOT.'lang/'.$pun_user['language'].'/login.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    38
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    39
$action = isset($_GET['action']) ? $_GET['action'] : null;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    40
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    41
if (isset($_POST['form_sent']) && $action == 'in')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    42
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    43
	$form_username = trim($_POST['req_username']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    44
	$form_password = trim($_POST['req_password']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    45
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    46
	$username_sql = ($db_type == 'mysql' || $db_type == 'mysqli') ? 'username=\''.$pun_db->escape($form_username).'\'' : 'LOWER(username)=LOWER(\''.$pun_db->escape($form_username).'\')';
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    47
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    48
	$result = $pun_db->query('SELECT id, group_id, password, save_pass FROM '.$pun_db->prefix.'users WHERE '.$username_sql) or error('Unable to fetch user info', __FILE__, __LINE__, $pun_db->error());
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    49
	list($user_id, $group_id, $db_password_hash, $save_pass) = $pun_db->fetch_row($result);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    50
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    51
	$authorized = false;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    52
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    53
	if (!empty($db_password_hash))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    54
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    55
		$sha1_in_db = (strlen($db_password_hash) == 40) ? true : false;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    56
		$sha1_available = (function_exists('sha1') || function_exists('mhash')) ? true : false;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    57
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    58
		$form_password_hash = pun_hash($form_password);	// This could result in either an SHA-1 or an MD5 hash (depends on $sha1_available)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    59
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    60
		if ($sha1_in_db && $sha1_available && $db_password_hash == $form_password_hash)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    61
			$authorized = true;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    62
		else if (!$sha1_in_db && $db_password_hash == md5($form_password))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    63
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    64
			$authorized = true;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    65
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    66
			if ($sha1_available)	// There's an MD5 hash in the database, but SHA1 hashing is available, so we update the DB
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    67
				$pun_db->query('UPDATE '.$pun_db->prefix.'users SET password=\''.$form_password_hash.'\' WHERE id='.$user_id) or error('Unable to update user password', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    68
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    69
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    70
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    71
	if (!$authorized)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    72
		message($lang_login['Wrong user/pass'].' <a href="login.php?action=forget">'.$lang_login['Forgotten pass'].'</a>');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    73
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    74
	// Update the status if this is the first time the user logged in
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    75
	if ($group_id == PUN_UNVERIFIED)
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    76
		$pun_db->query('UPDATE '.$pun_db->prefix.'users SET group_id='.$pun_config['o_default_user_group'].' WHERE id='.$user_id) or error('Unable to update user status', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    77
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    78
	// Remove this users guest entry from the online list
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    79
	$pun_db->query('DELETE FROM '.$pun_db->prefix.'online WHERE ident=\''.$pun_db->escape(get_remote_address()).'\'') or error('Unable to delete from online list', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    80
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    81
	$expire = ($save_pass == '1') ? time() + 31536000 : 0;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    82
	pun_setcookie($user_id, $form_password_hash, $expire);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    83
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    84
	pun_redirect(htmlspecialchars($_POST['redirect_url']), $lang_login['Login redirect']);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    85
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    86
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    87
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    88
else if ($action == 'out')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    89
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    90
	if ($pun_user['is_guest'] || !isset($_GET['id']) || $_GET['id'] != $pun_user['id'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    91
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    92
		header('Location: index.php');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    93
		exit;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    94
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    95
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    96
	// Remove user from "users online" list.
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    97
	$pun_db->query('DELETE FROM '.$pun_db->prefix.'online WHERE user_id='.$pun_user['id']) or error('Unable to delete from online list', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    98
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    99
	// Update last_visit (make sure there's something to update it with)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   100
	if (isset($pun_user['logged']))
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   101
		$pun_db->query('UPDATE '.$pun_db->prefix.'users SET last_visit='.$pun_user['logged'].' WHERE id='.$pun_user['id']) or error('Unable to update user visit data', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   102
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   103
	pun_setcookie(1, random_pass(8), time() + 31536000);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   104
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   105
	pun_redirect('index.php', $lang_login['Logout redirect']);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   106
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   107
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   108
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   109
else if ($action == 'forget' || $action == 'forget_2')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   110
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   111
	if (!$pun_user['is_guest'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   112
		header('Location: index.php');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   113
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   114
	if (isset($_POST['form_sent']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   115
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   116
		require PUN_ROOT.'include/email.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   117
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   118
		// Validate the email-address
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   119
		$email = strtolower(trim($_POST['req_email']));
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   120
		if (!is_valid_email($email))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   121
			message($lang_common['Invalid e-mail']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   122
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   123
		$result = $pun_db->query('SELECT id, username FROM '.$pun_db->prefix.'users WHERE email=\''.$pun_db->escape($email).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   124
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   125
		if ($pun_db->num_rows($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   126
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   127
			// Load the "activate password" template
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   128
			$mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$pun_user['language'].'/mail_templates/activate_password.tpl'));
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   129
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   130
			// The first row contains the subject
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   131
			$first_crlf = strpos($mail_tpl, "\n");
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   132
			$mail_subject = trim(substr($mail_tpl, 8, $first_crlf-8));
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   133
			$mail_message = trim(substr($mail_tpl, $first_crlf));
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   134
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   135
			// Do the generic replacements first (they apply to all e-mails sent out here)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   136
			$mail_message = str_replace('<base_url>', $pun_config['o_base_url'].'/', $mail_message);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   137
			$mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   138
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   139
			// Loop through users we found
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   140
			while ($cur_hit = $pun_db->fetch_assoc($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   141
			{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   142
				// Generate a new password and a new password activation code
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   143
				$new_password = random_pass(8);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   144
				$new_password_key = random_pass(8);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   145
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   146
				$pun_db->query('UPDATE '.$pun_db->prefix.'users SET activate_string=\''.pun_hash($new_password).'\', activate_key=\''.$new_password_key.'\' WHERE id='.$cur_hit['id']) or error('Unable to update activation data', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   147
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   148
				// Do the user specific replacements to the template
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   149
				$cur_mail_message = str_replace('<username>', $cur_hit['username'], $mail_message);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   150
				$cur_mail_message = str_replace('<activation_url>', $pun_config['o_base_url'].'/profile.php?id='.$cur_hit['id'].'&action=change_pass&key='.$new_password_key, $cur_mail_message);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   151
				$cur_mail_message = str_replace('<new_password>', $new_password, $cur_mail_message);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   152
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   153
				pun_mail($email, $mail_subject, $cur_mail_message);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   154
			}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   155
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   156
			message($lang_login['Forget mail'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   157
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   158
		else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   159
			message($lang_login['No e-mail match'].' '.htmlspecialchars($email).'.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   160
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   161
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   162
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   163
	$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_login['Request pass'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   164
	$required_fields = array('req_email' => $lang_common['E-mail']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   165
	$focus_element = array('request_pass', 'req_email');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   166
	require PUN_ROOT.'header.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   167
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   168
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   169
<div class="blockform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   170
	<h2><span><?php echo $lang_login['Request pass'] ?></span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   171
	<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   172
		<form id="request_pass" method="post" action="login.php?action=forget_2" onsubmit="this.request_pass.disabled=true;if(process_form(this)){return true;}else{this.request_pass.disabled=false;return false;}">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   173
			<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   174
				<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   175
					<legend><?php echo $lang_login['Request pass legend'] ?></legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   176
					<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   177
						<input type="hidden" name="form_sent" value="1" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   178
						<input id="req_email" type="text" name="req_email" size="50" maxlength="50" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   179
						<p><?php echo $lang_login['Request pass info'] ?></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   180
					</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   181
				</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   182
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   183
			<p><input type="submit" name="request_pass" value="<?php echo $lang_common['Submit'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   184
		</form>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   185
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   186
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   187
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   188
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   189
	require PUN_ROOT.'footer.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   190
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   191
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   192
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   193
if (!$pun_user['is_guest'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   194
	header('Location: index.php');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   195
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   196
// Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to index.php after login)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   197
$redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : 'index.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   198
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   199
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Login'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   200
$required_fields = array('req_username' => $lang_common['Username'], 'req_password' => $lang_common['Password']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   201
$focus_element = array('login', 'req_username');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   202
require PUN_ROOT.'header.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   203
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   204
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   205
<div class="blockform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   206
	<h2><span><?php echo $lang_common['Login'] ?></span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   207
	<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   208
		<form id="login" method="post" action="login.php?action=in" onsubmit="return process_form(this)">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   209
			<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   210
				<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   211
					<legend><?php echo $lang_login['Login legend'] ?></legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   212
						<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   213
							<input type="hidden" name="form_sent" value="1" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   214
							<input type="hidden" name="redirect_url" value="<?php echo $redirect_url ?>" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   215
							<label class="conl"><strong><?php echo $lang_common['Username'] ?></strong><br /><input type="text" name="req_username" size="25" maxlength="25" tabindex="1" /><br /></label>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   216
							<label class="conl"><strong><?php echo $lang_common['Password'] ?></strong><br /><input type="password" name="req_password" size="16" maxlength="16" tabindex="2" /><br /></label>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   217
							<p class="clearb"><?php echo $lang_login['Login info'] ?></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   218
							<p><a href="register.php" tabindex="4"><?php echo $lang_login['Not registered'] ?></a>&nbsp;&nbsp;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   219
							<a href="login.php?action=forget" tabindex="5"><?php echo $lang_login['Forgotten pass'] ?></a></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   220
						</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   221
				</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   222
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   223
			<p><input type="submit" name="login" value="<?php echo $lang_common['Login'] ?>" tabindex="3" /></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   224
		</form>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   225
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   226
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   227
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   228
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   229
require PUN_ROOT.'footer.php';