add files
This commit is contained in:
parent
140c569170
commit
d9cd43e196
37
api.php
Normal file
37
api.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php header('Content-Type: application/json'); ?>
|
||||||
|
{
|
||||||
|
"posts": [
|
||||||
|
<?php
|
||||||
|
require "creds.php";
|
||||||
|
|
||||||
|
function test_input($data) {
|
||||||
|
$data = stripslashes($data);
|
||||||
|
$data = htmlspecialchars($data);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_GET["postID"])) {
|
||||||
|
$postID = test_input($_GET["postID"]);
|
||||||
|
$result = mysqli_query($mysqli, "SELECT PostID,Username,Time,Message FROM posts WHERE PostID = ".$postID);
|
||||||
|
} else {
|
||||||
|
$postID = "";
|
||||||
|
$result = mysqli_query($mysqli, "SELECT PostID,Username,Time,Message FROM posts ORDER BY PostID DESC");
|
||||||
|
}
|
||||||
|
|
||||||
|
while($res = mysqli_fetch_array($result)) {
|
||||||
|
echo " {\n";
|
||||||
|
echo ' "postID": '.$res['PostID'].",\n";
|
||||||
|
echo ' "username": "'.$res['Username'].'"'.",\n";
|
||||||
|
echo ' "time": "'.$res['Time'].'"'.",\n";
|
||||||
|
$message = str_replace("\r\n","\\n",test_input($res['Message']));
|
||||||
|
//$message = str_replace('"','a',$amessage]);
|
||||||
|
echo ' "message": "'.$message.'"'."\n";
|
||||||
|
if($res['PostID'] == "1" || $res['PostID'] == $postID) {
|
||||||
|
echo " }\n";
|
||||||
|
} else {
|
||||||
|
echo " },\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
]
|
||||||
|
}
|
BIN
beta-icon.png
Normal file
BIN
beta-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
9
creds.php
Normal file
9
creds.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
// CHANGE THESE!!!
|
||||||
|
$databaseHost='127.0.0.1';
|
||||||
|
$databaseUsername='USERNAME';
|
||||||
|
$databasePassword='PASSWORD';
|
||||||
|
$databaseName='DATABASE';
|
||||||
|
|
||||||
|
$mysqli=mysqli_connect($databaseHost, $databaseUsername, $databasePassword, $databaseName);
|
||||||
|
?>
|
53
css/style.css
Normal file
53
css/style.css
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
body {
|
||||||
|
background-color: #D0D0D0;
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
|
table, th, td {
|
||||||
|
border: 1px solid #000000;
|
||||||
|
background-color: #EEEEEE;
|
||||||
|
font-size: 10pt;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
.logotable {
|
||||||
|
border: 0px;
|
||||||
|
background-color: #D0D0D0;
|
||||||
|
}
|
||||||
|
.center {
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
.text-center {
|
||||||
|
text-align: center !important;
|
||||||
|
}
|
||||||
|
.navbar {
|
||||||
|
border: 1px solid #000000;
|
||||||
|
background-color: #EEEEEE;
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
span#id {
|
||||||
|
color: #2c49c9 !important;
|
||||||
|
}
|
||||||
|
span#name{
|
||||||
|
color: #1c8757;
|
||||||
|
}
|
||||||
|
span#date {
|
||||||
|
color: #727272;
|
||||||
|
}
|
||||||
|
span#message {
|
||||||
|
color: #000000;
|
||||||
|
white-space: pre-line;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
div#message {
|
||||||
|
background-color: #EEEEEE;
|
||||||
|
border: 1px solid #000000;
|
||||||
|
padding: 5px;
|
||||||
|
width: fit-content;
|
||||||
|
max-width: 100%;
|
||||||
|
display: block;
|
||||||
|
}
|
BIN
favicon.ico
Normal file
BIN
favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 318 B |
45
index.php
Normal file
45
index.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php include 'templates/header.php'?>
|
||||||
|
<form name="message" method="post" action="post.php" class="center">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>username</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="username" /> <i>30 char limit</i>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>message</td>
|
||||||
|
<td>
|
||||||
|
<textarea rows=8 cols=40 name="message"></textarea>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>action</td>
|
||||||
|
<td>
|
||||||
|
<input type="submit" name="send" value="send" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<hr/>
|
||||||
|
<div>
|
||||||
|
<?php
|
||||||
|
require "creds.php";
|
||||||
|
|
||||||
|
$result = mysqli_query($mysqli, "SELECT PostID,Username,Time,Message FROM posts ORDER BY PostID DESC");
|
||||||
|
|
||||||
|
while($res = mysqli_fetch_array($result)) {
|
||||||
|
echo "<div id='message'>";
|
||||||
|
echo "<span id='id'>".$res['PostID']."</span> ";
|
||||||
|
if(empty($res['Username'])) {
|
||||||
|
echo "<span id='name'>Anonymous</span> ";
|
||||||
|
} else {
|
||||||
|
echo "<span id='name'>".$res['Username']."</span> ";
|
||||||
|
}
|
||||||
|
echo "<span id='date'>".$res['Time']."</span><br>";
|
||||||
|
echo "<span id='message'>".$res['Message']."</span>";
|
||||||
|
echo "</div><br>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php include 'templates/footer.php'?>
|
7
messages.txt
Normal file
7
messages.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Hello!
|
||||||
|
If you are reading this message, it means you are using an outdated rautafarmi client.
|
||||||
|
As of 2022-09-07, rautafarmi has stopped using the old messages.txt method for retrieving messages.
|
||||||
|
An alternative will be released soon. To continue using the original rautafarmi, set your instance to
|
||||||
|
https://donut.gq/old-rautafarmi.
|
||||||
|
|
||||||
|
--jornmann, donut.gq and rautafarmi sysop
|
22
post.php
Normal file
22
post.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require 'creds.php';
|
||||||
|
|
||||||
|
if(isset($_POST['message'])) {
|
||||||
|
$username = mysqli_real_escape_string($mysqli, $_POST['username']);
|
||||||
|
$message = mysqli_real_escape_string($mysqli, $_POST['message']);
|
||||||
|
|
||||||
|
if(empty($message)) {
|
||||||
|
die("cannot post empty message!");
|
||||||
|
}
|
||||||
|
|
||||||
|
$mysqli->query("INSERT INTO posts (username, message, ip) VALUES('" . $username . "', '" . $message . "', '" . $_SERVER["HTTP_X_FORWARDED_FOR"] . "')");
|
||||||
|
|
||||||
|
echo "<p>success</p>";
|
||||||
|
|
||||||
|
header("Location: index.php");
|
||||||
|
}
|
||||||
|
echo "<p>done</p>";
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
7
privacy-policy.php
Normal file
7
privacy-policy.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?php include 'templates/header.php'?>
|
||||||
|
<h1>privacy policy</h1>
|
||||||
|
<p>this page only exists because the law wants it to.</p>
|
||||||
|
<p>the only data we collect about you is your IP address.</p>
|
||||||
|
<p>your IP address is only used for banning you in case you do something bad.</p>
|
||||||
|
<p>if you want your data removed, you must send us the data you want removed. since this is an anonymous messageboard, we need your whole IP address for us to be able to remove it which kind of defeats the point, otherwise we can't confirm your identity.</p>
|
||||||
|
<?php include 'templates/footer.php'?>
|
7
schema.sql
Normal file
7
schema.sql
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS posts (
|
||||||
|
PostID INT NOT NULL AUTO_INCREMENT primary key,
|
||||||
|
Username VARCHAR(30),
|
||||||
|
IP VARCHAR(100) NOT NULL,
|
||||||
|
Time TIMESTAMP,
|
||||||
|
Message VARCHAR(1000)
|
||||||
|
);
|
9
templates/footer.php
Normal file
9
templates/footer.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
<hr/>
|
||||||
|
<div class="text-center">
|
||||||
|
<p>made with love, php, blood, sweat, and tears. lots of tears.</p>
|
||||||
|
<p><?php system("uptime -p") ?></p>
|
||||||
|
<p>(c) donut.gq and contributors 2022</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
27
templates/header.php
Normal file
27
templates/header.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>rautafarmi Beta</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/style.css" />
|
||||||
|
<link rel="icon" href="/rautafarmi/favicon.ico" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="navbar">
|
||||||
|
<a href="/">[ root ]</a>
|
||||||
|
<a href="/rautafarmi/index.php?rand=<?php echo rand(); ?>">[ refresh ]</a>
|
||||||
|
<a href="/rautafarmi/api.php">[ api ]</a>
|
||||||
|
<a href="mailto:webmaster@donut.gq">[ e-mail ]</a>
|
||||||
|
<a href="privacy-policy.php">[ privacy policy ]</a>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="center">
|
||||||
|
<table class="logotable">
|
||||||
|
<tr class="logotable">
|
||||||
|
<!--td class="logotable"><img src="icon.png" alt="rautafarmi logo" width="75px" height="143px"></td-->
|
||||||
|
<td class="logotable"><img src="beta-icon.png" alt="beta rautafarmi logo" width="75px" height="157px"></td>
|
||||||
|
<td class="logotable"><h1> rautafarmi <i>Beta!</i></h1></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<hr/>
|
Loading…
Reference in New Issue
Block a user