

<?php

//test
require ('/var/www/src/defines.php');

$func_path = SRC_DIR . 'func2.php';

require ($func_path);
require ('admanager.php');
require SRC_DIR . 'Mobile_Detect.php';

$path=get_current_slink_dir();
$from = getenv("http_referer");

$b_large_ad = 0;
$country_code = apache_note("GEOIP_COUNTRY_CODE");

$img = $_GET['image'];
$loc = $_GET['loc'];
$next_img_str=0;

$host = $_SERVER['HTTP_HOST'];
$ref =  $_SERVER['HTTP_REFERER'];
$ar;
$ctr_pv = code_get();
#$ctr_pv24 = code_get24();
$ctr_pv12 = code_get_12();

$b_surf = $_COOKIE[surfBegin];

$allowp_b = allow_p();
$allowp24_b = allow_p24();
$allowp12_b = allow_p12();
$b_sfw=0;
$b_friend = friendly();
$b_nopops = $_COOKIE["nopops"];
if ($b_nopops != 1) 
$b_nopops=nopops();

$b_layover=0;

$new_form_b=0;
if (!$loc) {
$new_form_b=1;
$loc =  loc . get_loc_from_file_name ($img);
}
$img_path = $path . $loc . '/' . $img;
$b_new  = 0;

$f_yes = file_exists ($img_path);
#echo "file exists $f_yes; path is $img_path";
if   (!$f_yes)
   {
    $path='';
    $img_path=HOME_DIR_PATH . $loc . '/' . $img;
   }
$f_yes = file_exists ($img_path);

if (!$f_yes) {
require ('noimage.html');
echo "This image does not exist on this server";
exit(1);
}

if ( $f_yes && exif_imagetype($img_path) == IMAGETYPE_PNG) {
echo "This image does not exist on this server";
exit(1);
}

list($width, $height, $type, $attr)  = getimagesize($img_path);

$b_rand_1_2 = rand (1,2);
$b_rand_1_3 = rand (1,3);
$b_rand_1_4 = rand (1,4);
$b_rand_1_30 = rand (1,30);


$path = $path .  $loc . "/" . $img;
$b_sfw = is_sfw($path);

$next_img_str = chop (get_next_img_str($img));
$view_ctr = get_img_ctr($img);
if ($view_ctr != -1)
	incr_view_ctr(++$view_ctr, $img);

$b_db_write = b_db_write();

/*
if ($b_sfw == 0) {
	$detect = new Mobile_Detect;
	if ($detect->isMobile() || $_GET['mobile']) {
		require ('ExoClick_MobileHeader_20190124-1211.html');
	} else {
		require ('ExoClick_DesktopHeader_20190124-1211.html');
	}
}
*/

setcookie("surfBegin", 1, time() + 43200, "/", ".imagevenue.com", 0);

if ($b_sfw == 0) {
	$showInterstitial = false;
	if(!isset($_COOKIE["_inter"])){
				setcookie("_inter", 1, time() + (21600), "/",".imagevenue.com", 0); // 6h
				$showInterstitial = true;
	}
}
?>
<HTML>
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-140250734-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-140250734-1');
</script>

