update
This commit is contained in:
19
index.php
19
index.php
@@ -5,28 +5,33 @@ $idcko = $_GET['id'];
|
||||
if (!empty($idcko)){
|
||||
|
||||
$ipcka = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
$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);
|
||||
|
||||
$alllog = "data/all.log";
|
||||
$pagepath = "data/pages/";
|
||||
|
||||
if(array_key_exists($idcko, $stranky)){
|
||||
|
||||
$entry = $stranky[$idcko];
|
||||
$logfile = $pagepath . $entry["logfile"];
|
||||
$contentfile = $pagepath . $entry["contentfile"];
|
||||
$content = $contents[$entry["contentid"]];
|
||||
$nickname = $entry["nickname"];
|
||||
$logmessage = "Success from $nickname(\"$idcko\"), IP: $ipcka\n";
|
||||
$logmessage = "Success from $linkname, IP: $ipcka\n";
|
||||
if (!array_key_exists($idcko, $logs)){
|
||||
$logs[$idcko] = [];
|
||||
}
|
||||
$logs[$idcko][] = array("action"=>"Success", "datetime"=>date("H:i:s d.m.Y"), "link"=>$idcko, "nickname"=>$nickname, "ip"=>$ipcka);
|
||||
|
||||
file_put_contents($logfile, $logmessage, FILE_APPEND);
|
||||
file_put_contents("data/logs.json", json_encode($logs, JSON_PRETTY_PRINT));
|
||||
file_put_contents($alllog, $logmessage, FILE_APPEND);
|
||||
|
||||
echo file_get_contents($contentfile);
|
||||
echo $content;
|
||||
|
||||
}
|
||||
|
||||
else{
|
||||
die("Bad link");
|
||||
file_put_contents($pagepath . $entry["logfile"], "Fail from \"$idcko\", IP: $ipcka\n", FILE_APPEND);
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
Reference in New Issue
Block a user