Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- var working = false;
- var $this = $('#login');
- var $state = $this.find('button > .state');
- var login_button_text = '<i class="fa fa-sign-in"></i> Login';
- $(function () {
- $('#login').ajaxForm({
- url: 'https://ghender.com/requests.php?f=login',
- beforeSend: function () {
- working = true;
- $this.addClass('loading');
- $state.html('autenticação');
- },
- success: function (data) {
- console.log(data);
- if (data.status == 200 || data.status == 600) {
- $this.addClass('ok');
- $state.html('Bem vindo de volta!');
- setTimeout(function () {
- window.location.href = "https://ghender.com";
- //window.location.href = data.location;
- }, 1000);
- } else {
- var errors = data.errors.join("<br>");
- $state.html(login_button_text);
- $this.removeClass('ok loading', function () {
- $state.html(errors);
- });
- }
- working = false;
- }
- });
- $('#login input').on('click', function (e) {
- $state.html(login_button_text);
- });
- });
- if ($f == 'login') {
- $data_ = array();
- $phone = 0;
- if (isset($_POST['username']) && isset($_POST['password'])) {
- $username = Wo_Secure($_POST['username']);
- $password = Wo_Secure($_POST['password']);
- $result = Wo_Login($username, $password);
- if ($result === false) {
- $errors[] = $error_icon . $wo['lang']['incorrect_username_or_password_label'];
- } else if (Wo_UserInactive($_POST['username']) === true) {
- $errors[] = $error_icon . $wo['lang']['account_disbaled_contanct_admin_label'];
- } else if (Wo_UserActive($_POST['username']) === false) {
- $_SESSION['code_id'] = Wo_UserIdForLogin($username);
- $data_ = array(
- 'status' => 600,
- 'location' => Wo_SeoLink('index.php?link1=user-activation')
- );
- $phone = 1;
- }
- if (empty($errors) && $phone == 0) {
- $userid = Wo_UserIdForLogin($username);
- $ip = Wo_Secure(get_ip_address());
- $update = mysqli_query($sqlConnect, "UPDATE " . T_USERS . " SET `ip_address` = '{$ip}' WHERE `user_id` = '{$userid}'");
- $session = Wo_CreateLoginSession(Wo_UserIdForLogin($username));
- $_SESSION['user_id'] = $session;
- setcookie(
- "user_id", $session, time() + (10 * 365 * 24 * 60 * 60)
- );
- $data = array(
- 'status' => 200
- );
- if (!empty($_POST['last_url'])) {
- $data['location'] = $_POST['last_url'];
- } else {
- $data['location'] = $wo['config']['site_url'];
- }
- }
- }
- header("Content-type: application/json");
- if (!empty($errors)) {
- echo json_encode(array(
- 'errors' => $errors
- ));
- } else if (!empty($data_)) {
- echo json_encode($data_);
- } else {
- echo json_encode($data);
- }
- exit();
Add Comment
Please, Sign In to add comment