add user api

This commit is contained in:
Ben Harris 2018-01-29 13:52:57 -05:00
parent 34b4f772ef
commit 34ce59895d
1 changed files with 12 additions and 1 deletions

View File

@ -19,12 +19,23 @@ elseif (isset($_GET["fonts"])) { // get list of fonts
elseif (isset($_GET["text"])) { // run figlet
echo shell_exec(
"/usr/bin/figlet -d $fonts -w 140 -f " .
"/usr/bin/figlet -d $fonts -w 120 -f " .
escapeshellarg($_GET["font"] ?? "standard") . " " .
escapeshellarg($_GET["text"])
);
}
elseif (isset($_GET["users"])) {
$users = [];
foreach (scandir("/home") as $user) {
if (is_dir("/home/$user/public_html")
&& isset($_GET["pub"])
&& $_GET["pub"] != "false") continue;
$users[] = $user;
}
echo json_encode($users);
}
else { // get a random tagline
echo $tags[array_rand($tags)];
}