File: /home/httpd/html/baretube.com/image.php
<?
session_start();
include('admin/db.php');
$id = mysql_real_escape_string($_GET[id]);
$cached_file = $cache_path.'/videos/'.$id;
if(file_exists($cached_file) && time() - $video_cache_time < filemtime($cached_file)) {
$string = file_get_contents($cached_file);
$rrow = unserialize($string);
}
else {
$result = mysql_query("SELECT content.*, content_views.views as views, users.username as username FROM content LEFT JOIN users ON users.record_num = content.submitter LEFT JOIN content_views ON content_views.content = content.record_num WHERE content.record_num = '$id' LIMIT 0,1") or die(mysql_error());
if(mysql_num_rows($result) < 1) {
header("Location: /404.php");
exit();
}
if($rrow[paysite] != 0) {
$paysiteq = mysql_query("SELECT paysites.name, paysites.url FROM paysites WHERE record_num = '$rrow[paysite]'");
$prow = mysql_fetch_array($paysiteq);
$rrow[paysiteurl] = $prow[url];
$rrow[paysitename] = $prow[name];
}
else {
$rrow[paysiteurl] = $basehttp;
$rrow[paysitename] = $sitename;
}
$rrow = mysql_fetch_array($result);
if(!$rrow[username]) { $rrow[username] = 'Anonymous'; }
$string = serialize($rrow);
file_put_contents($cached_file, $string);
}
//EOF CACHING
if($rrow[paysite] != 0) {
$paysiteq = mysql_query("SELECT paysites.name, paysites.url FROM paysites WHERE record_num = '$rrow[paysite]'");
$prow = mysql_fetch_array($paysiteq);
$rrow[paysiteurl] = $prow[url];
$rrow[paysitename] = $prow[name];
}
else {
$rrow[paysiteurl] = '/';
$rrow[paysitename] = $sitename;
}
$bad = array('?','!',' ','&','*','$','#','@');
$good = array('','','-','','','','','');
$vlink = "$basehttp/galleries/".$rrow[record_num]."/".strtolower(str_replace($bad,$good,$rrow[title])).".html";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="css/styles.css"/>
<title><? echo $rrow[title]; ?></title>
</head>
<body>
<div class="gbl-container-1">
<div class="gbl-container-2">
<div class="header">
<a href="/"><div class="header-logo"></div></a>
<ul class="sec-nav">
<li class="sec-nav-link"><a href="http://www.amateurranks.com/index.php?contestcommunity=1" id="contest">contest</a></li>
<li class="sec-nav-link" id="current"><a href="http://www.amateurranks.com/members/page1.html" id="community">community</a></li>
<li class="sec-nav-link"><a href="http://www.amateurranks.com/index.php" id="content">content</a></li>
<li class="sec-nav-link"><a href="http://www.amateurranks.com/vip-home.php" id="vip">vip</a></li>
</ul>
<div class="sub-nav">
<div class="search">
<form style='margin: 0 0 0 0; padding: 0 0 0 0;' action='/index.php' method='GET'>
<input type="text" value="" id="search-text" name="q"/>
<input id="search-btn" type="submit" name="submit" value=" " />
</form>
</div>
<ul class="sub-nav-links">
<li><a href="/login.php" id="login-sub-nav">LOGIN</a></li>
<li><a href="/signup.php" id="free-reg-sub-nav">FREE REGISTRATION</a></li>
<li id="current-sub"><a href="/index.php" id="shard-pv-sub-nav">SHARD PHOTOS & VIDEOS</a></li>
<li><a href="/forum/" id="community-forums-sub-nav">COMMUNITY FORUMS</a></li>
<li><a href="http://www.amateurranks.com/members/page1.html" id="community-profiles-sub-nav">COMMUNITY PROFILES</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="width980 marginAuto">
<div class="bd">
<div class="full-header" id="full-community-index-header">
<div class="header-title-text">
<div class="text-header-title-left">Member Uploaded Content</div>
<div class="text-header-title-right">Shared Photos & Videos</div>
<div class="clear"></div>
</div>
<ul class="video-photo-nav video-photo-nav-community-index" style="padding-left:250px;">
<li class="video-photo-nav-on"><a href="#" id="all-content-full"></a></li>
<li><a href="http://www.amateurranks.com/index.php?type=hvids" id="h-videos-full"></a></li>
<li><a href="http://www.amateurranks.com/index.php?type=svids" id="s-videos-full"></a></li>
<li><a href="http://www.amateurranks.com/index.php?type=hpics" id="h-photos-full"></a></li>
<li><a href="http://www.amateurranks.com/index.php?type=spics" id="s-photos-full"></a></li>
</ul>
</div>
</div>
<div class="clear"></div>
<?
$array = scandir($gallery_path."/".$rrow[filename]);
foreach($array as $key => $value) {
if($value != '.' && $value != '..' && $value != 'thumbs') {
if($value == $_GET[image]) {
if($key > 0 && $array[$key-1] != '.' && $array[$key-1] != '..' && $array[$key-1] != 'thumbs') {
$previous = $array[$key-1];
}
if($key < count($array) && $array[$key+1] != '.' && $array[$key+1] != '..' && $array[$key+1] != 'thumbs') {
$next = $array[$key+1];
}
}
}
}
?>
<div class="padTop20">
<div class="width980">
<div class="page-bar-left"></div>
<div class="page-bar width968" align="center">
<? if($previous) { ?>
<a href="/view_image.php?gallery=<? echo $rrow[filename]; ?>&image=<? echo $previous; ?>&id=<? echo $rrow[record_num]; ?>" class="previous-entry">PREVIOUS PHOTO</a>
<? } ?>
<? if($next) { ?>
<a href="/view_image.php?gallery=<? echo $rrow[filename]; ?>&image=<? echo $next; ?>&id=<? echo $rrow[record_num]; ?>" class="next-entry">NEXT PHOTO</a>
<? } ?>
<div class="page-numbers">
<span class="current-page-number"><a href="<? echo $vlink; ?>">RETURN BACK TO THE PHOTO SET</a></span>
</div>
</div>
<div class="page-bar-right"></div>
<div class="clear"></div>
</div>
</div>
</div>
<div class="positionRelative marginTop20 marginBottom20" align="center">
<div>
<img src="http://<? echo $mediadomain; ?>/galleries/<? echo $rrow[filename]; ?>/<? echo $_GET[image]; ?>" border="0" />
</div>
</div>
<div class="width980 marginAuto">
<div class="page-bar-left"></div>
<div class="page-bar width968" align="center">
<? if($previous) { ?>
<a href="/view_image.php?gallery=<? echo $rrow[filename]; ?>&image=<? echo $previous; ?>&id=<? echo $rrow[record_num]; ?>" class="previous-entry">PREVIOUS PHOTO</a>
<? } ?>
<? if($next) { ?>
<a href="/view_image.php?gallery=<? echo $rrow[filename]; ?>&image=<? echo $next; ?>&id=<? echo $rrow[record_num]; ?>" class="next-entry">NEXT PHOTO</a>
<? } ?>
<div class="page-numbers">
<span class="current-page-number"><a href="<? echo $vlink; ?>">RETURN BACK TO THE PHOTO SET</a></span>
</div>
</div>
<div class="page-bar-right"></div>
<div class="clear"></div>
<div class="bottom-3-column full-bottom-3-column marginTop20" style="border-left:1px solid #d5d5d5; border-right:1px solid #d5d5d5; border-top:1px solid #d5d5d5;">
<div class="bottom-end-border">
<div class="left-bottom-column">
<!-- Left -->
<div>
<strong><? echo $rrow[title]; ?></strong><br />
by <a href='<? echo $basehttp; ?>/profiles/<? echo $rrow[submitter]; ?>.html'><? echo $rrow[username]; ?></a>
</div>
<div class="add-to-fav-folder">
<a href="<? echo $basehttp; ?>/action.php?action=add_favorites&id=<? echo $rrow[record_num]; ?>">Add to Favorites Folder</a>
</div>
<div>
<div class="box-link strong"><div class="floatRight"><? echo ucwords($rrow[type]); ?> Photos</div> Entry Type:</div>
<div class="box-link strong"><div class="floatRight">March 31</div> Voting Ends:</div>
<div class="box-link">
<strong>Description:</strong>
<p><? echo $rrow[description]; ?></p>
</div>
</div>
<div class="clear"></div>
<!-- /Left -->
</div>
<div class="middle-bottom-column">
<!-- Middle -->
<div class="other-member-uploads">
<strong>Other Uploads From This Member:</strong>
<?
$result = mysql_query("SELECT * FROM content WHERE submitter = '$rrow[submitter]' LIMIT 0,4");
while($row = mysql_fetch_array($result)) {
if($row[photo_gallery] == 1) {
$link = "$basehttp/galleries/".$row[record_num]."/".strtolower(str_replace($bad,$good,$row[title])).".html";
}
else {
$link = "$basehttp/videos/".$row[record_num]."/".strtolower(str_replace($bad,$good,$row[title])).".html";
}
$dirname = str_replace('.flv','',$row[orig_filename]);
?>
<? if($row[photo_gallery] == 1) { ?>
<a href="<? echo $link; ?>" target="_self"><img src="<? echo $gallery_url ?>/<? echo $row[filename]; ?>/thumbs/<? echo $row[thumbnail]; ?>" alt="<? echo $row[title]; ?>" name="<? echo $row[orig_filename]; ?>" width="94" border=0 /></a>
<? } else { ?>
<a href="<? echo $link; ?>" target="_self"><img src="<? echo $thumb_url; ?>/<? echo $dirname; ?>/<? echo $row[orig_filename]; ?>-<? echo $row[main_thumb]; ?>.jpg" alt="<? echo $row[title]; ?>" width="94" border=0 /></a>
<? } ?>
<?
}
?>
<a href="/profiles/<? echo $rrow[submitter]; ?>.html">Show All Uploads From Member</a>
</div>
<div class="other-member-uploads noBrdr">
<div class="marginTop10" align="center"><img src="images/affiliate-icon-placeholder.png" width="202" height="202" /></div>
<a class="marginTop10" href="#">Affiliate Test Link</a>
</div>
<div class="clear"></div>
<!-- /Middle -->
</div>
<div class="big-right-bottom-column">
<!-- Right -->
<div class="entries-watch-comments-container">
<h3><a href="#" onclick="pokazAlboUkryj('add_coment'); return false;">Add Comment</a> Comments</h3>
<div class="individual-comment-container" id="add_coment" style="display:none;">
<? if($_SESSION[userid]) { ?>
<form id="myform" name="comments" action="javascript:get(document.getElementById('myform'));" style='margin: 0 0 0 0; padding: 0 0 0 0;'>
<input type='hidden' name='id' id='id' value='<? echo $rrow[record_num]; ?>' />
<span name="myspan" id="myspan" style='text-align: left; font-weight: bold;'></span>
<table border="0">
<tr>
<td valign="top">
Comment:<br />
<textarea style='width: 200px; height: 70px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; margin-bottom: 5px;' name="comment" id="comment"></textarea>
<br />
<input type="submit" name="button" id="button" value="Post Comment" /></td>
</tr>
</table>
</form>
<? } else { ?>
<p>You must be logged in to post comments. Please <a href='/login.php'>login</a> or <a href='/signup.php'>signup (free)</a>.</p>
<? } ?>
</div>
<?
$cresult = mysql_query("SELECT * FROM comments WHERE content = '$rrow[record_num]' ORDER BY timestamp DESC");
if(mysql_num_rows($cresult) > 0) {
?>
<?
while($crow = mysql_fetch_array($cresult)) {
?>
<div class="individual-comment-container">
<p><? echo $crow[comment]; ?></p>
<div><a href=""><? echo $crow[name]; ?></a> <span class="marginLeft20">(wrote <? echo datediff('n',$crow[timestamp],time(),true); ?> ago:)</span></div>
</div>
<? } ?>
<? } else { ?>
<div class="individual-comment-container">
There are no comments for this video. Please leave your feedback and be the first!
</div>
<? } ?>
</div>
<div class="clear"></div>
<!-- /Right -->
</div>
</div>
<div class="clear"></div>
</div>
<div class="full-bottom-wide"></div>
</div>
<div class="clear"></div>
<div class="marginTop20"></div>
<? include($basepath.'/templates/template.overall_footer.php'); ?>