tildeweblogs/index.php

24 lines
1.7 KiB
PHP
Raw Normal View History

2021-04-09 17:11:51 +00:00
<?php include "blog_config.php";
if($custom_css!=False){if(file_exists($custom_css)){$custom_css="<link rel='stylesheet' href='$custom_css'>";}else{$custom_css="";}}else{$custom_css="";}
2021-04-09 17:22:04 +00:00
$style="body{text-align:center;font-family:monospace;}p{font-size:large;}a#logo{color:black;text-decoration:none;}.notlogo{margin:5px 0 0 0;}#article{text-align:left;margin:1px 30%;background:grey;font-size:large;}footer{margin:1em 0 0 0;}";
$footer="</div><footer>pwd by <a href='https://tildegit.org/lucas/logs'>~weblogs</a></footer></body></html>";
2021-04-09 17:11:51 +00:00
if(isset($_GET["p"])){
function notfound($errno, $errstr){die("Error!\nPost not found");}
set_error_handler("notfound");
header("Content-type: text/html");
$post=$_GET["p"]-1;
2021-04-09 17:22:04 +00:00
echo "<!DOCTYPE html><html><head><!--~weblogs v1--><title>".$posts[$post][1]." | $title</title><style>$style</style>$custom_css</head><body><a id='logo' href='?'><h1>$title</h1></a><div class='notlogo'>";
2021-04-09 17:11:51 +00:00
if(strpos($posts[$post][1],"\n")){$html_log=str_replace("\n","<br>",$posts[$post][2]);}else{$html_log=$posts[$post][1];}
echo "<h1>".$posts[$post][1]."</h1>".$posts[$post][0]."<br><br><div id='article'>$html_log</div>";
echo $footer;
}else{
header("Content-type: text/html");
2021-04-09 17:22:04 +00:00
if($website!=False){$website="<p><a href='$website'>Website</a></p>";}else{$website="";}
echo "<!DOCTYPE html><html><head><title>$title</title><style>$style</style>$custom_css</head><body><a id='logo' href='?'><h1>$title</h1></a>$website<hr><div class='notlogo'>";
2021-04-09 17:11:51 +00:00
$a=count($posts)-1;$ao=0;$next=$a+1;
while($ao < count($posts)){
echo "<p><b><a href='?p=$next'>".$posts[$a][1]."</a></b> ".$posts[$a][0]."</p>";
$a--; $ao++; $next--;
}
echo $footer;
} ?>