diff --git a/b2register.php b/b2register.php index 3341b2c22c..79a5b905a2 100644 --- a/b2register.php +++ b/b2register.php @@ -43,143 +43,93 @@ if (!$users_can_register) { switch($action) { -case "register": +case 'register': function filter($value) { - return ereg("^[a-zA-Z0-9\_-\|]+$",$value); + return ereg('^[a-zA-Z0-9\_-\|]+$',$value); } - $user_login = $HTTP_POST_VARS["user_login"]; - $pass1 = $HTTP_POST_VARS["pass1"]; - $pass2 = $HTTP_POST_VARS["pass2"]; - $user_email = $HTTP_POST_VARS["user_email"]; - $user_login = $HTTP_POST_VARS["user_login"]; - - /* declaring global fonctions */ -# global $user_login,$pass1,$pass2,$user_firstname,$user_nickname,$user_icq,$user_email,$user_url; + $user_login = $HTTP_POST_VARS['user_login']; + $pass1 = $HTTP_POST_VARS['pass1']; + $pass2 = $HTTP_POST_VARS['pass2']; + $user_email = $HTTP_POST_VARS['user_email']; + $user_login = $HTTP_POST_VARS['user_login']; /* checking login has been typed */ - if ($user_login=='') { - die ("ERROR: please enter a Login"); + if ($user_login == '') { + die ('ERROR: Please enter a login.'); } /* checking the password has been typed twice */ - if ($pass1=='' ||$pass2=='') { - die ("ERROR: please enter your password twice"); + if ($pass1 == '' || $pass2 == '') { + die ('ERROR: Please enter your password twice.'); } /* checking the password has been typed twice the same */ - if ($pass1!=$pass2) { - die ("ERROR: please type the same password in the two password fields"); + if ($pass1 != $pass2) { + die ('ERROR: Please type the same password in the two password fields.'); } - $user_nickname=$user_login; + $user_nickname = $user_login; /* checking e-mail address */ - if ($user_email=="") { - die ("ERROR: please type your e-mail address"); + if ($user_email == '') { + die ('ERROR: Please type your e-mail address.'); } else if (!is_email($user_email)) { - die ("ERROR: the email address isn't correct"); + die ('ERROR: The email address isn’t correct.'); } - $id=mysql_connect($server,$loginsql,$passsql); - if ($id==false) { - die ("OOPS: can't connect to the server !".mysql_error()); - } - - mysql_select_db("$base") or die ("OOPS: can't select the database $base : ".mysql_error()); - /* checking the login isn't already used by another user */ - $request = " SELECT user_login FROM $tableusers WHERE user_login = '$user_login'"; - $result = mysql_query($request,$id) or die ("OOPS: can't check the login..."); - $lines = mysql_num_rows($result); - mysql_free_result($result); - if ($lines>=1) { - die ("ERROR: this login is already registered, please choose another one"); + $result = $wpdb->get_results("SELECT user_login FROM $tableusers WHERE user_login = '$user_login'"); + if (count($result) >= 1) { + die ('ERROR: This login is already registered, please choose another one.'); } $user_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'] ; $user_domain = gethostbyaddr($HTTP_SERVER_VARS['REMOTE_ADDR'] ); $user_browser = $HTTP_SERVER_VARS['HTTP_USER_AGENT']; - $user_login=addslashes($user_login); - $pass1=addslashes($pass1); - $user_nickname=addslashes($user_nickname); + $user_login = addslashes($user_login); + $pass1 = addslashes($pass1); + $user_nickname = addslashes($user_nickname); - $query = "INSERT INTO $tableusers (user_login, user_pass, user_nickname, user_email, user_ip, user_domain, user_browser, dateYMDhour, user_level, user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_ip','$user_domain','$user_browser',NOW(),'$new_users_can_blog','nickname')"; - $result = mysql_query($query); - if ($result==false) { - die ("ERROR: couldn't register you... please contact the webmaster !".mysql_error()); + $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 + ('$user_login', '$pass1', '$user_nickname', '$user_email', '$user_ip', '$user_domain', '$user_browser', NOW(), '$new_users_can_blog', 'nickname')"); + + if ($result == false) { + die ('ERROR: Couldn’t register you... please contact the webmaster !' . mysql_error()); } - $stars=""; + $stars = ''; for ($i = 0; $i < strlen($pass1); $i = $i + 1) { - $stars .= "*"; + $stars .= '*'; } - $message = "new user registration on your blog $blogname:\r\n\r\n"; - $message .= "login: $user_login\r\n\r\ne-mail: $user_email"; + $message = "New user registration on your blog $blogname:\r\n\r\n"; + $message .= "Login: $user_login\r\n\r\nE-mail: $user_email"; - @mail($admin_email,"new user registration on your blog $blogname",$message); + @mail($admin_email, "[$blogname] New User Registration", $message); - ?> + ?> + + -b2 > Registration complete - - - + WordPress » Registration Complete + + - - - - - -
- - - - - - - - - - -
- - -registration
complete -
- - - - - - - -
login:  
password:  
e-mail:  
 
- -
-
- -
+ +
+

Registration Complete

+

Login:
+ Password:
+ E-mail:

+
+ + +
@@ -187,62 +137,25 @@ registration
complete + ?> + + -b2 > Registration Currently Disabled - - - + WordPress » Registration Currently Disabled + + - - - - -
+ - - - - - - - - - - -
- - -registration disabled
-
- -
-User registration is currently not allowed.
-Home -
-
- -
+
+

Registration Disabled

+

User registration is currently not allowed.
+ Home +

+
@@ -252,91 +165,33 @@ break; default: - ?> +?> + + -b2 > Register form - - - + WordPress » Registration Form + + - - - - -
- - - - - - - - - - -
-visit WordPress dot org - -registration
-
+ +
+

Registration

- - - - - - - - - - - - - - - - - - - - + +
+
+ +
+ :
+
- -
- -
+ -