Файл: public_html/fetch.php
Строк: 43
<?php
define('BASE_DIR', $_SERVER['DOCUMENT_ROOT']);
define('TIME', time());
require_once(BASE_DIR.'/inc/init.php');
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']))
{
if (isset($_POST['mode']))
{
switch ($_POST['mode'])
{
case 'count_domains':
$wapids = (int)$_POST['wapids'];
$login = filter_var($_POST['login'], FILTER_SANITIZE_STRING);
$url = filter_var($_POST['url'], FILTER_VALIDATE_URL);
if (($wapids != 1 && $wapids != 2) || !$login || !$url) exit('1000');
$query = $mysqli->query("SELECT `id` FROM `".PREFIX."_block` WHERE `type` = '".$wapids."' and `login` = '".$login."' and `url` = '".$url."' LIMIT 1");
if ($query->num_rows)
{
exit($query->num_rows);
}
break;
case 'check_auth':
if (isset($_POST['login']) && isset($_POST['pass']))
{
$login = filter_var($_POST['login'], FILTER_SANITIZE_STRING);
$query = $mysqli->query("SELECT `id`, `password` FROM `".PREFIX."_users` WHERE `login` = '".$login."' LIMIT 1");
if (!$query->num_rows)
{
exit('wrong');
}
else
{
$res = $query->fetch_assoc();
$pass = filter_var(base64_decode($_POST['pass']), FILTER_SANITIZE_STRING);
if (md5(md5($pass.HASH_MD5)) != $res['password'])
{
exit('wrong');
}
}
}
break;
//проверяем логин
case 'check_login':
if (isset($_POST['login']))
{
$login = filter_var($_POST['login'], FILTER_SANITIZE_STRING);
$query = $mysqli->query("SELECT id FROM `".PREFIX."_users` WHERE `login` = '".$login."' LIMIT 1");
if ($query->num_rows)
{
exit('taken');
}
else
{
exit('free');
}
}
break;
//проверяем e-mail
case 'check_email':
if (isset($_POST['email']))
{
$email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL);
$query = $mysqli->query("SELECT id FROM `".PREFIX."_users` WHERE `email` = '".$email."' LIMIT 1");
if ($query->num_rows)
{
exit('taken');
}
else
{
exit('free');
}
}
break;
//проверяем e-mail
case 'check_pair':
if (isset($_POST['email']))
{
$email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL);
$query = $mysqli->query("SELECT id FROM `".PREFIX."_users` WHERE `email` = '".$email."' and `login` != '".$users_info['login']."' LIMIT 1");
if ($query->num_rows)
{
exit('taken');
}
}
break;
//проверяем капчу
case 'check_captcha':
if (isset($_POST['captcha']))
{
if ($_POST['captcha'] == $_SESSION['image_captcha'])
{
exit();
}
}
exit('captcha_wrong');
break;
default:
break;
}
}
}