EIOS/api_loc.php

48 lines
1.9 KiB
PHP
Raw Permalink Normal View History

2023-12-28 15:39:22 +03:00
<?php
error_reporting(1);
session_start();
header('Content-Type: application/json; charset=utf-8');
date_default_timezone_set('Europe/Moscow');
include 'inc/_db.php';
include 'config.php';
include 'inc/functions.php';
//include 'inc/class_SECUR.php';
$step = ''; if(isset($_GET['step'])) $step = $_GET['step'];
if($step=='stipendii_get'){
include_once 'inc/grant.php';
$data['facultet'] = ''; if(isset($_GET['facultet'])) $data['facultet'] = $_GET['facultet'];
$data['year_start'] = ''; if(isset($_GET['year_start'])) $data['year_start'] = $_GET['year_start'];
$data['semestr'] = ''; if(isset($_GET['semestr'])) $data['semestr'] = $_GET['semestr'];
$stip = get_presentation($data);
echo json_encode($stip,JSON_UNESCAPED_UNICODE);
exit();
}
if($step=='fio_email2'){
if(isset($_GET['fio2'])) {
$fio2 = urldecode($_GET['fio2']);
$sql = 'SELECT id,email,phone FROM acs_users WHERE fio="'.$DB->rescape($fio2).'"';
$rez = $DB->QUR_SEL($sql);
if($rez){
foreach($rez as $k => $v)if($k!=0){
$sql1 = 'SELECT id FROM acs_teachers WHERE id_user=' . $v['id'] . '';
$rez1 = $DB->QUR_SEL($sql1);
if ($rez1) {
$rez[$k]['is_teacher'] = 1;
} else {
$rez[$k]['is_teacher'] = 0;
$sql1 = 'SELECT gr.sokr FROM acs_students as st, acs_grupp as gr WHERE st.id_user=' . $v['id'] . ' AND st.id_grupp=gr.id';
$rez1 = $DB->QUR_SEL($sql1);
if ($rez1) {
$tmp = explode('-',$rez1[1]['sokr']);
$rez[$k]['gruppa'] = $rez1[1]['sokr'];
$rez[$k]['kurs'] = mb_substr($tmp[1],0,1);
}
}
}
echo json_encode($rez,JSON_UNESCAPED_UNICODE);
}
}
exit();
}