Update submodule
This commit is contained in:
parent
4e8ea87220
commit
579ea26d06
|
@ -1,3 +1,6 @@
|
||||||
[submodule "themes/readable"]
|
[submodule "themes/readable"]
|
||||||
path = themes/readable
|
path = themes/readable
|
||||||
url = https://git.fbievan.live/fbievan/hugo-theme-readable
|
url = https://git.fbievan.live/fbievan/hugo-theme-readable
|
||||||
|
[submodule "static/guestbook"]
|
||||||
|
path = static/guestbook
|
||||||
|
url = https://git.fbievan.live/fbievan/guestbook.git
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 3c7bd7aa909519d9b927a8053b135b5305a91de1
|
|
@ -1,21 +0,0 @@
|
||||||
.guestbookpost {
|
|
||||||
padding: 10px;
|
|
||||||
border: var(--line-width) solid;
|
|
||||||
border-left-style: none;
|
|
||||||
border-right-style: none;
|
|
||||||
border-top-style: solid;
|
|
||||||
border-bottom-style: none;
|
|
||||||
text-align: left;
|
|
||||||
padding-bottom: 20px;
|
|
||||||
padding-top: 10px;
|
|
||||||
}
|
|
||||||
.date {
|
|
||||||
padding-top: 0px;
|
|
||||||
padding-bottom: 15px;
|
|
||||||
}
|
|
||||||
h4 {
|
|
||||||
margin-top: 0px;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
padding-left: 4px;
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>My Cool Guestbook!</title>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/css/readable.min.css?v=v1.1.0">
|
|
||||||
<link rel="stylesheet" href="./guestbook.css"</link>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<header>
|
|
||||||
<h1>Guestbook</h1>
|
|
||||||
<p>This is a guestbook, made by fbievan</p>
|
|
||||||
</header>
|
|
||||||
<nav>
|
|
||||||
<a href="../index.html">Back Home</a>
|
|
||||||
</nav>
|
|
||||||
<main>
|
|
||||||
<form action="./submit.php" method="post">
|
|
||||||
<input type="text" name="fname" placeholder="name"></input>
|
|
||||||
<input type="text" name="fmessage" placeholder="Message"></input>
|
|
||||||
<input type="submit"></input>
|
|
||||||
</form>
|
|
||||||
<?php
|
|
||||||
$data = json_decode(file_get_contents('test.json'), true);
|
|
||||||
echo "<div>";
|
|
||||||
foreach($data as $post) {
|
|
||||||
echo '<section class="guestbookpost">';
|
|
||||||
echo "<h4>";
|
|
||||||
echo $post["name"] . "<br>";
|
|
||||||
echo "</h4>";
|
|
||||||
echo '<h4 class="date">';
|
|
||||||
echo $post["date"] . "<br>";
|
|
||||||
echo "</h4>";
|
|
||||||
echo "<p>";
|
|
||||||
echo $post["message"] . "<br>";
|
|
||||||
echo "</p>";
|
|
||||||
echo "</section>";
|
|
||||||
}
|
|
||||||
echo "</div>";
|
|
||||||
|
|
||||||
?>
|
|
||||||
</main>
|
|
||||||
<footer>
|
|
||||||
I'm cool
|
|
||||||
</footer>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,18 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<rss version="2.0">
|
|
||||||
|
|
||||||
<channel>
|
|
||||||
<title>Fbi's Epic Guestbook RSS Feed</title>
|
|
||||||
<link>https://www.w3schools.com</link>
|
|
||||||
<description>A cool Guestbook made by fbievan</description>
|
|
||||||
<?php
|
|
||||||
$data = json_decode(file_get_contents('test.json'), true);
|
|
||||||
?>
|
|
||||||
<?php foreach($data as $post): ?>
|
|
||||||
<item>
|
|
||||||
<title><?php echo $post["name"];?></title>
|
|
||||||
<description><?php echo htmlspecialchars($post["message"]);?></description>
|
|
||||||
</item>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</channel>
|
|
||||||
</rss>
|
|
|
@ -1,76 +0,0 @@
|
||||||
<?php
|
|
||||||
class data {
|
|
||||||
public $name;
|
|
||||||
public $message;
|
|
||||||
public $date;
|
|
||||||
public $mlength;
|
|
||||||
public $nlength;
|
|
||||||
function set_date() {
|
|
||||||
$this->date = date("Y M d");
|
|
||||||
}
|
|
||||||
function set_mlength() {
|
|
||||||
$this->mlength = strlen($this->message);
|
|
||||||
}
|
|
||||||
function set_nlength() {
|
|
||||||
$this->nlength = strlen($this->name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$ndata = new data();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$name = $ndata->name = htmlspecialchars($_POST["fname"]);
|
|
||||||
$message = $ndata->message = htmlspecialchars($_POST["fmessage"]);
|
|
||||||
$ndata->set_date();
|
|
||||||
$ndata->set_mlength();
|
|
||||||
$ndata->set_nlength();
|
|
||||||
$mlength = $ndata->mlength;
|
|
||||||
$nlength = $ndata->nlength;
|
|
||||||
|
|
||||||
# Setup JSON
|
|
||||||
|
|
||||||
$newURL = "https://" . $_SERVER['SERVER_NAME'] . "/guestbook/index.html";
|
|
||||||
|
|
||||||
# Check name and message
|
|
||||||
if ($name == "") {
|
|
||||||
header('Refresh:2; url=' . $newURL );
|
|
||||||
echo "There is no name, Try again with a name";
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
if ($message == "") {
|
|
||||||
header('Refresh:2; url=' . $newURL );
|
|
||||||
echo "There is no message, Try again with a message";
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
if($mlength > 200) {
|
|
||||||
header('Refresh:2; url=' . $newURL );
|
|
||||||
echo "This message is too long";
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
if($nlength > 25 ) {
|
|
||||||
header('Refresh:2; url=' . $newURL );
|
|
||||||
echo "The name is too long";
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$data = json_decode(file_get_contents('test.json'), true);
|
|
||||||
|
|
||||||
|
|
||||||
foreach($data as $post) {
|
|
||||||
if ($post["message"] == $message) {
|
|
||||||
echo "Another message with this text already exists";
|
|
||||||
header('Refresh:2; url=' . $newURL );
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
array_unshift($data , $ndata);
|
|
||||||
file_put_contents('test.json', json_encode($data, JSON_PRETTY_PRINT));
|
|
||||||
|
|
||||||
header('Refresh:2; url=' . $newURL );
|
|
||||||
echo "Your submisson has been added";
|
|
||||||
exit();
|
|
Loading…
Reference in New Issue