2 require('./wp-config.php');
3 require_once( ABSPATH . WPINC . '/registration-functions.php');
5 $action = $_REQUEST['action'];
6 if ( !get_settings('users_can_register') )
9 header( 'Content-Type: ' . get_bloginfo('html_type') . '; charset=' . get_bloginfo('charset') );
15 $user_login = sanitize_user( $_POST['user_login'] );
16 $user_email = $_POST['user_email'];
20 if ( $user_login == '' )
21 $errors['user_login'] = __('<strong>ERROR</strong>: Please enter a username.');
23 /* checking e-mail address */
24 if ($user_email == '') {
25 $errors['user_email'] = __('<strong>ERROR</strong>: Please type your e-mail address.');
26 } else if (!is_email($user_email)) {
27 $errors['user_email'] = __('<strong>ERROR</strong>: The email address isn’t correct.');
31 if ( ! validate_username($user_login) ) {
32 $errors['user_login'] = __('<strong>ERROR</strong>: This username is invalid. Please enter a valid username.');
36 if ( username_exists( $user_login ) )
37 $errors['user_login'] = __('<strong>ERROR</strong>: This username is already registered, please choose another one.');
39 /* checking the email isn't already used by another user */
40 $email_exists = $wpdb->get_row("SELECT user_email FROM $wpdb->users WHERE user_email = '$user_email'");
42 die (__('<strong>ERROR</strong>: This email address is already registered, please supply another.'));
44 if ( 0 == count($errors) ) {
45 $password = substr( md5( uniqid( microtime() ) ), 0, 7);
47 $user_id = wp_create_user( $user_login, $password, $user_email );
49 $errors['user_id'] = sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !'), get_settings('admin_email'));
51 wp_new_user_notification($user_id, $password);
54 if ( 0 == count($errors) ) {
57 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
58 <html xmlns="http://www.w3.org/1999/xhtml">
60 <title>WordPress » <?php _e('Registration Complete') ?></title>
61 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
62 <link rel="stylesheet" href="wp-admin/wp-admin.css" type="text/css" />
63 <style type="text/css">
72 <h2><?php _e('Registration Complete') ?></h2>
73 <p><?php printf(__('Username: %s'), "<strong>" . wp_specialchars($user_login) . "</strong>") ?><br />
74 <?php printf(__('Password: %s'), '<strong>' . __('emailed to you') . '</strong>') ?> <br />
75 <?php printf(__('E-mail: %s'), "<strong>" . wp_specialchars($user_email) . "</strong>") ?></p>
76 <p class="submit"><a href="wp-login.php"><?php _e('Login'); ?> »</a></p>
88 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
89 <html xmlns="http://www.w3.org/1999/xhtml">
91 <title>WordPress » <?php _e('Registration Form') ?></title>
92 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
93 <link rel="stylesheet" href="wp-admin/wp-admin.css" type="text/css" />
94 <style type="text/css">
95 #user_email, #user_login, #submit {
103 <h1><a href="http://wordpress.org/">WordPress</a></h1>
104 <h2><?php _e('Register for this blog') ?></h2>
105 <?php if ( isset($errors) ) : ?>
109 foreach($errors as $error) echo "<li>$error</li>";
114 <form method="post" action="wp-register.php" id="registerform">
115 <p><input type="hidden" name="action" value="register" />
116 <label for="user_login"><?php _e('Username:') ?></label><br /> <input type="text" name="user_login" id="user_login" size="20" maxlength="20" value="<?php echo wp_specialchars($user_login); ?>" /><br /></p>
117 <p><label for="user_email"><?php _e('E-mail:') ?></label><br /> <input type="text" name="user_email" id="user_email" size="25" maxlength="100" value="<?php echo wp_specialchars($user_email); ?>" /></p>
118 <p><?php _e('A password will be emailed to you.') ?></p>
119 <p class="submit"><input type="submit" value="<?php _e('Register') ?> »" id="submit" name="submit" /></p>
122 <li><a href="<?php bloginfo('home'); ?>/" title="<?php _e('Are you lost?') ?>">« <?php _e('Back to blog') ?></a></li>
123 <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Login') ?></a></li>
124 <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a></li>
137 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
138 <html xmlns="http://www.w3.org/1999/xhtml">
140 <title>WordPress » <?php _e('Registration Currently Disabled') ?></title>
141 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
142 <link rel="stylesheet" href="wp-admin/wp-admin.css" type="text/css">
148 <h2><?php _e('Registration Disabled') ?></h2>
149 <p><?php _e('User registration is currently not allowed.') ?><br />
150 <a href="<?php echo get_settings('home'); ?>/" title="<?php _e('Go back to the blog') ?>"><?php _e('Home') ?></a>