Commit after ages. A lot of changes lol
This commit is contained in:
parent
9956c737cb
commit
a2b08e1000
14
admin.php
14
admin.php
|
@ -20,8 +20,8 @@ if(!isset($_SESSION["login"])) header("Location: /img/login.php");
|
|||
if ($handle = opendir($dir)) {
|
||||
while (false !== ($entry = readdir($handle))) {
|
||||
$x = pathinfo($entry,PATHINFO_EXTENSION);
|
||||
if ($x == "" && $entry != ".") {
|
||||
echo("<a href='/img/admin.php?l=$dir/$entry'>$entry</a><br/>\n");
|
||||
if ($x == "" && $entry != "." && $entry != "..") {
|
||||
echo("<a href='" . $BASE_PATH . "/admin.php?l=$dir/$entry'>$entry</a><br/>\n");
|
||||
}
|
||||
else if($x == "jpg" || $x == "jpeg" || $x == "png"){
|
||||
array_push($images, $entry);
|
||||
|
@ -35,10 +35,14 @@ if(!isset($_SESSION["login"])) header("Location: /img/login.php");
|
|||
exec($tmsu . "tags -1 '$dir/$img'", $output);
|
||||
$num_tags = sizeof($output);
|
||||
echo("<div style='float:left';>");
|
||||
echo("<img width='100px' src='/img/$dir/$img'/>");
|
||||
echo("<form><input type='text' value='");
|
||||
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("'/></form>");
|
||||
echo("'/>");
|
||||
|
||||
echo("<input type='hidden' name='l' value='" . $_GET["l"] . "'/>");
|
||||
echo("</form>");
|
||||
echo("</div>");
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
$tmsu = "tmsu -D drw/.tmsu/db ";
|
||||
|
||||
$BASE_ROUTE = "";
|
||||
|
||||
/* Exclude */
|
||||
|
||||
$exclude = "";
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<?php session_start(); ?>
|
||||
<style>
|
||||
body{
|
||||
background-color: black;
|
||||
|
@ -22,8 +21,20 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<div id="header">
|
||||
<?php
|
||||
if($_SESSION["login"] === true) echo "You are logged in - <a href='/img/logout.php'>logout</a>";
|
||||
else echo "<a href='/img/login.php'>Login</a>";
|
||||
//if($_SESSION["login"] === true) echo "You are logged in - <a href='/logout.php'>logout</a>";
|
||||
print("<a href='" . $BASE_PATH . "/'>Home</a> ");
|
||||
|
||||
if($_SESSION["login"] === true){
|
||||
echo "<a href='/logout.php'>logout</a>";
|
||||
|
||||
if($_SESSION["username"] == "admin"){
|
||||
print(" <a href='" . $BASE_PATH . "/admin.php'>Admin</a>");
|
||||
}
|
||||
}
|
||||
else{
|
||||
echo "<a href='/login.php'>Login</a>";
|
||||
}
|
||||
|
||||
?>
|
||||
<h1>Pòsweg's Suckless Booru</h1>
|
||||
<form method="GET" action="tag.php">
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?php session_start() ?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Pòsweg's image gallery</title>
|
||||
|
@ -12,12 +13,14 @@
|
|||
exec($tmsu . "tags", $output);
|
||||
$tag_num = sizeof($output);
|
||||
for($i = 0; $i < $tag_num; $i++){
|
||||
if($exclude !== ""){
|
||||
foreach($exclude as $excluded_tag){
|
||||
if($excluded_tag == $output[$i]){
|
||||
unset($output[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tag_num = sizeof($output);
|
||||
|
||||
|
|
12
login.php
12
login.php
|
@ -1,16 +1,20 @@
|
|||
<?php
|
||||
include("include/header.php");
|
||||
session_start();
|
||||
$errorMsg = "";
|
||||
$validUser = $_SESSION["login"] === true;
|
||||
$hash = "$2y$10\$AEErDtoqRrizUSS.uIlkDOcX/w3mAxCDo28QnfSNg9FTMC8eQVpeC";
|
||||
$hash = "$2y$10\$SfW2H/.Sb.MmnBJxs/svAuK7JGk7hL1GADG8tzj7h.AHApZWtuqYW";
|
||||
if(isset($_POST["sub"])) {
|
||||
$validUser = $_POST["username"] == "admin" && password_verify($_POST["password"], $hash);
|
||||
if(!$validUser) $errorMsg = "Invalid username or password.";
|
||||
else $_SESSION["login"] = true;
|
||||
else{
|
||||
$_SESSION["login"] = true;
|
||||
$_SESSION["username"] = $_POST["username"];
|
||||
}
|
||||
}
|
||||
if($validUser) {
|
||||
header("Location: /index.php"); die();
|
||||
}
|
||||
include("include/header.php");
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
@ -23,7 +27,7 @@ if($validUser) {
|
|||
<label for="username">Username:</label><input type="text" value="<?= $_POST["username"] ?>" id="username" name="username" /><br/>
|
||||
<label for="password">Password:</label><input type="password" value="" id="password" name="password" />
|
||||
<div class="error"><?= $errorMsg ?></div>
|
||||
<input type="submit" value="Home" name="sub" />
|
||||
<input type="submit" value="Login" name="sub" />
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
session_start();
|
||||
session_unset();
|
||||
session_destroy();
|
||||
header("Location: /img/index.php"); die();
|
||||
header("Location: " . $BASE_PATH . "/index.php"); die();
|
||||
?>
|
||||
|
|
5
tag.php
5
tag.php
|
@ -1,3 +1,4 @@
|
|||
<?php session_start() ?>
|
||||
<html>
|
||||
<head>
|
||||
<?php $thumb_size = 150; ?>
|
||||
|
@ -100,8 +101,8 @@
|
|||
else if($_GET["p"] + $num_page_selector > $num_pages) $lower_page_num = $num_pages - $num_page_selector*2;
|
||||
else $lower_page_num = $_GET["p"] - $num_page_selector;
|
||||
|
||||
if(!$_GET[p]) $_GET[p] = 1;
|
||||
$step = ($_GET[p] - 1) * $max;
|
||||
if(!$_GET["p"]) $_GET["p"] = 1;
|
||||
$step = ($_GET["p"] - 1) * $max;
|
||||
|
||||
$psb = "";
|
||||
|
||||
|
|
17
view.php
17
view.php
|
@ -13,16 +13,25 @@
|
|||
include("include/header.php");
|
||||
include("config.php");
|
||||
|
||||
exec($tmsu . "tags -1 \"" . $_GET["i"] . $excluded_query . "\"", $output);
|
||||
|
||||
// if($exclude !== ""){
|
||||
// foreach($exclude as $excluded_tag){
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
echo "<h1>Tag list</h1>";
|
||||
|
||||
echo "<img id=\"img\" src=\"/" . $_GET["i"] . "\">";
|
||||
|
||||
//Tag list
|
||||
echo "Tags:<br/>";
|
||||
exec($tmsu . "tags -1 \"" . $_GET["i"] . $excluded_query . "\"", $output);
|
||||
$num_tags = sizeof($output);
|
||||
for($i = 1; $i < $num_tags; $i++){
|
||||
echo("<a href='http://" . $_SERVER['HTTP_HOST'] . "/tag.php?t=" . $output[$i] . "'>" . $output[$i] ."</a><br/>");
|
||||
|
||||
echo "Tags(" . $num_tags . "):<br/>";
|
||||
unset($output[0]);
|
||||
foreach($output as $tag){
|
||||
echo("<a href='http://" . $_SERVER['HTTP_HOST'] . "/tag.php?t=" . $tag . "'>" . $tag ."</a><br/>");
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
|
|
Loading…
Reference in New Issue