<?php
//Load time function (in footer)
$time = microtime(true);
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;

$session_username = mysql_real_escape_string($_SESSION['username']);
$session_password = mysql_real_escape_string($_SESSION['password']);
$session_acctype = mysql_real_escape_string($_SESSION['acctype']);
$session_hash = mysql_real_escape_string($_SESSION['hash']);

mysql_query("UPDATE System_Data SET version='$scriptversion' WHERE id='1'");
$lastversion1 = "SELECT `lastversion` FROM `System_Data` WHERE `id` = '1'";

$logoselect = mysql_query("SELECT * FROM Web_New_data WHERE data1='logourl'");
$logonum = mysql_num_rows($logoselect);
if($logonum == 0) {
	mysql_query("INSERT INTO `Web_New_data` (`id`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`) VALUES(1, 'logourl', 'ICONURL', 'LOGOURL', 35, 1, 1, 1, 0, 0, 0);");
}

$lastversion2 = mysql_query($lastversion1) or die($lastversion1."<br/><br/>".mysql_error());
$lastversion3 = mysql_result($lastversion2, 0);

$version1 = "SELECT `version` FROM `System_Data` WHERE `id` = '1'";
$version2 = mysql_query($version1) or die($version1."<br/><br/>".mysql_error());
$version3 = mysql_result($version2, 0);

$adminhash1 = "SELECT `admin` FROM `Web_Premium_Login` WHERE `id` = '1'";
$adminhash2 = mysql_query($adminhash1) or die($adminhash1."<br/><br/>".mysql_error());
$adminhash3 = mysql_result($adminhash2, 0);
if($session_hash != $adminhash3) {
	echo"<script type='text/javascript'>window.location= 'f.home'</script>";
}

if(!isset($_SESSION['username']) || !isset($_SESSION['password']))  {
	echo"<script type='text/javascript'>window.location= 'f.home'</script>";
}

if($_SESSION['acctype'] != 'admin')  {
	echo"<script type='text/javascript'>window.location= 'f.home'</script>";
}
?>
<!DOCTYPE html>
<html lang="en"><head>
  <meta charset="utf-8">
  <title><?php echo"$title"?></title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="title" content="<?php echo $sa['title']; ?>">
  <meta name="description" content="<?php echo $sa['description']; ?>">
  <meta name="author" content="Jozef Vojtáš" >
  <link rel="icon" type="image/png" href="<?php echo $iconurl; ?>">
  
  <!-- Google Web Font -->
  <link href="http://fonts.googleapis.com/css?family=Open+Sans:300,300italic,700&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  
  <!-- Bootstrap 3 Plan styles -->
  <link id="plan-theme" href="data/templates/panelend/superhero/assets/css/bootstrap.css" rel="stylesheet">
  <link href="data/templates/panelend/superhero/assets/fonts/font-awesome.css" rel="stylesheet" type="text/css" />
  <link href="data/plugins/wysiwyg/dist/summernote.css" rel="stylesheet">
  <link href="data/plugins/datetimepicker/css/bootstrap-datetimepicker.css" rel="stylesheet">
  <script type="text/javascript" src="data/plugins/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
  <script type="text/javascript" src="data/plugins/datetimepicker/js/moment.js"></script>

  <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
  <![endif]-->

  <!-- Docs Custom styles -->
  <style>
    body {
      padding: 120px 0 0 0; 
    }
    footer {
      background-color: white;
      border-top: 1px solid #ddd;
      padding: 30px;
      margin-top: 50px;
    }  
    .row > [class*="col-"] {
      margin-bottom: 30px;
    }
    .navbar-container {
      position: relative;
      min-height: 100px;
    }
    .navbar-container .navbar.navbar-fixed-top,
    .navbar-container .navbar.navbar-fixed-bottom {
      position: absolute;
      top: 50px;
      z-index: 0;
    }
    .navbar-container .navbar.navbar-fixed-top .container,
    .navbar-container .navbar.navbar-fixed-bottom .container {
      max-width: 90%;
    }
    .btn-group {
      margin-bottom: 10px
    }
    .form-inline select, 
    .form-inline input[type="text"], 
    .form-inline input[type="password"] {
      width: 180px;
    }
    .input-group {
      margin-bottom: 10px;
    }
    .pagination { margin-top :0;}
    .navbar-inverse {margin: 110px 0} 
    input[type="radio"].toggle {
    display: none;
}

