2003-04-01 16:12:34 +02:00
|
|
|
<?php
|
2003-12-11 01:22:36 +01:00
|
|
|
require(dirname(__FILE__) . '/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()) {
|
|
|
|
$HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS);
|
|
|
|
$HTTP_POST_VARS = add_magic_quotes($HTTP_POST_VARS);
|
|
|
|
$HTTP_COOKIE_VARS = add_magic_quotes($HTTP_COOKIE_VARS);
|
|
|
|
}
|
|
|
|
|
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)) {
|
|
|
|
if (empty($HTTP_POST_VARS["$wpvar"])) {
|
|
|
|
if (empty($HTTP_GET_VARS["$wpvar"])) {
|
|
|
|
$$wpvar = '';
|
2003-04-01 16:12:34 +02:00
|
|
|
} else {
|
2003-12-18 10:36:13 +01:00
|
|
|
$$wpvar = $HTTP_GET_VARS["$wpvar"];
|
2003-04-01 16:12:34 +02:00
|
|
|
}
|
|
|
|
} else {
|
2003-12-18 10:36:13 +01:00
|
|
|
$$wpvar = $HTTP_POST_VARS["$wpvar"];
|
2003-04-01 16:12:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$users_can_register) {
|
|
|
|
$action = 'disabled';
|
|
|
|
}
|
|
|
|
|
|
|
|
switch($action) {
|
|
|
|
|
2003-06-20 07:16:08 +02:00
|
|
|
case 'register':
|
2003-04-01 16:12:34 +02:00
|
|
|
|
|
|
|
function filter($value) {
|
2003-06-20 07:16:08 +02:00
|
|
|
return ereg('^[a-zA-Z0-9\_-\|]+$',$value);
|
2003-04-01 16:12:34 +02:00
|
|
|
}
|
|
|
|
|
2003-06-20 07:16:08 +02:00
|
|
|
$user_login = $HTTP_POST_VARS['user_login'];
|
|
|
|
$pass1 = $HTTP_POST_VARS['pass1'];
|
|
|
|
$pass2 = $HTTP_POST_VARS['pass2'];
|
|
|
|
$user_email = $HTTP_POST_VARS['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 == '') {
|
|
|
|
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 == '') {
|
|
|
|
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) {
|
|
|
|
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 == '') {
|
|
|
|
die ('<strong>ERROR</strong>: Please type your e-mail address.');
|
2003-04-01 16:12:34 +02:00
|
|
|
} else if (!is_email($user_email)) {
|
2003-06-20 07:16:08 +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) {
|
2003-06-20 07:16:08 +02:00
|
|
|
die ('<strong>ERROR</strong>: This login is already registered, please choose another one.');
|
2003-04-01 16:12:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$user_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'] ;
|
|
|
|
$user_domain = gethostbyaddr($HTTP_SERVER_VARS['REMOTE_ADDR'] );
|
|
|
|
$user_browser = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
|
|
|
|
|
2003-06-20 07:16:08 +02:00
|
|
|
$user_login = addslashes($user_login);
|
|
|
|
$pass1 = addslashes($pass1);
|
|
|
|
$user_nickname = addslashes($user_nickname);
|
2004-02-23 04:42:40 +01:00
|
|
|
$now = gmdate('Y-m-d H:i:s');
|
2003-06-20 07:16:08 +02:00
|
|
|
|
|
|
|
$result = $wpdb->query("INSERT INTO $tableusers
|
|
|
|
(user_login, user_pass, user_nickname, user_email, user_ip, user_domain, user_browser, dateYMDhour, user_level, user_idmode)
|
|
|
|
VALUES
|
2004-02-09 10:56:57 +01:00
|
|
|
('$user_login', MD5('$pass1'), '$user_nickname', '$user_email', '$user_ip', '$user_domain', '$user_browser', '$now', '$new_users_can_blog', 'nickname')");
|
2003-06-20 07:16:08 +02:00
|
|
|
|
|
|
|
if ($result == false) {
|
2003-07-20 00:47:17 +02:00
|
|
|
die ('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:'.$admin_email.'">webmaster</a> !');
|
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
|
|
|
}
|
|
|
|
|
2003-06-20 07:16:08 +02:00
|
|
|
$message = "New user registration on your blog $blogname:\r\n\r\n";
|
|
|
|
$message .= "Login: $user_login\r\n\r\nE-mail: $user_email";
|
2003-04-01 16:12:34 +02:00
|
|
|
|
2003-06-20 07:16:08 +02:00
|
|
|
@mail($admin_email, "[$blogname] New User Registration", $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>
|
2003-06-20 07:16:08 +02:00
|
|
|
<title>WordPress » Registration Complete</title>
|
2004-02-17 03:29:20 +01:00
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $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">
|
|
|
|
<h2>Registration Complete</h2>
|
|
|
|
<p>Login: <strong><?php echo $user_login; ?></strong><br />
|
|
|
|
Password: <strong><?php echo $stars; ?></strong><br />
|
|
|
|
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; ?>" />
|
|
|
|
<input type="submit" value="Login" name="submit" />
|
|
|
|
</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>
|
2003-06-20 07:16:08 +02:00
|
|
|
<title>WordPress » Registration Currently Disabled</title>
|
2004-02-17 03:29:20 +01:00
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $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">
|
|
|
|
<h2>Registration Disabled</h2>
|
|
|
|
<p>User registration is currently not allowed.<br />
|
2004-02-26 17:15:48 +01:00
|
|
|
<a href="<?php echo get_settings('siteurl') .'/'. get_settings('blogfilename'); ?>" title="Go back to the blog">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>
|
|
|
|
<title>WordPress » Registration Form</title>
|
2004-02-17 03:29:20 +01:00
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $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">
|
|
|
|
<h2>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" />
|
|
|
|
<label for="user_login">Login:</label> <input type="text" name="user_login" id="user_login" size="10" maxlength="20" /><br />
|
|
|
|
<label for="pass1">Password:</label> <input type="password" name="pass1" id="pass1" size="10" maxlength="100" /><br />
|
|
|
|
|
|
|
|
<input type="password" name="pass2" size="10" maxlength="100" /><br />
|
|
|
|
<label for="user_email">E-mail</label>: <input type="text" name="user_email" id="user_email" size="15" maxlength="100" /><br />
|
|
|
|
<input type="submit" value="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
|
|
|
}
|
|
|
|
?>
|