EIOS/json_new.php

48 lines
1.7 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';
if(isset($_POST['ajdes'])) {
$out = array();
if ($_POST['ajdes'] == 'notes_add_show') {//Подгружаем форму добавления заметок
if (isset($_SESSION['user'])) {
include_once 'inc/class_NOTE.php';
$class = new class_NOTE();
$html = $class->addHTML();
$out = $html;
$out['err'] = 0;
}
}
if ($_POST['ajdes'] == 'notes_add') {//Добавляем и подгружаем заметки пользователя
if (isset($_SESSION['user'])) {
include_once 'inc/class_NOTE.php';
$class = new class_NOTE();
$class->add($_POST);
$filter['order'] = ' data_c DESC';
$filter['limit']['start'] = 0;
$filter['limit']['step'] = 5;
$html = $class->itemsHTML($filter);
$out = $html;
$out['err'] = 0;
}
}
if ($_POST['ajdes'] == 'notes_show') {//Подгружаем заметки пользователя
if (isset($_SESSION['user'])) {
include_once 'inc/class_NOTE.php';
$class = new class_NOTE();
$filter['order'] = ' data_c DESC';
$filter['limit']['start'] = 0;
$filter['limit']['step'] = 5;
$html = $class->itemsHTML($filter);
$out = $html;
$out['err'] = 0;
}
}
echo json_encode($out);
exit();
}