2018-09-17 10:07:32 +03:00
|
|
|
<?php
|
|
|
|
header("Content-Type: text/plain; charset=UTF-8");
|
|
|
|
|
|
|
|
// Verify login and password
|
|
|
|
$login = $_GET['login'];
|
|
|
|
$password = $_GET['password'];
|
|
|
|
if(empty($login) || empty($password)) {
|
2018-11-05 12:50:46 +03:00
|
|
|
exit('Введены неверные данные');
|
2018-09-17 10:07:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Load IPB core
|
|
|
|
define('IPB_THIS_SCRIPT', 'public');
|
2018-11-05 12:50:46 +03:00
|
|
|
require('initdata.php'); // not once!!!
|
2018-09-17 10:07:32 +03:00
|
|
|
require_once(IPS_ROOT_PATH . 'sources/base/ipsRegistry.php');
|
|
|
|
$reg = ipsRegistry::instance();
|
|
|
|
$reg->init();
|
|
|
|
|
|
|
|
// Resolve member by login
|
|
|
|
$member = IPSMember::load(IPSText::parseCleanValue($login), 'all', 'username');
|
|
|
|
$member_id = $member['member_id'];
|
|
|
|
if (!$member_id) {
|
2018-11-05 12:50:46 +03:00
|
|
|
exit('Введены неверные данные');
|
2018-09-17 10:07:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Try authenticate
|
|
|
|
$success = IPSMember::authenticateMember($member_id, md5(IPSText::parseCleanValue($password)));
|
2018-11-05 12:50:46 +03:00
|
|
|
echo($success ? 'OK:' . $member['name'] : 'Ошибка при авторизации');
|
2018-09-17 10:07:32 +03:00
|
|
|
?>
|