Fixed blank browse bug, made public
This commit is contained in:
parent
a555987da5
commit
28123eee61
13
README.md
13
README.md
@ -1 +1,12 @@
|
|||||||
## Meme Machine
|
# Meme Machine
|
||||||
|
|
||||||
|
## Current Version: v0.2 BETA
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
The Meme Machine is a semi-private repository of memes that can be easily searched, indexed, and accessed anywhere at any time. Content is not limited to memes, either. Reaction images and gifs, cancerous stuff, friends/members-related stuff, fails, replies, anything, really. It's mostly here for organization and access. This is the source code.
|
||||||
|
|
||||||
|
## Running
|
||||||
|
|
||||||
|
Clone the repository to the root (or other subdirectory) of your website. Change the appropriate files so that your database is being accessed with your credentials. Make a folder called "uploads" or change the code to suit your needs
|
||||||
|
|
||||||
|
@ -10,19 +10,23 @@ echo '<body>';
|
|||||||
echo '<div align="center">';
|
echo '<div align="center">';
|
||||||
echo '<h1>Meme Machine</h1>';
|
echo '<h1>Meme Machine</h1>';
|
||||||
|
|
||||||
$dir = "../uploads";
|
$dir = "../uploads"; // Directory for file uploads
|
||||||
$fileType = array(
|
$fileType = array( // Types of files that are thumbnail'd
|
||||||
'jpg',
|
'jpg',
|
||||||
'jpeg',
|
'jpeg',
|
||||||
'png',
|
'png',
|
||||||
'gif'
|
'gif'
|
||||||
);
|
);
|
||||||
$servername = "localhost";
|
|
||||||
$username = "root";
|
// MySQL server connection info
|
||||||
$password = "Flamingh0m()";
|
$servername = "db_address";
|
||||||
$dbname = "memes";
|
$username = "db_username";
|
||||||
|
$password = "db_password";
|
||||||
|
$dbname = "db_name";
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
|
//Connect to MySQL
|
||||||
$conn = mysqli_connect($servername, $username, $password, $dbname);
|
$conn = mysqli_connect($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
if (!$conn) {
|
if (!$conn) {
|
||||||
@ -30,7 +34,8 @@ if (!$conn) {
|
|||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_POST["browse"])) {
|
|
||||||
|
if(isset($_POST["browse"]) && $var) { // If "Browse" is pressed
|
||||||
echo '<h2>Category: ' . $_POST["memeCategory"] . '</h2>';
|
echo '<h2>Category: ' . $_POST["memeCategory"] . '</h2>';
|
||||||
$memeCategory = mysqli_real_escape_string($conn, $_POST["memeCategory"]);
|
$memeCategory = mysqli_real_escape_string($conn, $_POST["memeCategory"]);
|
||||||
$browse = "SELECT * FROM memes WHERE category = \"$memeCategory\"";
|
$browse = "SELECT * FROM memes WHERE category = \"$memeCategory\"";
|
||||||
@ -51,7 +56,7 @@ if(isset($_POST["browse"])) {
|
|||||||
<a href="./">Back</a>
|
<a href="./">Back</a>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
} else {
|
} else { // If 'Browse All' is pressed
|
||||||
echo '<h2>Category: all</h2>';
|
echo '<h2>Category: all</h2>';
|
||||||
$browse = "SELECT * FROM memes";
|
$browse = "SELECT * FROM memes";
|
||||||
$result = mysqli_query($conn, $browse);
|
$result = mysqli_query($conn, $browse);
|
||||||
@ -60,7 +65,7 @@ if(isset($_POST["browse"])) {
|
|||||||
while($row = mysqli_fetch_assoc($result)) {
|
while($row = mysqli_fetch_assoc($result)) {
|
||||||
$count++;
|
$count++;
|
||||||
echo '<img src="' . $dir . '/' . $row["fileName"] . '" alt="' . $row["name"] . '" />';
|
echo '<img src="' . $dir . '/' . $row["fileName"] . '" alt="' . $row["name"] . '" />';
|
||||||
if ($count == 3) {
|
if ($count == 3) { // Change this number based on how many pictures across you want on the page
|
||||||
echo '<br />';
|
echo '<br />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,10 @@ $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
|
|||||||
$uploadOk = 1;
|
$uploadOk = 1;
|
||||||
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
|
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
|
||||||
|
|
||||||
$servername = "localhost";
|
$servername = "db_address";
|
||||||
$username = "root";
|
$username = "db_username";
|
||||||
$password = "Flamingh0m()";
|
$password = "db_password";
|
||||||
$dbname = "memes";
|
$dbname = "db_name";
|
||||||
|
|
||||||
$conn = mysqli_connect($servername, $username, $password, $dbname);
|
$conn = mysqli_connect($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user