2003-04-01 16:12:34 +02:00
|
|
|
<?php
|
2004-05-18 22:54:58 +02:00
|
|
|
require('./wp-config.php');
|
2003-04-01 16:12:34 +02:00
|
|
|
|
|
|
|
function add_magic_quotes($array) {
|
|
|
|
foreach ($array as $k => $v) {
|
|
|
|
if (is_array($v)) {
|
|
|
|
$array[$k] = add_magic_quotes($v);
|
|
|
|
} else {
|
|
|
|
$array[$k] = addslashes($v);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $array;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!get_magic_quotes_gpc()) {
|
2004-04-21 00:56:47 +02:00
|
|
|
$_GET = add_magic_quotes($_GET);
|
|
|
|
$_POST = add_magic_quotes($_POST);
|
|
|
|
$_COOKIE = add_magic_quotes($_COOKIE);
|
2003-04-01 16:12:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-18 10:36:13 +01:00
|
|
|
$wpvarstoreset = array('action');
|
|
|
|
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
|
|
|
|
$wpvar = $wpvarstoreset[$i];
|
|
|
|
if (!isset($$wpvar)) {
|
2004-04-21 00:56:47 +02:00
|
|
|
if (empty($_POST["$wpvar"])) {
|
|
|
|
if (empty($_GET["$wpvar"])) {
|
2003-12-18 10:36:13 +01:00
|
|
|
$$wpvar = '';
|
2003-04-01 16:12:34 +02:00
|
|
|
} else {
|
2004-04-21 00:56:47 +02:00
|
|
|
$$wpvar = $_GET["$wpvar"];
|
2003-04-01 16:12:34 +02:00
|
|
|
}
|
|
|
|
} else {
|
2004-04-21 00:56:47 +02:00
|
|
|
$$wpvar = $_POST["$wpvar"];
|
2003-04-01 16:12:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-02-29 09:43:36 +01:00
|
|
|
if (!get_settings('users_can_register')) {
|
2003-04-01 16:12:34 +02:00
|
|
|
$action = 'disabled';
|
|
|
|
}
|
|
|
|
|
|
|
|
switch($action) {
|
|
|
|
|
2003-06-20 07:16:08 +02:00
|
|
|
case 'register':
|
2003-04-01 16:12:34 +02:00
|
|
|
|
2004-04-21 00:56:47 +02:00
|
|
|
$user_login = $_POST['user_login'];
|
|
|
|
$pass1 = $_POST['pass1'];
|
|
|
|
$pass2 = $_POST['pass2'];
|
|
|
|
$user_email = $_POST['user_email'];
|
2003-04-01 16:12:34 +02:00
|
|
|
|
|
|
|
/* checking login has been typed */
|
2003-06-20 07:16:08 +02:00
|
|
|
if ($user_login == '') {
|
2004-04-25 21:33:12 +02:00
|
|
|
die (__('<strong>ERROR</strong>: Please enter a login.'));
|
2003-04-01 16:12:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* checking the password has been typed twice */
|
2003-06-20 07:16:08 +02:00
|
|
|
if ($pass1 == '' || $pass2 == '') {
|
2004-04-25 21:33:12 +02:00
|
|
|
die (__('<strong>ERROR</strong>: Please enter your password twice.'));
|
2003-04-01 16:12:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* checking the password has been typed twice the same */
|
2003-06-20 07:16:08 +02:00
|
|
|
if ($pass1 != $pass2) {
|
2004-04-25 21:33:12 +02:00
|
|
|
die (__('<strong>ERROR</strong>: Please type the same password in the two password fields.'));
|
2003-04-01 16:12:34 +02:00
|
|
|
}
|
2003-06-20 07:16:08 +02:00
|
|
|
$user_nickname = $user_login;
|
2003-04-01 16:12:34 +02:00
|
|
|
|
|
|
|
/* checking e-mail address */
|
2003-06-20 07:16:08 +02:00
|
|
|
if ($user_email == '') {
|
2004-04-25 21:33:12 +02:00
|
|
|
die (__('<strong>ERROR</strong>: Please type your e-mail address.'));
|
2003-04-01 16:12:34 +02:00
|
|
|
} else if (!is_email($user_email)) {
|
2004-04-25 21:33:12 +02:00
|
|
|
die (__('<strong>ERROR</strong>: The email address isn’t correct.'));
|
2003-04-01 16:12:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* checking the login isn't already used by another user */
|
2003-06-20 07:16:08 +02:00
|
|
|
$result = $wpdb->get_results("SELECT user_login FROM $tableusers WHERE user_login = '$user_login'");
|
2003-11-25 01:46:52 +01:00
|
|
|
if (count($result) >= 1) {
|
2004-04-25 21:33:12 +02:00
|
|
|
die (__('<strong>ERROR</strong>: This login is already registered, please choose another one.'));
|
2003-04-01 16:12:34 +02:00
|
|
|
}
|
|
|
|
|
2004-04-21 00:56:47 +02:00
|
|
|
$user_ip = $_SERVER['REMOTE_ADDR'] ;
|
2003-04-01 16:12:34 +02:00
|
|
|
|
2004-05-18 22:54:58 +02:00
|
|
|
$user_browser = $wpdb->escape($_SERVER['HTTP_USER_AGENT']);
|
|
|
|
|
|
|
|
$user_login = $wpdb->escape($user_login);
|
|
|
|
$pass1 = $wpdb->escape($pass1);
|
|
|
|
$user_nickname = $wpdb->escape($user_nickname);
|
2004-02-23 04:42:40 +01:00
|
|
|
$now = gmdate('Y-m-d H:i:s');
|
2004-02-29 09:43:36 +01:00
|
|
|
$new_users_can_blog = get_settings('new_users_can_blog');
|
2003-06-20 07:16:08 +02:00
|
|
|
|
|
|
|
$result = $wpdb->query("INSERT INTO $tableusers
|
2004-05-18 22:54:58 +02:00
|
|
|
(user_login, user_pass, user_nickname, user_email, user_ip, user_browser, dateYMDhour, user_level, user_idmode)
|
2003-06-20 07:16:08 +02:00
|
|
|
VALUES
|
2004-05-18 22:54:58 +02:00
|
|
|
('$user_login', MD5('$pass1'), '$user_nickname', '$user_email', '$user_ip', '$user_browser', '$now', '$new_users_can_blog', 'nickname')");
|
2003-06-20 07:16:08 +02:00
|
|
|
|
|
|
|
if ($result == false) {
|
2004-04-25 21:33:12 +02:00
|
|
|
die (sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !'), get_settings('admin_email')));
|
2003-04-01 16:12:34 +02:00
|
|
|
}
|
|
|
|
|
2003-06-20 07:16:08 +02:00
|
|
|
$stars = '';
|
2003-04-01 16:12:34 +02:00
|
|
|
for ($i = 0; $i < strlen($pass1); $i = $i + 1) {
|
2003-06-20 07:16:08 +02:00
|
|
|
$stars .= '*';
|
2003-04-01 16:12:34 +02:00
|
|
|
}
|
|
|
|
|
2004-04-25 21:33:12 +02:00
|
|
|
$message = sprintf(__("New user registration on your blog %1\$s:\n\nLogin: %2\$s \n\nE-mail: %3\$s"), get_settings('blogname'), $user_login, $user_email);
|
2003-04-01 16:12:34 +02:00
|
|
|
|
2004-04-25 21:33:12 +02:00
|
|
|
@mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message);
|
2003-04-01 16:12:34 +02:00
|
|
|
|
2003-06-20 07:16:08 +02:00
|
|
|
?>
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
2003-04-01 16:12:34 +02:00
|
|
|
<head>
|
2004-05-18 22:54:58 +02:00
|
|
|
<title>WordPress » <?php _e('Registration Complete') ?></title>
|
2004-03-01 07:13:32 +01:00
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo get_settings('blog_charset'); ?>" />
|
2003-09-12 18:46:46 +02:00
|
|
|
<link rel="stylesheet" href="wp-admin/wp-admin.css" type="text/css" />
|
2003-04-01 16:12:34 +02:00
|
|
|
</head>
|
2003-06-20 07:16:08 +02:00
|
|
|
<body>
|
|
|
|
|
|
|
|
<div id="login">
|
2004-04-25 21:33:12 +02:00
|
|
|
<h2><?php _e('Registration Complete') ?></h2>
|
|
|
|
<p><?php _e('Login:') ?> <strong><?php echo $user_login; ?></strong><br />
|
|
|
|
<?php _e('Password:') ?> <strong><?php echo $stars; ?></strong><br />
|
|
|
|
<?php _e('E-mail:') ?> <strong><?php echo $user_email; ?></strong></p>
|
2003-12-11 01:22:36 +01:00
|
|
|
<form action="wp-login.php" method="post" name="login">
|
2003-06-20 07:16:08 +02:00
|
|
|
<input type="hidden" name="log" value="<?php echo $user_login; ?>" />
|
2004-04-25 21:33:12 +02:00
|
|
|
<input type="submit" value="<?php _e('Login') ?>" name="submit" />
|
2003-06-20 07:16:08 +02:00
|
|
|
</form>
|
2003-04-01 16:12:34 +02:00
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
break;
|
|
|
|
|
2003-06-20 07:16:08 +02:00
|
|
|
case 'disabled':
|
2003-04-01 16:12:34 +02:00
|
|
|
|
2003-06-20 07:16:08 +02:00
|
|
|
?>
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
2003-04-01 16:12:34 +02:00
|
|
|
<head>
|
2004-05-18 22:54:58 +02:00
|
|
|
<title>WordPress » <?php _e('Registration Currently Disabled') ?></title>
|
2004-03-01 07:13:32 +01:00
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo get_settings('blog_charset'); ?>">
|
2003-09-12 18:46:46 +02:00
|
|
|
<link rel="stylesheet" href="wp-admin/wp-admin.css" type="text/css">
|
2003-04-01 16:12:34 +02:00
|
|
|
</head>
|
2003-06-20 07:16:08 +02:00
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<div id="login">
|
2004-04-25 21:33:12 +02:00
|
|
|
<h2><?php _e('Registration Disabled') ?></h2>
|
|
|
|
<p><?php _e('User registration is currently not allowed.') ?><br />
|
|
|
|
<a href="<?php echo get_settings('siteurl') .'/'. get_settings('blogfilename'); ?>" title="<?php _e('Go back to the blog') ?>"><?php _e('Home') ?></a>
|
2003-06-20 07:16:08 +02:00
|
|
|
</p>
|
|
|
|
</div>
|
2003-04-01 16:12:34 +02:00
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
?>
|
2003-06-20 07:16:08 +02:00
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
<head>
|
2004-05-18 22:54:58 +02:00
|
|
|
<title>WordPress » <?php _e('Registration Form') ?></title>
|
2004-03-01 07:13:32 +01:00
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo get_settings('blog_charset'); ?>" />
|
2003-09-12 18:46:46 +02:00
|
|
|
<link rel="stylesheet" href="wp-admin/wp-admin.css" type="text/css" />
|
2003-04-01 16:12:34 +02:00
|
|
|
</head>
|
|
|
|
|
2003-06-20 07:16:08 +02:00
|
|
|
<body>
|
|
|
|
<div id="login">
|
2004-04-25 21:33:12 +02:00
|
|
|
<h2><?php _e('Registration') ?></h2>
|
2003-04-01 16:12:34 +02:00
|
|
|
|
2003-12-08 02:32:17 +01:00
|
|
|
<form method="post" action="wp-register.php">
|
2003-06-20 07:16:08 +02:00
|
|
|
<input type="hidden" name="action" value="register" />
|
2004-04-25 21:33:12 +02:00
|
|
|
<label for="user_login"><?php _e('Login:') ?></label> <input type="text" name="user_login" id="user_login" size="10" maxlength="20" /><br />
|
|
|
|
<label for="pass1"><?php _e('Password:') ?></label> <input type="password" name="pass1" id="pass1" size="10" maxlength="100" /><br />
|
2003-06-20 07:16:08 +02:00
|
|
|
|
|
|
|
<input type="password" name="pass2" size="10" maxlength="100" /><br />
|
2004-04-25 21:33:12 +02:00
|
|
|
<label for="user_email"><?php _e('E-mail') ?></label>: <input type="text" name="user_email" id="user_email" size="15" maxlength="100" /><br />
|
|
|
|
<input type="submit" value="<?php _e('OK') ?>" class="search" name="submit" />
|
2003-04-01 16:12:34 +02:00
|
|
|
</form>
|
2003-06-20 07:16:08 +02:00
|
|
|
</div>
|
2003-04-01 16:12:34 +02:00
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
2003-06-20 07:16:08 +02:00
|
|
|
<?php
|
2003-04-01 16:12:34 +02:00
|
|
|
|
|
|
|
break;
|
2004-02-09 20:29:35 +01:00
|
|
|
}
|
2004-05-18 22:54:58 +02:00
|
|
|
?>
|