</head>
<BODY>
<STYLE type="text/css">
a.external:link {color: #0000ff; font-size: 07pt; }
a.external:visited {color: #0000ff;  }
a.external:hover {text-decoration: overline; background-color: #003399; }
a.external:active {color: red; }
</STYLE>



<?php
if ($b_sfw == 0) {
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
!function(c){c(document).ready(function(){var 
t="https://engine.phn.doublepimp.com/link.engine?z=11480&guid=791dc23b-03fb-49cf-baf4-4e79f4301eda",o=6,i=".awn-ignore",e="a",a="__ve_p",r={enabled:"undefined"==typeof 
__ads,url:"https://engine.phn.doublepimp.com/link.engine?z=11480&guid=791dc23b-03fb-49cf-baf4-4e79f4301eda",ttl:6,cookieName:"__ve1_abp"},f=function(e,n,t){var o="";if(t){var i=new 
Date;i.setTime(i.getTime()+60*t*60*1e3),o="; expires="+i.toUTCString()}document.cookie=e+"="+n+o+"; path=/"},p=function(e,n,t,o){},u=function(e){for(var 
n=e+"=",t=document.cookie.split(";"),o=0;o<t.length;o++){for(var i=t[o];" "==i.charAt(0);)i=i.substring(1,i.length);if(0==i.indexOf(n))return i.substring(n.length,i.length)}return 
null};u(a)||u(r.cookieName)||c(e).click(function(){var e=!u(a)&&!u(r.cookieName);if(i&&0<c(this).parents(i).length&&(e=!1),e)if(r&&r.enabled){var 
n=c(this).attr("href");-1===n.indexOf("http")&&-1===n.indexOf("/")&&-1===n.indexOf(".php")||(f(r.cookieName,"1",r.ttl),c(this).attr("href",r.url),window.open(n,"s"+Math.floor(5e3*Math.random()),""),p("pop","pop","abp","true"))}else 
f(a,"1",o),window.open(t,"_blank","width=1280,height=720,top=0,toolbar=no,status=no,menubar=no,location=yes,left=0"),window.focus(),p("pop","pop","normal","true");return!0})})}(jQuery);
</script>
<?php 
	$detect = new Mobile_Detect;
	if ($detect->isMobile() || $_GET['mobile']) {
		//echo "<!--mobile-->";
	} else {
		//inter
		//check cookie
		if($showInterstitial){
			$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

?>
		 <div style="text-align:center;width:1200px;margin:0 auto;">
				<a href="<?=htmlspecialchars($actual_link)?>" title="Continue to your image" target="_self" style="text-decoration:none;font-size:30px;padding:15px;display: 
block;">Continue to your 
image</a>
		 </div>
		 <div style="text-align:center">
				<iframe src="http://engine.phn.doublepimp.com/link.engine?z=11481&guid=791dc23b-03fb-49cf-baf4-4e79f4301eda" style="width:1200px; height:850px;" frameborder="0" 
scrolling="0"></iframe>
		 </div>
	</body>
</html>
<?php
exit(0);
		}

	}
	//popup
}
?>

<script type="text/javascript">

function closeWindow() 
{
  this.focus();
    self.opener = this;
      self.close();
}

function getCookie(name)
{
var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));

}
function setCookie (name, value, time)
        {
                var expires = new Date();

                expires.setTime( expires.getTime() + time );

document.cookie = name + '=' + value + '; domain=.imagevenue.com; path=/; expires=' + expires.toGMTString();
        }


function surfBegin()
{
              
        setCookie('surfBegin', 1, (11*3600*1000));

}



function tableWidth()
{return windowWidth()-100;}

function windowWidth() {
if (navigator.appName=="Netscape")
return window.innerWidth;

return document.body.offsetWidth;
}

function scaleImg() {
what = document.getElementById('thepic');
actualHeight=what.height; 
actualWidth=what.width;
if (fitsInWindow()) 
	return;
	if(what.width == tableWidth()) {
		what.width  = actualWidth;
		what.height = actualHeight;
	} else {
		what.style.cursor = "pointer";
		what.width  = tableWidth();
		what.height = (actualHeight/actualWidth) * what.width;
	}
}

function showOnclick() {
what = document.getElementById('thepic');

if (actualWidth == what.width)
        return scaleImg();
else if (actualWidth > what.width)
{
what.width=actualWidth;
what.height=actualHeight;
}
}

function liveResize() {
what = document.getElementById('thepic');
actualHeight=what.height; actualWidth=what.width;
 if (fitsInWindow())return;
if (what.width!=actualWidth) {
what.width=tableWidth();what.height = (actualHeight/actualWidth) * what.width;
}
}

function setImgWidth(){
 if (fitsInWindow())return;
document.getElementById('thepic').width=tableWidth();
}
function fitsInWindow() {
   what = document.getElementById('thepic');
   var  actualWidth= what.width;
  if (actualWidth<tableWidth()) {

   return true;
  } else {
  return false;
  }
  }
</script>


<P>




<?php
#$path = $path .  $loc . "/" . $img;



$bl=1;
#$b_sfw = is_sfw($path);
$b_adv4=0;
$b_adv1=0;
$b_adv2=0;
$b_adv3=0;
$b_adv5=0;
$b_adv6=0;


$b_latin_am = is_latin_am ($country_code);
$host = $host . "/" ;
$str= "http://" . "$host" . "get_code.php?loc=";
$str .=$loc;
$str.="&image=";
$str .=$img;

$country_code = apache_note("GEOIP_COUNTRY_CODE");

echo '
<center><table><tr><td align=center>
';

if ($f_yes)
	compose_prev_next($img);

echo "
</td></tr></table></center>

<P><center>
<table border='0' width='100%' bgcolor= 'white' cellspacing='0' cellpadding='0'>
<tr><td align='center' valign='top'>
<a href='#' onClick='showOnclick()'><img id='thepic' onLoad='scaleImg();'   SRC='$path' alt='$path'>
</td></tr></table>
";

$id = get_traffic_drive_id($img);
if ($id > 1000) {
	show_traffic_drive_link($id);
	require ('traffic_drive_ga.html');
}

echo '<BR>';

if ($view_ctr)
	echo ("Views: $view_ctr <BR>");

get_gallery_link($img);

echo "
<BR><BR><center><input type='button' onclick='closeWindow()' value='close window' /></center>
<BR><font color='blue' face='Verdana' size='-1'><A HREF=$str>Get link code</A> for this image.</font></center>
<BR>";

/*
if ($b_sfw == 0) {
	$detect = new Mobile_Detect;
	if ($detect->isMobile() || $_GET['mobile']) {
		require ('ExoClick_MobileFooter_20190124-1211.html');
	} else {
		require ('ExoClick_DesktopFooter_20190124-1211.html');
	}
	require ('awepops.html');
}

require ('gaq_20190124-1211.html');
*/

echo '
</BODY>
</HTML>';

