Add files via upload

This commit is contained in:
get52 2020-07-27 17:58:31 -04:00 committed by GitHub
parent 9df1138b65
commit f2731d9119
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 166 additions and 0 deletions

57
createListing.php Normal file
View File

@ -0,0 +1,57 @@
<?php
$post_allowed = true;
if($_POST["title"] == ""){
echo "You forgot to enter a title<br>";
$post_allowed = false;
}
if($_POST["post"] == ""){
echo "You forgot to enter a post<br>";
$post_allowed = false;
}
if($_POST["contact"] == ""){
echo "You forgot to enter contact info (website, phone number, email etc)<br>";
$post_allowed = false;
}
if($_POST["category"] == ""){
echo "You forgot to enter a category";
$post_allowed = false;
}
function prettyCategory($category){
if($category == "is"){
return "Internet Services";
}
if($category == "msm"){
return "Man Seeking Man";
}
if($category == "msw"){
return "Man Seeking woman";
}
if($category == "pr"){
return "Platonic Relationship";
}
if($category == "wsw"){
return "Woman Seeking Woman";
}
}
function createListing($title, $post, $contact, $category){
$listingID = uniqid();
$listingDIR = $category . "/" . $listingID;
$postHTML = file_get_contents("template.html");
mkdir($listingDIR);
file_put_contents($listingDIR . "/title.txt", $title);
$postHTML = str_replace("_TITLE_", htmlspecialchars($title), $postHTML);
$postHTML = str_replace("_POST_", htmlspecialchars($post), $postHTML);
$postHTML = str_replace("_CONTACT_", htmlspecialchars($contact), $postHTML);
$postHTML = str_replace("_CATEGORY_", prettyCategory($category), $postHTML);
file_put_contents($listingDIR . "/index.html", $postHTML);
Header('Location: http://personals.getgle.org');
}
if($post_allowed == true){
createListing($_POST["title"], $_POST["post"], $_POST["contact"], $_POST["category"]);
}
?>

64
index.php Normal file
View File

@ -0,0 +1,64 @@
<head>
<style>
#post{
padding-left:20px;
margin:5px;
}
#category{
background:#ddddff;
margin-bottom:0px;
display:inline-block;
color:#000;
border:#f1f1ff solid;
border-radius: 100px;
padding:2px;
margin:5px;
}
</style>
</head>
<body>
<span style="font-size:60px;color:#6666dd">Getgle Personals</span> <a href="post.php" style="">make a listing</a>
<hr>
<span id="category">Internet Services</span><br>
<?php
$list = scandir("is/");
for($i = 2; $i < count($list); $i++){
echo "<a id='post' href='is/" . $list[$i] . "'>" . htmlspecialchars(file_get_contents("is/" . $list[$i] . "/title.txt")) . "</a><br>";
}
?>
<span id="category">Platonic Relationship</span><br>
<?php
$list = scandir("pr/");
for($i = 2; $i < count($list); $i++){
echo "<a id='post' href='pr/" . $list[$i] . "'>" . htmlspecialchars(file_get_contents("pr/" . $list[$i] . "/title.txt")) . "</a><br>";
}
?>
<span id="category">Man Seeking Man</span><br>
<?php
$list = scandir("msm/");
for($i = 2; $i < count($list); $i++){
echo "<a id='post' href='msm/" . $list[$i] . "'>" . htmlspecialchars(file_get_contents("msm/" . $list[$i] . "/title.txt")) . "</a><br>";
}
?>
<span id="category">Man Seeking Woman</span><br>
<?php
$list = scandir("msw/");
for($i = 2; $i < count($list); $i++){
echo "<a id='post' href='msw/" . $list[$i] . "'>" . htmlspecialchars(file_get_contents("msw/" . $list[$i] . "/title.txt")) . "</a><br>";
}
?>
<span id="category">Woman Seeking Woman</span>
<?php
$list = scandir("wsw/");
for($i = 2; $i < count($list); $i++){
echo "<a id='post' href='wsw/" . $list[$i] . "'>" . htmlspecialchars(file_get_contents("wsw/" . $list[$i] . "/title.txt")) . "</a><br>";
}
?>
<hr>
<span>
<i>Getgle Personals is intended for 18+ users, user discretion is advised. Getgle does not endorse and is not responsible for any user postings made on this page.</i><br>
report law-breaking posts to admin@getgle.org
</span>
</body>

34
post.php Normal file
View File

@ -0,0 +1,34 @@
<span style="font-size:60px;">Getgle Personals</span> <a href="post.php" style="background:#f1f1ff">make a listing</a>
<hr>
<div id="postBox">
<form action="createListing.php" method="post">
<table>
<tr>
<td>Title:</td><td> <input type="text" name="title" value=""></td>
</tr>
<tr>
<td>Post:</td><td><textarea name="post"></textarea></td>
</tr>
</table>
<td>Email/Phone/Website:</td><td> <input type="text" name="contact" value=""></td><br>
<b>Category:</b><br>
<select size=5 name="category">
<option value="is">Internet Services</option>
<option value="pr">Platonic Relationships</option>
<option value="msm">Man Seeking Man</option>
<option value="msf">Man Seeking Female</option>
<option value="fsf">Female Seeking Female</option>
</select>
</td><br><br>
<input type="submit" value="post your listing">
</form>
</div>
<hr>
<span>
<i>Getgle Personals is intended for 18+ users, user discretion is advised. Getgle does not endorse and is not responsible for any user postings made on this page.<br>
report law-breaking posts to admin@getgle.org</i>
</span>

11
template.html Normal file
View File

@ -0,0 +1,11 @@
<a href="http://personals.getgle.org"><span style="font-size:60px;">Getgle Personals</span></a> <a href="http://personals.getgle.org/post.php" style="background:#f1f1ff">make a listing</a>
<hr>
<h1>_TITLE_</h1>
<p>_POST_</p>
<p>contact: _CONTACT_</p>
<p><i>_CATEGORY_</i></p>
<hr>
<span>
<i>Getgle Personals is intended for 18+ users, user discretion is advised. Getgle does not endorse and is not responsible for any user postings made on this page.<br>
report law-breaking posts to admin@getgle.org</i>
</span>