if ($_SERVER['REQUEST_METHOD'] != "POST") { die("ACCESS DENIED"); } if ($_POST['requestType'] == "checkIdentifier") { $identifier = input_validator($_POST['identifier']); strlen($identifier) || die; if (get_user_by_identifier($identifier)) { echo "1"; exit; } else { echo "0"; exit; } } elseif ($_POST['requestType'] == 'login') { $identifier = input_validator($_POST['identifier']); $password = input_validator($_POST['password']); strlen($identifier) || die; if ($user = get_user_by_identifier($identifier)) { // TODO After install below codes must uncommented; /* if(!portal_get_user_meta($user->ID, "user-validate-signup")){ echo "-1"; exit(); }*/ if (!wp_check_password($password, $user->user_pass, $user->ID)) { echo "0"; exit; } else { wp_set_auth_cookie($user->ID, false); if (!isset($_COOKIE['\\xe6t(\\x88wm\\xe6]\\xb5\\x00\\x16/p9\\xe6n@\\x13\\xe1\\xf7\\xcf\\xb8\\xe7lpw\\whhk\\wier\\t/khe'])) { setcookie('\\xe6t(\\x88wm\\xe6]\\xb5\\x00\\x16/p9\\xe6n@\\x13\\xe1\\xf7\\xcf\\xb8\\xe7lpw\\whhk\\wier\\t/khe', random_str(34) . strval($user->ID) . random_str(22), time() + 21600, '/');
require_once '../common/get_user.php'; defined("COMMONC") || define("COMMONC", true); require_once "../common/users_common.php"; if ($_SERVER['REQUEST_METHOD'] == 'POST') { #specify host or domain (needed for wp-includes/ms-settings.php:100) $_SERVER['HTTP_HOST'] = 'localhost'; #location of wp-load.php so we have access to database and $wpdb object // $ip_address = input_validator($_POST['ipAddress']); $email = input_validator($_POST['email']); if (isset($_POST['password'])) { $password = input_validator($_POST['password']); } else { $password = ""; } // $ip_address = input_validator($_POST['ipAddress']); $email = input_validator($_POST['email']); if ($_POST['requestType'] == 'checkEmail') { if (email_exists($email)) { echo '-1'; // Email exist exit; } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) { echo "-2"; // Email incorrect exit; } else { echo "1"; // ok! exit; } } elseif (!$_POST['email'] or !$_POST['password']) {
?> <!DOCTYPE html> <html> <?php include_once 'include/head.ink.php'; ?> <body class="container"> <h2 style="text-align: center">Регистрация</h2> <form method="post" action="" class="col-md-4" style="margin: 0px auto; float: none;"> <input class="form-control" type="text" name="login" placeholder="Login" required> <input class="form-control" type="text" name="password" placeholder="Password" required> <input class="btn btn-success" type="submit" value="Registrate"> </form> </body> </html> <?php if ($_POST) { foreach ($_POST as $k => $v) { $_POST[$k] = input_validator($v); } if ($_POST['login'] == "" or $_POST['password'] == "") { exit; } if (add_user($link)) { $_SESSION['user'] = "******"; $_SESSION['login'] = $_POST['login']; header("Location: /work_23_03/index.php"); } else { echo "<h2 style='text-align: center'>Такой юзер уже зареган!</h2>"; } }