Jump to content
View in the app

A better way to browse. Learn more.

IPBMafia.ru - поддержка Invision Community, релизы, темы, плагины и приложения

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Авторизация подтвержденным юзером PHP

Featured Replies

Posted

Суть:

есть скрипт на авторизацию в удаленном приложении. 

<?php
header("Content-Type: text/plain; charset=UTF-8");

// Verify login and password
$login = $_GET['login'];
$password = $_GET['password'];
if(empty($login) || empty($password)) {
    exit('Empty login or password');
}

// Load IPB init script
\define('REPORT_EXCEPTIONS', TRUE);
$_SERVER['SCRIPT_FILENAME']	= __FILE__;
require_once 'init.php';

// Try authenticate
$member = NULL;
$ipsLogin = new \IPS\Login();
foreach($ipsLogin->usernamePasswordMethods() as $method) {
    try {
        $member = $method->authenticateUsernamePassword($ipsLogin, $login, $password);
        \IPS\Login::checkIfAccountIsLocked($member, TRUE);
        if ($member->isBanned()) {
            $member = NULL;
            continue;
        }
        break;
    } catch (\Exception $e) {
        // Do nothing
    }
}

// We're done
echo($member ? 'OK:' . $member->name : 'Incorrect login or password');
?>

работает чудесно, но как добавить проверку - подтвердил ли пользователь свой email?

Может кто откликнется за денежку. Открыт к предложениям.

  • Author
В 27.07.2019 в 11:47, WaNted сказал:

if ( !\IPS\Db::i()->select( 'COUNT(*)', 'core_validating', array( 'member_id=? AND lost_pass!=1 AND forgot_security!=1', $member->member_id ) )->first() )
{
	// Подтвердил
}

 

не могли бы поделиться остальной частью кода? разобраться не могу, толи как то надо подключить \IPS\Db толи еще что.

  • Author
8 минут назад, WaNted сказал:

Вы же уже подключили init.php, этого достаточно.

Да. Только что допилил, я почему то решил что first(); мне не нужен и в этом была ошибка. Спасибо за помощь. Вопрос решен.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Ответить в этой теме...

Последние посетители 0

  • No registered users viewing this page.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.