date_default_timezone_set('UTC+5');
session_start();
// user.json
$fileUser = '../data/user.json';
$jsonUser = file_get_contents($fileUser);
$jsonFileUser = json_decode($jsonUser, true);
if ($jsonFileUser[$_SESSION['email']]){
if ($_GET['production']){
$production = "Производственные нужды, ";
}
else{
$production = "";
}
if ($_GET['FoodPreparation']){
$foodPreparation = "Пищеприготовление, ";
}
else{
$foodPreparation = "";
}
if ($_GET['HotWater']){
$HotWater = "Горячее водоснабжение, ";
}
else{
$HotWater = "";
}
if ($_GET['Heating']){
$Heating = "Отопление, ";
}
else{
$Heating = "";
}
if ($_GET['Ventilation'] == "true"){
$Ventilation = "Вентиляция";
}
else{
$Ventilation = "";
}
$content = [
"4" => [
"name_order" => "Получение разрешения на строительство",
"date" => date("d.m.y"),
"order_id" => "1",
"step" => "2",
"answer_status" => "received",
"performed" => "true",
"inquiry" => [
"object_address" => $_GET['adress'],
"cad_number" => $_GET['cdn'],
"name_obejct" => $_GET['name_object'],
"floors" => $_GET['floors'],
"commissioning" => $_GET['date_eks'],
"electric" => $_GET['energo_volume'],
"water" => $_GET['water_type'],
"firefighting" => $_GET['firefighting'],
"consumption" => "firefighting_max",
"directions_of_gas" =>
$production .
$foodPreparation .
$HotWater .
$Heating .
$Ventilation,
]
]
];
$jsonFileUser[$_SESSION['email']]["orders"][] = $content;
$contentJson = json_encode($jsonFileUser);
file_put_contents($fileUser,$contentJson);
echo $contentJson;
}
else{
echo 'Avtoriziruisya, suka';
}
Вентиляция : Array ( [365] => Array ( [id] => 365 [name_order] => Получение разрешения на строительство [date] => 24.10.18 [order_id] => 1 [step] => 2 [answer_status] => received [performed] => true [inquiry] => Array ( [object_address] => asd [cad_number] => 12:12:3123123:123 [name_obejct] => BoilerRoom [floors] => 123 [commissioning] => 0333-03-12 [electric] => MoreHundredFifty [water] => waterSupply [firefighting] => 123 [consumption] => firefighting_max [directions_of_gas] => Горячее водоснабжение, Отопление, ) ) )
$jsonFileUser[$_SESSION['email']]["orders"][]=$content;
print_r($jsonFileUser[$_SESSION['email']]["orders"]);
Вентиляция : Array ( [212] => Array ( [id] => 212 [name_order] => Получение разрешения на строительство [date] => 23.10.18 [order_id] => 1 [step] => 2 [answer_status] => received [performed] => true [inquiry] => Array ( [object_address] => [cad_number] => [name_obejct] => [floors] => [commissioning] => [electric] => [water] => [firefighting] => [consumption] => firefighting_max [directions_of_gas] => ) ) [213] => Array ( [498] => Array ( [id] => 498 [name_order] => Получение разрешения на строительство [date] => 24.10.18 [order_id] => 1 [step] => 2 [answer_status] => received [performed] => true [inquiry] => Array ( [object_address] => asd [cad_number] => 12:12:3123123:123 [name_obejct] => BoilerRoom [floors] => 123 [commissioning] => 0333-03-12 [electric] => MoreHundredFifty [water] => waterSupply [firefighting] => 123 [consumption] => firefighting_max [directions_of_gas] => Горячее водоснабжение, Отопление, ) ) ) [214] => Array ( [233] => Array ( [id] => 233 [name_order] => Получение разрешения на строительство [date] => 24.10.18 [order_id] => 1 [step] => 2 [answer_status] => received [performed] => true [inquiry] => Array ( [object_address] => asd [cad_number] => 12:12:3123123:123 [name_obejct] => BoilerRoom [floors] => 123 [commissioning] => 0333-03-12 [electric] => MoreHundredFifty [water] => waterSupply [firefighting] => 123 [consumption] => firefighting_max [directions_of_gas] => Горячее водоснабжение, Отопление, ) ) ) [215] => Array ( [360] => Array ( [id] => 360 [name_order] => Получение разрешения на строительство [date] => 24.10.18 [order_id] => 1 [step] => 2 [answer_status] => received [performed] => true [inquiry] => Array ( [object_address] => asd [cad_number] => 12:12:3123123:123 [name_obejct] => BoilerRoom [floors] => 123 [commissioning] => 0333-03-12 [electric] => MoreHundredFifty [water] => waterSupply [firefighting] => 123 [consumption] => firefighting_max [directions_of_gas] => Горячее водоснабжение, Отопление, ) ) ) [216] => Array ( [160] => Array ( [id] => 160 [name_order] => Получение разрешения на строительство [date] => 24.10.18 [order_id] => 1 [step] => 2 [answer_status] => received [performed] => true [inquiry] => Array ( [object_address] => asd [cad_number] => 12:12:3123123:123 [name_obejct] => BoilerRoom [floors] => 123 [commissioning] => 0333-03-12 [electric] => MoreHundredFifty [water] => waterSupply [firefighting] => 123 [consumption] => firefighting_max [directions_of_gas] => Горячее водоснабжение, Отопление, ) ) ) )
{
"email@mail.ru":{
"name":"\u0412\u0438\u043a\u0442\u043e\u0440",
"secname":"\u041a\u043e\u0442\u043e\u0432",
"order":"true",
"orders":{
"212":{
"id":212,
"name_order":"\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e",
"date":"23.10.18",
"order_id":"1",
"step":"2",
"answer_status":"received",
"performed":"true",
"inquiry":{
"object_address":null,
"cad_number":null,
"name_obejct":null,
"floors":null,
"commissioning":null,
"electric":null,
"water":null,
"firefighting":null,
"consumption":"firefighting_max",
"directions_of_gas":""
}
},
"213":{
"453":{
"id":453,
"name_order":"\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e",
"date":"24.10.18",
"order_id":"1",
"step":"2",
"answer_status":"received",
"performed":"true",
"inquiry":{
"object_address":"asd",
"cad_number":"12:12:3123123:123",
"name_obejct":"BoilerRoom",
"floors":"123",
"commissioning":"0333-03-12",
"electric":"MoreHundredFifty",
"water":"waterSupply",
"firefighting":"123",
"consumption":"firefighting_max",
"directions_of_gas":"\u0413\u043e\u0440\u044f\u0447\u0435\u0435 \u0432\u043e\u0434\u043e\u0441\u043d\u0430\u0431\u0436\u0435\u043d\u0438\u0435, \u041e\u0442\u043e\u043f\u043b\u0435\u043d\u0438\u0435, "
}
}
},
"214":{
"226":{
"id":226,
"name_order":"\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e",
"date":"24.10.18",
"order_id":"1",
"step":"2",
"answer_status":"received",
"performed":"true",
"inquiry":{
"object_address":"asd",
"cad_number":"12:12:3123123:123",
"name_obejct":"BoilerRoom",
"floors":"123",
"commissioning":"0333-03-12",
"electric":"MoreHundredFifty",
"water":"waterSupply",
"firefighting":"123",
"consumption":"firefighting_max",
"directions_of_gas":"\u0413\u043e\u0440\u044f\u0447\u0435\u0435 \u0432\u043e\u0434\u043e\u0441\u043d\u0430\u0431\u0436\u0435\u043d\u0438\u0435, \u041e\u0442\u043e\u043f\u043b\u0435\u043d\u0438\u0435, "
}
}
},
"215":{
"104":{
"id":104,
"name_order":"\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e",
"date":"24.10.18",
"order_id":"1",
"step":"2",
"answer_status":"received",
"performed":"true",
"inquiry":{
"object_address":"asd",
"cad_number":"12:12:3123123:123",
"name_obejct":"BoilerRoom",
"floors":"123",
"commissioning":"0333-03-12",
"electric":"MoreHundredFifty",
"water":"waterSupply",
"firefighting":"123",
"consumption":"firefighting_max",
"directions_of_gas":"\u0413\u043e\u0440\u044f\u0447\u0435\u0435 \u0432\u043e\u0434\u043e\u0441\u043d\u0430\u0431\u0436\u0435\u043d\u0438\u0435, \u041e\u0442\u043e\u043f\u043b\u0435\u043d\u0438\u0435, "
}
}
},
"420":{
"420":{
"id":420,
"name_order":"\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e",
"date":"24.10.18",
"order_id":"1",
"step":"2",
"answer_status":"received",
"performed":"true",
"inquiry":{
"object_address":"asd",
"cad_number":"12:12:3123123:123",
"name_obejct":"BoilerRoom",
"floors":"123",
"commissioning":"0333-03-12",
"electric":"MoreHundredFifty",
"water":"waterSupply",
"firefighting":"123",
"consumption":"firefighting_max",
"directions_of_gas":"\u0413\u043e\u0440\u044f\u0447\u0435\u0435 \u0432\u043e\u0434\u043e\u0441\u043d\u0430\u0431\u0436\u0435\u043d\u0438\u0435, \u041e\u0442\u043e\u043f\u043b\u0435\u043d\u0438\u0435, "
}
}
},
"100":{
"100":{
"id":100,
"name_order":"\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e",
"date":"24.10.18",
"order_id":"1",
"step":"2",
"answer_status":"received",
"performed":"true",
"inquiry":{
"object_address":"asd",
"cad_number":"12:12:3123123:123",
"name_obejct":"BoilerRoom",
"floors":"123",
"commissioning":"0333-03-12",
"electric":"MoreHundredFifty",
"water":"waterSupply",
"firefighting":"123",
"consumption":"firefighting_max",
"directions_of_gas":"\u0413\u043e\u0440\u044f\u0447\u0435\u0435 \u0432\u043e\u0434\u043e\u0441\u043d\u0430\u0431\u0436\u0435\u043d\u0438\u0435, \u041e\u0442\u043e\u043f\u043b\u0435\u043d\u0438\u0435, "
}
}
},
"224":{
"224":{
"id":224,
"name_order":"\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e",
"date":"24.10.18",
"order_id":"1",
"step":"2",
"answer_status":"received",
"performed":"true",
"inquiry":{
"object_address":"asd",
"cad_number":"12:12:3123123:123",
"name_obejct":"BoilerRoom",
"floors":"123",
"commissioning":"0333-03-12",
"electric":"MoreHundredFifty",
"water":"waterSupply",
"firefighting":"123",
"consumption":"firefighting_max",
"directions_of_gas":"\u0413\u043e\u0440\u044f\u0447\u0435\u0435 \u0432\u043e\u0434\u043e\u0441\u043d\u0430\u0431\u0436\u0435\u043d\u0438\u0435, \u041e\u0442\u043e\u043f\u043b\u0435\u043d\u0438\u0435, "
}
}
}
}
}
}