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
"); $output = strip_tags($input); $output = stripslashes($output); $output = mysql_real_escape_string($output); $output = strtolower($output); return $output; } function imgstuff(){ uname(); tag(); if (empty($_GET['img']) || $_GET['img'] == null || $_GET['img'] == ''){ $img = ''; }else{ $img = $_GET["img"]; // get the image } if(!empty($img) || $img != null || $img != ''){ require('dbsettings.php'); $img = sanitize($img); // clean image string $sql = "SELECT id, name, location, type, size, time, comment, username, tags FROM $tbl_name WHERE name='$img' LIMIT 1;"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); if ($row){ $_SESSION['noimg'] = false; $_SESSION['id'] = $row['id']; $_SESSION['img'] = $row['name']; $_SESSION['location'] = $row['location']; $_SESSION['type'] = $row['type']; $_SESSION['size'] = $row['size']; $_SESSION['time'] = $row['time']; $_SESSION['comment'] = $row['comment']; $_SESSION['username'] = $row['username']; $_SESSION['tags'] = $row['tags']; echo "

"; //echo "$id
$img
$location
$type
$size
$time
$comment
$username
$tags\n"; mysql_close(); }else{ $_SESSION['noimg'] = true; echo "

That image was not found in our database D:

"; } }else{ noimg(); $_SESSION['noimg'] = true; } } function headstuff(){ echo "\n"; echo " \n"; echo " \n"; echo " \n"; } function textstuff(){ if($_SESSION['noimg'] == false){ echo "
\n"; echo "

Image Name:

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

Image Type:

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

Image Size:

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

Time Uploaded:

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

Username:

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

Comment:

- ".$_SESSION['comment']."\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 = ''; //'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: img.unps-gama.info/?img=(IMGAGE STUFF HERE)

List of Uploaded Pictures:
$thelist
"; } function title(){ if(empty($img) || $img = null || $img = ''){ echo ""; }else{ echo " - Now Showing: ".$img; } } ?> UnPS-GAMA Image Host<?php title(); ?>
Tagging System is still WIP