MiXeR54 Posted July 26, 2019 Share Posted July 26, 2019 Суть: есть скрипт на авторизацию в удаленном приложении. <?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? Может кто откликнется за денежку. Открыт к предложениям. Quote Link to comment Share on other sites More sharing options...
WaNted Posted July 27, 2019 Share Posted July 27, 2019 if ( !\IPS\Db::i()->select( 'COUNT(*)', 'core_validating', array( 'member_id=? AND lost_pass!=1 AND forgot_security!=1', $member->member_id ) )->first() ) { // Подтвердил } Quote Link to comment Share on other sites More sharing options...
MiXeR54 Posted July 29, 2019 Author Share Posted July 29, 2019 В 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 толи еще что. Quote Link to comment Share on other sites More sharing options...
WaNted Posted July 31, 2019 Share Posted July 31, 2019 Вы же уже подключили init.php, этого достаточно. Quote Link to comment Share on other sites More sharing options...
MiXeR54 Posted July 31, 2019 Author Share Posted July 31, 2019 8 минут назад, WaNted сказал: Вы же уже подключили init.php, этого достаточно. Да. Только что допилил, я почему то решил что first(); мне не нужен и в этом была ошибка. Спасибо за помощь. Вопрос решен. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.