<?php
defined(
'COT_CODE'
)
or
die
(
'Wrong URL'
);
global
$db_users
,
$db
;
include_once
cot_incfile(
"users"
,
"module"
);
$a
= cot_import(
'a'
,
'G'
,
'TXT'
);
$m
= cot_import(
"m"
,
"G"
,
"TXT"
);
$login
= cot_import(
"login"
,
"G"
,
"TXT"
);
$email
= cot_import(
"email"
,
"G"
,
"TXT"
);
$data
[
"success"
] = false;
if
(
$a
==
"checklogin"
) {
$user_exists
= (bool)cot::
$db
->query(
"SELECT user_id FROM "
.cot::
$db
->users.
" WHERE user_name = ? LIMIT 1"
,
array
(
$login
))->fetch();
$data
[
"text"
] =
$data
[
"user_exists"
] =
$user_exists
;
print
json_encode(
$data
);
}
if
(
$a
==
"checkemail"
) {
$email_exists
= (bool)cot::
$db
->query(
"SELECT user_id FROM "
.cot::
$db
->users.
" WHERE user_email = ? LIMIT 1"
,
array
(
$email
))->fetch();
$data
[
"text"
] =
$data
[
"email_exists"
] =
$email_exists
;
print
json_encode(
$data
);
}