simplify glob loop and add htmlspecialchars()

This commit is contained in:
Ben Harris 2021-03-16 21:35:04 -04:00
parent 36ddf8b7a6
commit cf04720d67
1 changed files with 4 additions and 6 deletions

View File

@ -14,13 +14,11 @@
<h1>taglines</h1>
<p>create a oneline ~/public_html/tagline.txt to appear here</p>
<hr>
<?php foreach (glob("/home/*") as $user) {
$user = basename($user);
$tagline = "/home/$user/public_html/tagline.txt";
if (!is_file($tagline)) continue;
$tag = strip_tags(file_get_contents($tagline));
<?php foreach (glob("/home/*/public_html/tagline.txt") as $tagline) {
$user = basename(dirname(dirname($tagline)));
$tag = file_get_contents($tagline);
?>
<p><a href="/~<?=$user?>/"><strong>~<?=$user?></strong></a> - <?=$tag?></p>
<p><a href="/~<?=$user?>/"><strong>~<?=$user?></strong></a> - <?=htmlspecialchars($tag)?></p>
<?php } ?>
</div>