2013-02-09 06:29:47 +00:00
< ? php
session_start ();
2013-02-19 07:24:59 +00:00
$pst = microtime ( true );
2013-02-09 07:48:52 +00:00
2013-02-09 10:09:07 +00:00
/* -----------------------------------------------------------
*
* UnPS - GAMA Image Host
* Copyright ( c ) 2013 UnPS - GAMATechnologies
2013-02-12 09:38:50 +00:00
* Author : David Todd ( c0de ) of http :// www . unps - gama . info and http :// unps . us
2013-02-09 10:09:07 +00:00
*
* -----------------------------------------------------------
* TODO :
*
* JavaScript fo show bigger image if clicked
2013-04-14 15:07:51 +00:00
* Optomize Upload - Uses 4 mysql calls to upload 1 file
2013-02-15 22:47:30 +00:00
* Force Spaces in tags
2013-02-10 00:39:59 +00:00
* Multiple tags without search ?
2013-02-19 03:54:28 +00:00
* Classes ? - Might just go as far as to seperate the functions
* Temporarly dropped support for bitmap files until I learn how to generate those
2013-04-14 15:07:51 +00:00
* unps . us picture redirection support ? ( unps . us / ? i = name . ext redirect to img . unps - gama . info / ? img = name . ext )
* New idea for recent pictures : Instead of using one row in db and array tricks , use multiple rows and order by dateposted in decending order - $sql = " SELECT * FROM `recentpics` ORDER BY `dateposted` DESC LIMIT 2 " ; - Should reduce upload sql queries to only two .
2013-02-09 10:09:07 +00:00
*
* -----------------------------------------------------------
2013-04-14 15:07:51 +00:00
*
* For unps . us short image link support
* if ( isset ( $_GET [ 'i' ]) && ! empty ( $_GET [ 'i' ])){
* header ( 'location:http://img.unps-gama.info/?img=' . $_GET [ 'i' ]);
* }
*
2013-02-09 10:09:07 +00:00
*/
2013-02-15 23:19:19 +00:00
require ( 'helper.get.php' ); // Helper.Get.php - Holds the functions for get - uname, tag, search, and upload
require ( 'helper.clean.php' ); // Helper.Clean.php - Holds the functions for cleaning input and output
require ( 'helper.genthumb.php' ); // Helper.GenThumb.php - Function for generating thumbnails on upload
require ( 'img.extra.php' ); // Img.Extra.php - Extra main functions
require ( 'img.main.php' ); // Img.Main.php - Main program
2013-02-19 07:24:59 +00:00
// Refresh the thumbnails on the fly - secretpassword123 will of course be changed when put online
if ( ! empty ( $_GET [ 'generatenewthumbnailsformeprettyplease' ]) && $_GET [ 'generatenewthumbnailsformeprettyplease' ] == 'secretpassword123' ){
createThumbs ();
}
2013-02-19 03:54:28 +00:00
2013-02-15 23:19:19 +00:00
// Declare variables so it doesn't complain to me later x.x
2013-02-09 06:29:47 +00:00
$thelist = '' ;
2013-02-09 10:09:07 +00:00
$img = '' ;
2013-02-09 06:29:47 +00:00
$id = '' ;
$location = '' ;
$type = '' ;
$size = '' ;
$time = '' ;
$comment = '' ;
$username = '' ;
$tags = '' ;
2013-02-15 22:29:23 +00:00
$_SESSION [ 'noimg' ] = '' ;
2013-04-29 19:59:45 +00:00
function showads (){
// Code for ads or something...
$db = new mysqli ( 'localhost' , 'adds' , 'password' , 'adds' ); // hostname. username, password, database
if ( $db -> connect_errno > 0 ){
die ( 'Unable to connect to database [' . $db -> connect_error . ']' );
}
$rand = mt_rand ( 1 , 6 );
$ads = " SELECT * FROM `ads` WHERE `id` = $rand " ;
if ( ! $result = $db -> query ( $ads )){
die ( 'There was an error running the query [' . $db -> error . ']' );
}
$row = $result -> fetch_assoc ();
if ( $row ){
return '<a href="' . $row [ 'link' ] . '" target="_' . $row [ 'cname' ] . '"><img src="' . $row [ 'image' ] . '" alt="ad for ' . $row [ 'cname' ] . '" title="' . $row [ 'title' ] . '" /></a>' ;
}
}
2013-02-09 07:48:52 +00:00
?>
2013-02-09 06:29:47 +00:00
<! DOCTYPE html PUBLIC " -//W3C//DTD XHTML 1.0 Transitional//EN " " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >
< html xmlns = " http://www.w3.org/1999/xhtml " prefix = " og: http://ogp.me/ns# " >
2013-02-12 09:38:50 +00:00
<!--
* -----------------------------------------------------------
*
* UnPS - GAMA Image Host
* Copyright ( c ) 2013 UnPS - GAMATechnologies
* Author : David Todd ( c0de ) of http :// www . unps - gama . info and http :// unps . us
*
* -----------------------------------------------------------
2013-04-14 15:07:51 +00:00
* TODO :
2013-02-12 09:38:50 +00:00
*
* JavaScript fo show bigger image if clicked
2013-04-14 15:07:51 +00:00
* Optomize Upload - Uses 4 mysql calls to upload 1 file
2013-02-15 22:47:30 +00:00
* Force spaces on tags
2013-02-12 09:38:50 +00:00
* Multiple tags without search ?
2013-02-19 03:54:28 +00:00
* Classes ? - Might just go as far as to seperate the functions
* Temporarly dropped support for bitmap files until I learn how to generate those
2013-04-14 15:07:51 +00:00
* unps . us picture redirection support ? ( unps . us / ? i = name . ext redirect to img . unps - gama . info / ? img = name . ext )
* New idea for recent pictures : Instead of using one row in db and array tricks , use multiple rows and order by dateposted in decending order - $sql = " SELECT * FROM `recentpics` ORDER BY `dateposted` DESC LIMIT 2 " ; - Should reduce upload sql queries to only two .
2013-02-12 09:38:50 +00:00
*
* -----------------------------------------------------------
*
2013-04-14 15:07:51 +00:00
* For unps . us short image link support
* if ( isset ( $_GET [ 'i' ]) && ! empty ( $_GET [ 'i' ])){
* header ( 'location:http://img.unps-gama.info/?img=' . $_GET [ 'i' ]);
* }
*
2013-02-12 09:38:50 +00:00
-->
2012-11-16 09:15:24 +00:00
< head >
2013-02-09 06:29:47 +00:00
< meta http - equiv = " Content-Type " content = " text/html;charset=utf-8 " />
< meta name = " description " content = " Image Host for UnProfessional Standards " />
2012-11-16 09:15:24 +00:00
< meta name = " keywords " content = " GAMA,UnPS,upstandards,unps-gama,gama-unps,unps,gama,davitech,davitodd " />
< meta name = " author " content = " David Todd " />
2013-02-21 00:32:51 +00:00
< ? php
if ( isset ( $_GET [ 'img' ]) && ! empty ( $_GET [ 'img' ])){
echo " <meta property= \" og:title \" content= \" " . $_GET [ 'img' ] . " \" /> \n " ;
echo " <meta property= \" og:url \" content= \" http://img.unps-gama.info/index.php?img= " . $_GET [ 'img' ] . " \" /> \n " ;
echo " <meta property= \" og:image \" content= \" http://img.unps-gama.info/Pictures/ " . $_GET [ 'img' ] . " \" /> \n " ;
echo " <meta property= \" og:description \" content= \" " . $_GET [ 'img' ] . " \" /> \n " ;
2013-02-21 00:36:07 +00:00
echo " <title>UnPS-GAMA Image Host - Now Showing: " . $_GET [ 'img' ] . " </title> \n " ;
2013-02-21 00:32:51 +00:00
} else {
2013-02-21 00:36:07 +00:00
echo " <title>UnPS-GAMA Image Host</title> \n " ;
2013-02-21 00:32:51 +00:00
}
?>
2013-02-09 06:29:47 +00:00
< link rel = " shortcut icon " type = " image/ico " href = " favicon.ico " />
< link rel = " shortcut icon " type = " image/x-icon " href = " favicon.ico " />
< link rel = " stylesheet " href = " style.css " type = " text/css " media = " screen " />
2013-04-14 15:07:51 +00:00
< script src = " http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js " ></ script >
< script type = " text/javascript " src = " js/jquery.zclip.js " ></ script >
2012-11-16 09:15:24 +00:00
< script type = " text/javascript " language = " JavaScript " >
function set_body_height (){
var wh = $ ( window ) . height ();
$ ( 'body' ) . attr ( 'style' , 'height:' + wh + 'px;' );
}
$ ( document ) . ready ( function () {
set_body_height ();
$ ( window ) . bind ( 'resize' , function () { set_body_height (); });
2013-04-14 15:07:51 +00:00
$ ( 'a#copy-description' ) . zclip ({
path : 'ZeroClipboard.swf' ,
copy : $ ( 'a#copy-description' ) . text ()
});
2012-11-16 09:15:24 +00:00
});
</ script >
2013-02-09 06:29:47 +00:00
< style type = " text/css " >
2012-11-16 09:15:24 +00:00
. fit {
max - width : 100 % ;
max - height : 100 % ;
}
</ style >
</ head >
2013-02-09 06:29:47 +00:00
< body >
< div id = " page_wrap " >
< div id = " header " >
< img src = " header.png " alt = " Header image " />
2013-02-19 03:54:28 +00:00
</ div > <!-- End Header -->
2013-02-09 07:48:52 +00:00
2013-02-09 06:29:47 +00:00
< div id = " main_navi " >
< ul class = " left " >
< li >< a href = " http://www.unps-gama.info " > Home </ a ></ li >
2013-02-15 22:47:30 +00:00
< li >< a href = " ../img " > Images </ a ></ li >
2013-02-09 06:29:47 +00:00
< li >< a href = " http://unps.us " target = " _unps " > Shortener </ a ></ li >
< li >< a href = " http://p.unps.us " target = " _pro " > Projects </ a ></ li >
< li >< a href = " https://github.com/alopexc0de/GAMA-Site " target = " _git " > GitHub </ a ></ li >
< li >< a href = " http://www.unps-gama.info/ToS.html " > Terms of Service </ a ></ li >
2013-02-09 07:48:52 +00:00
< li >< a href = " http://www.unps-gama.info/privacy.html " > Privacy Policy </ a ></ li >
2013-02-09 06:29:47 +00:00
</ ul >
< ul class = " right " >
< li class = " twitter " >< a href = " http://twitter.com/upstandards " title = " Follow UnPS on twitter " > TWITTER </ a ></ li >
</ ul >
2013-02-19 03:54:28 +00:00
</ div > <!-- End Navbar -->
2013-02-09 07:48:52 +00:00
2013-02-09 06:29:47 +00:00
< div class = " clear " ></ div >
2013-02-09 07:48:52 +00:00
2013-02-09 06:29:47 +00:00
< div id = " container " >
2013-02-19 04:20:52 +00:00
< div id = " mainwide " class = " ad " >
2013-02-21 00:32:51 +00:00
< div class = " post " ><!-- 925 x96px seems optimal -->
2013-04-29 19:59:45 +00:00
< ? php
echo showads ();
?>
2013-02-19 04:20:52 +00:00
</ div > <!-- End Post -->
</ div > <!-- End MainWide -->
2013-02-09 06:29:47 +00:00
< div id = " main " >
2013-04-14 15:07:51 +00:00
<!--< div class = " sticky " >
2013-02-21 07:13:15 +00:00
Force spaces on tags
2013-02-19 03:54:28 +00:00
</ div > <!-- End Sticky -->
2013-02-09 06:29:47 +00:00
< div class = " post " >
2013-02-15 21:39:34 +00:00
< div class = " entry " ><!-- Begin image stuff php -->
2013-02-09 06:29:47 +00:00
< ? php
imgstuff ();
?>
2013-02-19 03:54:28 +00:00
</ div > <!-- End Entry -->
</ div > <!-- End Post -->
</ div > <!-- End Main -->
2013-02-09 07:48:52 +00:00
2013-02-09 06:29:47 +00:00
< div id = " sidebar " >
2013-02-19 03:54:28 +00:00
< ul > <!-- Searchbar -->
2013-02-09 11:27:02 +00:00
< li class = " widget widget_search " >
< div id = " search " >
2013-02-10 00:39:59 +00:00
< form action = " " method = " get " name = " search " id = " search " >
2013-02-09 11:27:02 +00:00
< input name = " search " id = " search " type = " text " placeholder = " Search " />
2013-04-14 15:07:51 +00:00
< input id = " submit " name = " submit " type = " submit " value = " Search " />< br />
< div style = " padding-left:29px;padding-top:3px;float:left; " >
< input name = " google " id = " google " type = " checkbox " /> Google Search This
</ div >< br />
2013-02-09 11:27:02 +00:00
</ form >
</ div >
</ li >
</ ul >
2013-02-19 03:54:28 +00:00
<!--< br /> Might not keep this - Social Media Buttons
2013-02-09 06:29:47 +00:00
< ul >
< li class = " widget widget_text " >
< div class = " textwidget " >
< span >
Social Media Buttons Here
</ span >
</ div >
</ li >
2013-02-15 22:47:30 +00:00
</ ul >-->
2013-02-15 21:39:34 +00:00
< br />
2013-02-19 03:54:28 +00:00
< ul > <!-- Recent Pictures -->
2013-02-15 21:39:34 +00:00
< li class = " widget widget_text " >
< div class = " textwidget " >
2013-04-14 15:07:51 +00:00
< h3 > Recently Uploaded Pictures </ h3 >< p ></ p >
< ? php
2013-02-15 22:47:30 +00:00
require ( 'dbsettings.php' );
$sql = " SELECT * FROM `recentpics` WHERE `id` = 1 " ;
if ( ! $result = $db -> query ( $sql )){
die ( 'There was an error running the query [' . $db -> error . ']' );
}
$row = $result -> fetch_assoc ();
2013-02-15 21:39:34 +00:00
if ( $row ){
2013-02-19 07:24:59 +00:00
$thethumbs = '' ;
if ( $thumbs = opendir ( 'thumbs' )){
while ( false != ( $fiel = readdir ( $thumbs ))){
if ( $fiel != " . " && $fiel != " .. " && $fiel != " .htaccess " ){
$thethumbs .= " - " . $fiel ;
}
}
closedir ( $thumbs );
}
$thethumbs = explode ( " - " , $thethumbs );
2013-02-15 21:39:34 +00:00
$name = $row [ 'name' ];
$name = explode ( " - " , $name );
foreach ( $name as $names ){
2013-02-19 07:24:59 +00:00
if ( in_array ( $names , $thethumbs )){
2013-04-14 15:07:51 +00:00
echo '<a href="?img=' . $names . '"><img src="thumbs/' . $names . '" alt="' . $names . '" title="' . $names . '"/></a>' . " \n " ;
2013-02-19 07:24:59 +00:00
} else {
2013-04-14 15:07:51 +00:00
echo '<a href="?img=' . $names . '"><img src="nothumb.png" alt="' . $names . '" title="' . $names . '"/></a>' . " \n " ;
2013-02-19 07:24:59 +00:00
}
2013-02-15 21:39:34 +00:00
}
} else {
echo " Error getting images from database " ;
2013-02-15 22:47:30 +00:00
}
2013-04-14 15:07:51 +00:00
echo " \n " ;
2013-02-15 21:39:34 +00:00
?>
</ div >
</ li >
</ ul >
<!-- textstuff is right under here ( not shown unless picture is viewed though ) -->
2013-02-19 03:54:28 +00:00
< ? php // Image info
2013-02-09 06:29:47 +00:00
if ( $_SESSION [ 'noimg' ] == false ){
echo "
< br />
< ul >
< li class = \ " widget widget_text \" >
< div class = \ " textwidget \" >
" ;
textstuff ();
echo "
</ div >
</ li >
</ ul >
2012-11-16 09:15:24 +00:00
" ;
2013-02-10 00:39:59 +00:00
}
?>
< br />
2013-02-19 03:54:28 +00:00
< ul > <!-- Upload -->
< li class = " widget widget_text " >
< div class = " textwidget " >
< h4 > Want to upload pictures ? </ h4 >
< a href = '?upload' > Image Uploader Here </ a >
</ div >
</ li >
</ ul >
</ div > <!-- End Sidebar -->
</ div > <!-- End Container -->
</ div > <!-- End Page_Wrap -->
2013-02-09 06:29:47 +00:00
< div id = " footer " >
< div class = " footer_wrapper " >
< div class = " footer_left " >
< p >
2013-02-19 07:24:59 +00:00
< a href = " http://www.unps-gama.info/privacy.html " > Privacy Policy </ a > - < a href = " http://www.unps-gama.info/ToS.html " > Terms of Service </ a > - Modified < a href = " http://imotta.cn/wordpress/pyrmont-theme-v2-for-wordpress.html " > Pyrmont V2 </ a > - < strong > Copyright & copy ; 2012 - 2013 UnPS - GAMA </ strong >
2013-02-09 06:29:47 +00:00
</ p >
2013-02-19 03:54:28 +00:00
</ div > <!-- End Footer_Left -->
2013-02-19 07:24:59 +00:00
< div class = " footer_right " >
< p >
< ? php echo " Page generated in: " . round ( number_format ( microtime ( true ) - $pst , 6 ), 4 ) . " Seconds " ; ?>
</ p >
</ div > <!-- End Footer_Right -->
2013-02-19 03:54:28 +00:00
</ div > <!-- End Footer_Wrapper -->
</ div > <!-- End Footer -->
2013-02-09 06:29:47 +00:00
</ body >
2013-02-12 09:38:50 +00:00
</ html >
2013-02-19 03:54:28 +00:00
< ? php session_unset (); session_destroy (); // To stop carrying over of unneeded info ?>