32 lines
866 B
PHP
32 lines
866 B
PHP
|
<?php
|
||
|
//session_start();
|
||
|
header("Content-type: application/json; charset=utf-8");
|
||
|
date_default_timezone_set('Europe/Moscow');
|
||
|
|
||
|
if(isset($_GET['des'])){
|
||
|
include 'inc/_db.php';
|
||
|
include 'config.php';
|
||
|
include 'inc/functions.php';
|
||
|
$out=array();
|
||
|
$out['err']=1;
|
||
|
$out['msg']='';
|
||
|
$inputJSON = file_get_contents('php://input');
|
||
|
$input = json_decode($inputJSON, TRUE);
|
||
|
if($_GET['des']=='auth'){
|
||
|
$email = $input['email'];
|
||
|
$passw = $input['passw'];
|
||
|
$sql = 'SELECT id,fio,email FROM '.$ST['dbpf'].'_users WHERE email="'.$DB->rescape($email).'" AND pass="'.$DB->rescape($passw).'" AND status!=0 LIMIT 1';
|
||
|
$rez = $DB->QUR_SEL($sql);
|
||
|
if($rez){
|
||
|
$out['user']=$rez[1];
|
||
|
$out['err']=0;
|
||
|
$out['msg']='Ок';
|
||
|
}else{
|
||
|
$out['user']=array('id'=>0,'fio'=>'','email'=>'');
|
||
|
$out['err']=1;
|
||
|
$out['msg']='Ошибка';
|
||
|
}
|
||
|
}
|
||
|
echo json_encode($out);
|
||
|
exit();
|
||
|
}
|