add some failsafes
This commit is contained in:
10
index.php
10
index.php
@@ -10,6 +10,14 @@ if (!empty($idcko)){
|
||||
file_put_contents("data/logs.json", "{}");
|
||||
}
|
||||
|
||||
if(!file_exists("data/pageindex.json")){
|
||||
file_put_contents("data/pageindex.json", "{}");
|
||||
}
|
||||
|
||||
if(!file_exists("data/contents.json")){
|
||||
file_put_contents("data/contents.json", "{}");
|
||||
}
|
||||
|
||||
$stranky = json_decode(file_get_contents("data/pageindex.json"), true);
|
||||
$contents = json_decode(file_get_contents("data/contents.json"), true);
|
||||
$logs = json_decode(file_get_contents("data/logs.json"), true);
|
||||
@@ -20,7 +28,7 @@ if (!empty($idcko)){
|
||||
if(array_key_exists($idcko, $stranky)){
|
||||
|
||||
$entry = $stranky[$idcko];
|
||||
|
||||
|
||||
if (!array_key_exists($entry["contentid"], $contents)){
|
||||
die("Faulty link");
|
||||
}
|
||||
|
Reference in New Issue
Block a user