*/ include("./b2config.php"); include($b2inc."/b2functions.php"); 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); } $b2varstoreset = array('action'); for ($i=0; $iERROR: please enter a Login"); } /* checking the password has been typed 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"); } $user_nickname=$user_login; /* checking 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"); } $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"); } $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); $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()); } $stars=""; for ($i = 0; $i < strlen($pass1); $i = $i + 1) { $stars .= "*"; } $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); ?> b2 > Registration complete
visit b2's homepage registration
complete
login:  
password:  
e-mail:  
 
b2 > Registration Currently Disabled
visit b2's homepage registration disabled
User registration is currently not allowed.
Home
b2 > Register form
visit b2's homepage registration