denbooru-php/admin.php

51 lines
1.3 KiB
PHP
Raw Normal View History

2020-05-09 18:53:47 +00:00
<?php
session_start();
if(!isset($_SESSION["login"])) header("Location: /img/login.php");
?>
<html>
<head>
<title>Pòsweg's image gallery</title>
</head>
<body>
<?php
include("include/header.php");
include("config.php");
echo "<h2>Woah</h2>";
$images = array();
$dir = "drw";
if(isset($_GET["l"])) $dir = $_GET["l"];
if ($handle = opendir($dir)) {
while (false !== ($entry = readdir($handle))) {
$x = pathinfo($entry,PATHINFO_EXTENSION);
if ($x == "" && $entry != "." && $entry != "..") {
echo("<a href='" . $BASE_PATH . "/admin.php?l=$dir/$entry'>$entry</a><br/>\n");
2020-05-09 18:53:47 +00:00
}
else if($x == "jpg" || $x == "jpeg" || $x == "png"){
array_push($images, $entry);
}
}
closedir($handle);
}
foreach($images as $img){
$output = "";
exec($tmsu . "tags -1 '$dir/$img'", $output);
$num_tags = sizeof($output);
echo("<div style='float:left';>");
echo("<img width='100px' src='" . $BASE_PATH . "/$dir/$img'/>");
echo("<form action='admin.php'>");
echo("<input type='text' name='tags[" . $img . "]' value='");
for($i = 1; $i < $num_tags; $i++) echo $output[$i] . " ";
echo("'/>");
echo("<input type='hidden' name='l' value='" . $_GET["l"] . "'/>");
echo("</form>");
2020-05-09 18:53:47 +00:00
echo("</div>");
}
?>
</body>
</html>