input[type="radio"].toggle:checked + label {
    background-color: #3B4B5C;
    cursor: default;
    color: #E6E6E6;
    border-color: transparent;
    text-shadow: 0 1px 1px rgba(40, 40, 40, 0.75);
}

input[type="radio"].toggle + label {
    width: 20%;
}

input[type="radio"].toggle:checked + label.btn:hover {
    background-color: #445260;
    background-position: 0 0;
    -webkit-transition: none;
    -moz-trainsition: none;
    transition: none;
}

input[type="radio"].toggle-left + label {
    border-right: 0;
    -webkit-border-top-right-radius: 0;
    -webkit-border-bottom-right-radius: 0;
    -moz-border-top-right-radius: 0;
    -moz-border-bottom-right-radius: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

input[type="radio"].toggle-right + label {
    -webkit-border-top-left-radius: 0;
    -webkit-border-bottom-left-radius: 0;
    -moz-border-top-left-radius: 0;
    -moz-border-bottom-left-radius: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
  </style>
  
</head>

<body>
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_EN/sdk.js#xfbml=1&version=v2.3&appId=903187829694150";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
  <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation" style="margin: 0"><!-- WHITE navbar-superhero -->
    <div class="container">
      <!-- Brand and toggle get grouped for better mobile display -->
      <div class="navbar-header navbar-right">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#main-nav">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
      </div>

      <!-- Collect the nav links, forms, and other content for toggling -->
      <div class="collapse navbar-collapse" id="main-nav">
        <ul class="nav navbar-nav">
          <li>
            <a href="admin.Dashboard"><i class="fa fa-home"></i></a>
          </li>
          <li>
            <a href="admin.Ads"><?php echo $a274;?></a>
          </li>
          <li>
            <a href="admin.Links"><?php echo $a275;?></a>
          </li>
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo $a276;?> <b class="caret"></b></a>
            <ul class="dropdown-menu">
						<li><a href="admin.Finances"><?php echo $a277; ?></a></li>
						<li><a href="admin.Cashback"><?php echo $a278;?></a></li>
						<li><a href="admin.Wages"><?php echo $a279;?></a></li>
						<li class="divider"></li>
						<li><a href="admin.Rates"><?php echo $a280;?></a></li>
						<li><a href="admin.Bulkrates"><?php echo $a281;?></a></li>
						<li class="divider"></li>
						<li><a href="admin.Listofdeposits"><?php echo $a282;?></a></li>
             		<li><a href="admin.Listofwithdrawals"><?php echo $a283;?></a></li>
            </ul>
          </li>
		   <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo $a284;?> <b class="caret"></b></a>
            <ul class="dropdown-menu">
						<li><a href="admin.Accounts_Admins"><?php echo $a285;?></a></li>
						<li><a href="admin.Accounts_Support"><?php echo $a286;?></a></li>
						<li><a href="admin.Accounts_Payments"><?php echo $a287;?></a></li>
						<li><a href="admin.Accounts_Publishers"><?php echo $a288;?></a></li>
						<li><a href="admin.Accounts_Advertisers"><?php echo $a289;?></a></li>
						<li class="divider"></li>
						<li><a href="admin.Toppublisher"><?php echo $a290;?></a></li>
						<li><a href="admin.Topadvertiser"><?php echo $a291;?></a></li>
            </ul>
          </li>
		 	 <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo $a292;?> <b class="caret"></b></a>
            <ul class="dropdown-menu">
						<li><a href="admin.Menu"><?php echo $a293;?></a></li>
						<li><a href="admin.Pages"><?php echo $a294;?></a></li>
						<li><a href="admin.Homeblocks"><?php echo $a295;?></a></li>
						<li><a href="admin.News"><?php echo $a296;?></a></li>
						<li><a href="admin.Contests"><?php echo $a297;?></a></li>
            </ul>
          </li>
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo $a298;?> <b class="caret"></b></a>
            <ul class="dropdown-menu">
						<li><a href="admin.Addons"><?php echo $a299;?></a></li>
						<?php
						$query = "SELECT * FROM Web_Plugins WHERE turnable='1'";
						$result = mysql_query($query) or die('Error, query failed');
						while($row = mysql_fetch_array($result))
						{
								?>
									<li><a href="admin.<?php echo $row['backfile'];?>"><?php echo $row['headername'];?></a></li>
								<?php
						}
						?>
            </ul>
          </li>
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo $a299;?> <b class="caret"></b></a>
            <ul class="dropdown-menu">
						<li><a href="admin.Settings"><?php echo $a300;?></a></li>
						<li><a href="admin.Payments"><?php echo $a301;?></a></li>
						<li class="divider"></li>
						<li><a href="admin.Images"><?php echo $a302;?></a></li>
						<li><a href="admin.Templates"><?php echo $a303;?></a></li>
						<li><a href="admin.Activetemplates"><?php echo $a304;?></a></li>
						<li class="divider"></li>
						<li><a href="admin.Security"><?php echo $a305;?></a></li>
						<li class="divider"></li>
						<li><a href="admin.System"><?php echo $a306;?></a></li>
						<li><a href="admin.Updates"><?php echo $a307;?></a></li>
            </ul>
          </li>
        </ul>
		<ul class="nav navbar-nav navbar-right">
			<li class="dropdown">
				<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-language"></i> <b class="caret"></b></a>
				<ul class="dropdown-menu">
					<li><a href="language.english">English</a></li>
					<li><a href="language.slovak">Slovak</a></li>
					<li><a href="language.german">German</a></li>
					<li><a href="language.chinese">Chinese</a></li>
					<li><a href="language.portuguese">Portuguese</a></li>
					<li><a href="language.russian">Russian</a></li>
					<li><a href="language.czech">Czech</a></li>
					<li><a href="language.spanish">Spanish</a></li>
					<li><a href="language.french">French</a></li>
					<li><a href="language.arabic">Arabic</a></li>
					<li><a href="language.croatian">Croatian</a></li>
					<li><a href="language.danish">Danish</a></li>
					<li><a href="language.hungarian">Hungarian</a></li>
					<li><a href="language.italian">Italian</a></li>
					<li><a href="language.japanese">Japanese</a></li>
					<li><a href="language.polish">Polish</a></li>
					<li><a href="language.slovenian">Slovenian</a></li>
					<li><a href="language.swedish">Swedish</a></li>
				</ul>
			</li> 
			<li>
				<a href="#"> <i class="fa fa-sign-in"></i> <?php echo $_SESSION['username'];?> </a>
			</li>
			<li>
				<a data-toggle="modal" href="#language"> <i class="fa fa-quote-left"></i> <?php echo $a308;?></a>
			</li>
			<li>
				<a data-toggle="modal" href="#ftp"> <i class="fa fa-folder"></i> <?php echo $a310; ?></a>
			</li>
			<li>
				<a data-toggle="modal" href="#logout"><i class="fa fa-sign-out"></i> <?php echo $a309;?></a>
			</li>
		</ul>
      </div><!-- /.navbar-collapse -->
    </div>
  </nav>
  	<?php 
  	if($version3 < $lastversion3) {
	?>
	<div style="margin-top: -80px;" class="alert alert-warning" role="alert">
		<strong>Outdated version!</strong> Your script need to be updated. Please go to CodeCanyon, download files and replace them.
	</div>
	<?php
	}else if(empty($sa['jsonrates'])) {
	?>
	<div style="margin-top: -80px;" class="alert alert-warning" role="alert">
		<strong>Empty JSON Rates API!</strong> You don't have set your JSON Rates API. This service is used to convert all currencies at your website. <a href="admin.Settings">Go to settings and create one</a>
	</div>
	<?php
	}else if(empty($sa['virustotal'])) {
	?>
	<div style="margin-top: -80px;" class="alert alert-warning" role="alert">
		<strong>Empty VirusTotal API!</strong> You don't have set your VirusTotal API. This service is used to check all website URLs of advertisement and exclude urls with viruses from advertisement. <a href="admin.Settings">Go to settings and create one</a>
	</div>
	<?php
	}
	?>