From de1e3f6bfc7013990121b0606372ff1a816c0c34 Mon Sep 17 00:00:00 2001 From: alopexc0de Date: Sat, 9 Feb 2013 02:48:52 -0500 Subject: [PATCH] Image sorting through username implemented - tags still WIP --- img/index.php | 122 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 100 insertions(+), 22 deletions(-) diff --git a/img/index.php b/img/index.php index 14681dd..97fa327 100755 --- a/img/index.php +++ b/img/index.php @@ -1,7 +1,6 @@

Pictures uploaded from Username: ".$_GET['uname'].":

"; + require('dbsettings.php'); + $uname = sanitize($_GET['uname']); + $sql = "SELECT id, name, location, type, size, time, comment, username, tags FROM $tbl_name WHERE username='$uname'"; + $result = mysql_query($sql); + $count = mysql_num_rows($result); + if($count == 1){ + $i = 0; + while ($row = mysql_fetch_assoc($result)){ + $id = $row['id']; + $img = $row['name']; + $location = $row['location']; + $type = $row['type']; + $size = $row['size']; + $time = $row['time']; + $comment = $row['comment']; + $username = $row['username']; + $tags = $row['tags']; + echo "$img - $time - $size - Tags: "; + $tags = explode(" ", $tags); + foreach($tags as $tag){ + echo "$tag "; // For future use - catagorize by tag + } + echo "
"; + } + } + echo "


"; + } + } + + function tag(){ + if(!empty($_GET['tag'])){ // Show list of pictures according to one tag - maybe multiple tags in the future + echo "

Pictures uploaded with the tag: ".$_GET['tag'].":

"; + require('dbsettings.php'); + $tag = sanitize($_GET['tag']); + $sql = "SELECT id, name, location, type, size, time, comment, username, tags FROM $tbl_name WHERE 'tags' LIKE '$tag'"; + $result = mysql_query($sql); + $count = mysql_num_rows($result); + if($count == 1){ + $i = 0; + while ($row = mysql_fetch_assoc($result)){ + $id = $row['id']; + $img = $row['name']; + $location = $row['location']; + $type = $row['type']; + $size = $row['size']; + $time = $row['time']; + $comment = $row['comment']; + $username = $row['username']; + $tags = $row['tags']; + echo "$img - $time - $size - Username: $username
"; + } + } + echo "



"; + } + } function sanitize($input){ if ($input == null) die("Sanatize() - No Input Provided, Aborting\r\n
"); @@ -24,6 +81,8 @@ } function imgstuff(){ + uname(); + tag(); if (empty($_GET['img']) || $_GET['img'] == null || $_GET['img'] == ''){ $img = ''; }else{ @@ -60,10 +119,10 @@ } function headstuff(){ - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; } function textstuff(){ @@ -73,16 +132,32 @@ echo "

Image Type:

- ".$_SESSION['type']."\n"; echo "

Image Size:

- ".$_SESSION['size']."\n"; echo "

Time Uploaded:

- ".$_SESSION['time']."\n"; - echo "

Username:

- ".$_SESSION['username']."\n"; + echo "

Username:

- "; + $username = $_SESSION['username']; + echo "$username"; // For future use - catagorize by username + echo "\n"; echo "

Comment:

- ".$_SESSION['comment']."\n"; - echo "

Tags:

- ".$_SESSION['tags']."\n"; + echo "

Tags:

- "; + $tags = $_SESSION['tags']; + $tags = explode(" ", $tags); + foreach($tags as $tag){ + echo "$tag "; // For future use - catagorize by tag + } + echo "\n"; echo ""; } } function noimg(){ - $thelist = ''; - //include('getfiles.php'); + $thelist = ''; //'meow.png Last Modified: 2/8/2013 11:37PM
'; + if($handle = opendir('Pictures')){ + while(false != ($file = readdir($handle))){ + if($file != "." && $file != ".." && $file != ".htaccess"){ + $thelist .= ''.$file.'
'; + } + } + closedir($handle); + } echo "

Please specify an image with the url: @@ -94,12 +169,12 @@
-
List of files:
+
List of Uploaded Pictures:
- $thelist +
$thelist
@@ -109,13 +184,12 @@ function title(){ if(empty($img) || $img = null || $img = ''){ - return; + echo ""; }else{ - return " - Now Showing: ".$img; + echo " - Now Showing: ".$img; } } -?> - +?> @@ -123,8 +197,8 @@ - - UnPS-GAMA Image Host<?php echo title(); ?> + + UnPS-GAMA Image Host<?php title(); ?> @@ -151,6 +225,7 @@

+ +
+
- New design underway :D + Tagging System is still WIP
@@ -179,6 +256,7 @@
+
- + \ No newline at end of file