diff --git a/.gitignore b/.gitignore
index e69de29..9672757 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+credentials.php
diff --git a/browse/browse.php b/browse/browse.php
index 49bc699..3238bc2 100644
--- a/browse/browse.php
+++ b/browse/browse.php
@@ -1,4 +1,5 @@
';
@@ -19,10 +20,6 @@ $fileType = array( // Types of files that are thumbnail'd
);
// MySQL server connection info
-$servername = "db_address";
-$username = "db_username";
-$password = "db_password";
-$dbname = "db_name";
$count = 0;
diff --git a/browse/index.php b/browse/index.php
index b4a1db8..4ad304d 100644
--- a/browse/index.php
+++ b/browse/index.php
@@ -12,8 +12,8 @@
';
+echo '
Meme Machine
';
+
+ $count = 0;
+ //Connect to MySQL
+ $conn = mysqli_connect($servername, $username, $password, $dbname);
+
+ if (!$conn) {
+ die ("CONNECTION FAIL " .mysqli_connect_error());
+ } else {
+ }
+
+ $term = $_POST['term'];
+
+
+ $tokens = explode(' ', $term);
+ $tokens = array_map(
+ function($term) {
+ return mysqli_real_escape_string(trim($term));
+ },
+ $tokens
+ );
+
+ $sql = "SELECT * FROM memes WHERE name LIKE '$term";
+ $sql .= implode("%' or name LIKE '%", $tokens) . "'";
+
+ if(isset($_POST['search']) && $term){
+ echo "Search term is: " . $term . "
";
+
+ $result = mysqli_query($conn, $sql);
+
+ echo $sql;
+ if (mysqli_num_rows($result) > 0) {
+ while($row = mysqli_fetch_assoc($result)) {
+ $count++;
+ echo '

';
+ if ($count == 3) {
+ echo '
';
+ }
+ }
+ } else {
+ echo "Your search returned no results. Please go back and try again";
+ ?>
+
+
Back
+
+
Please go back and enter a search query
+
+
+
Back
+ ';
+echo '';
+?>
diff --git a/index.php b/index.php
index b546e08..025b3af 100644
--- a/index.php
+++ b/index.php
@@ -118,8 +118,7 @@
- Member-Specific |
- The Fuck You Say? |
+ Spongebob |
@@ -141,6 +140,6 @@
-
Meme Machine v0.2.0 BETA
+
Meme Machine v0.3.0 BETA