Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!isset($_POST["musername"]) OR
- !isset($_POST["mpass"]) OR
- !isset($_POST["mpwcheck"]) OR
- !isset($_POST["recaptcha_response_field"])) {
- die ("Error: Not all fields complete");
- }
- $username = mysql_escape_string($_POST["musername"]);
- $password = mysql_escape_string($_POST["mpass"]);
- $confirm_password = mysql_escape_string($_POST["mpwcheck"]);
- $continue = false;
- require_once('inc/recaptchalib.php');
- $publickey = "6LemqAwAAAAAAF4dIpSjTB3GJt1ax0MRQ9FvOX_T";
- $privatekey = "6LemqAwAAAAAAO69RT3j9M1eHPX_ahhmC6Gakuwb";
- $resp = null;
- $error = null;
- if ($_POST["recaptcha_response_field"]) {
- $resp = recaptcha_check_answer ($privatekey,
- $_SERVER["REMOTE_ADDR"],
- $_POST["recaptcha_challenge_field"],
- $_POST["recaptcha_response_field"]);
- if ($resp->is_valid) {
- $continue = true;
- }
- }
- if (!$continue) {
- die ("<font color=\"red\">You have entered an incorrect CAPTCHA code</font>");
- }
- include('inc/init.php');
- $select_user_result = $database->query("SELECT `name` FROM `".TABLE_PREFIX."accounts` WHERE `name`='".$username."' LIMIT 1");
- if ($database->rows() > 0) {
- die ("User already exists!");
- } else if ($password != $confirm_password) {
- die ("Passwords didn't match!");
- } else if (strlen($password) < 4 || strlen($password) > 12) {
- die ("Your password must be between 4-12 characters");
- } else if (strlen($username) < 4 || strlen($username) > 12) {
- die ("Your username must be between 4-12 characters");
- } else {
- //All data is ok
- $insert_user_query = "INSERT INTO ".TABLE_PREFIX."accounts (`name`, `password`, `ip`) VALUES ('".
- $username.
- "', '".
- hash("sha1", $password)."', '/')";
- $database->query($insert_user_query);
- ?>
- <font face="Calibri, Verdana" size="+1"><div style="width: 100%; text-align: center;">
- You have successfully registered to KyraMS!
- </div></font>
- <?php
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement