Actualizar 'index.php'

This commit is contained in:
Lucas 2021-04-09 17:11:51 +00:00
parent 2191f634b9
commit f1a2289474
2 changed files with 23 additions and 20 deletions

View File

@ -1,20 +0,0 @@
<?php include "blog_config.php"; if(isset($_GET["p"])){
function notfound($errno, $errstr) {
echo "Error!\nPost not found";
}
set_error_handler("notfound");
header("Content-type: text/plain");
echo $posts[$_GET["p"]][2];
} else {
header("Content-type: text/html");
echo "<!DOCTYPE html><html><head><title>$title</title></head><body style='font-family:monospace'><h1>$title</h1>"
$a=count($posts)-1;
$ao=0;
$next=$a+1;
while($ao < count($posts)){
if(strpos($posts[$r][1],"'")){$title=str_replace("'", "\\'", $posts[$a][1]);}else{$title=$posts[$a][1];}
echo "<p><a href='?p=$next'>$title</a><br>".$posts[$a][0]."</p><br>";
$a--; $ao++; $next--;
}
echo "<p><a href='https://tildegit.org/blog-soft'>Source code</a></p></body></html>";
} ?>

23
index.php Normal file
View File

@ -0,0 +1,23 @@
<?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="";}
$style="body{text-align:center;font-family:monospace;}p{font-size:large;}a#logo{color:black;text-decoration:none;}#article{text-align:left;margin:1px 30%;background:grey;font-size:large;}footer{margin:1em 0 0 0;}";
$footer="<footer>pwd by <a href='https://tildegit.org/lucas/logs'>~weblogs</a></footer></body></html>";
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;
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>";
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");
echo "<!DOCTYPE html><html><head><title>$title</title><style>$style</style>$custom_css</head><body><a id='logo' href='?'><h1>$title</h1></a>";
$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;
} ?>