404 error if file not found or no title provided
This commit is contained in:
parent
40a0a574a9
commit
2ba071e361
8
note.php
8
note.php
|
@ -48,7 +48,7 @@
|
||||||
// main
|
// main
|
||||||
|
|
||||||
$title = '';
|
$title = '';
|
||||||
$content = '';
|
$content = false;
|
||||||
if (isset($_GET['new']))
|
if (isset($_GET['new']))
|
||||||
{
|
{
|
||||||
$now = date("Y-m-d H.i.s", time());
|
$now = date("Y-m-d H.i.s", time());
|
||||||
|
@ -62,6 +62,12 @@
|
||||||
$content = file_get_contents($dir . '/' . $title . '.md');
|
$content = file_get_contents($dir . '/' . $title . '.md');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$content)
|
||||||
|
{
|
||||||
|
http_response_code(404);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
$lastchanged = filemtime($dir . '/' . $title . '.md');
|
$lastchanged = filemtime($dir . '/' . $title . '.md');
|
||||||
$lines = substr_count($content, "\r\n");
|
$lines = substr_count($content, "\r\n");
|
||||||
|
|
Loading…
Reference in New Issue