39 lines
960 B
PHP
Executable File
39 lines
960 B
PHP
Executable File
<?php
|
|
|
|
print_r($_POST);
|
|
|
|
switch(@$_POST['act']) {
|
|
|
|
|
|
// Сохранение настроек модуля
|
|
case 'save_settings_mod':
|
|
$res['mod']=$_POST['mod'];
|
|
unset ($_POST['mod']);
|
|
unset($_POST['act']);
|
|
$res['json']=json_encode($_POST, JSON_UNESCAPED_UNICODE);
|
|
$db->free_sql2 ( "UPDATE `settings` SET `json`='" . $res['json'] . "' WHERE `mod`='" . $res['mod'] . "'" );
|
|
break;
|
|
|
|
|
|
|
|
// чтение настроек
|
|
case 'get_settings':
|
|
|
|
$db->free_sql2 ( "ALTER TABLE `settings` ADD `json` text COLLATE 'utf8_general_ci' NULL;");
|
|
//берем данные
|
|
unset($a);
|
|
$a['mod']=$_POST['mod'];
|
|
$massiv=$db->get_massiv('settings', $a, '', 1);
|
|
if ($massiv[0]['json'])
|
|
echo $massiv[0]['json'];
|
|
else
|
|
$db->free_sql2 ( "insert into `settings` (`mod`) VALUES ('" . $_POST['mod'] . "')");
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
}
|
|
?>
|