<?
if ( $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ) {
    include_once ROOT_DIR . '/engine/config.php';
    include_once ROOT_DIR . '/engine/function.php';
} else {
    if ( !defined( 'MISOFT' ) ) { exit(); }
}

?>
<div class="text_title" style="width: 518px; margin-top: -5px; margin-bottom: -1px;"><i class="fa fa-info-circle" aria-hidden="true"></i> Статические ссылки (не оплачиваются)</div>
<table class="work-serf">
	<tbody>
      <?
		$sh_statlink = mysql_query( "SELECT * FROM statlink WHERE paused = 1 ORDER BY RAND() LIMIT 5" );
		if ( mysql_num_rows( $sh_statlink ) > 0 ) {
			while ( $sh_statlink_row = mysql_fetch_array( $sh_statlink ) ) {
				if($sh_statlink_row['color'] == 1) {
					$priceallcolor = $config['statlink'] + $config['statlinkColorPrice'];
					$acolor = $config['statlinkColor'];
				} else {
					$priceallcolor = $config['statlink'];
					$acolor = '';
				}
				if ( $sh_statlink_row['balance'] < $config['statlink'] + $priceallcolor ) {
					#Ставим на паузу если баланс меньше цены
					mysql_query( "UPDATE statlink SET paused = 0 WHERE id = '" . $sh_statlink_row['id'] . "'" );
				} else {
					$serfUser1 = mysql_fetch_array( mysql_query( "SELECT username FROM user WHERE id = '" . $sh_statlink_row['iduser'] . "' LIMIT 1" ) );
					?>
					  <tr id="d<?=$sh_statlink_row['id']?>">
						<td class="normal" width="40" valign="top"><div class="img-stat-fix"><div class="serf_psevdo "><i class="fa fa-mouse-pointer serf_mini_fix" aria-hidden="true"></i></div></div></td>
						<td id="" class="normalm_psevdo" valign="top">
							<a href="/surol=<?=$sh_statlink_row['id']?>" target="_blank" style="color: <?=$acolor?>;" >
								<img src="//www.google.com/s2/favicons?domain=<?=$sh_statlink_row['url']?>"  align="absmiddle" width="16" height="16" border="0">
								<?=$sh_statlink_row['title']?><br>
							</a>
						</td>
						<td class="normal" style=" text-align: right; padding-right: 15px; " valign="top" nowrap="nowrap">
						  <div style="margin-top: -6px; margin-bottom: 3px; padding-bottom: 2px;" >
							<span class="clickprice">Цена: free </span><br>
							<a onclick="adv_ell.complaints(<?=$sh_statlink_row['id']?>, 'stat');" class="complaints_adv" target="_blank">
							  <i class="glyphicon glyphicon-ban-circle workcomp tiptip-css-class" title="Пожаловаться на рекламу" aria-hidden="true"></i>
							</a>
							<a class="workevents" href="/id<?=$sh_statlink_row['iduser']?>" target="_blank">
							  <i class="glyphicon glyphicon-user workevents tiptip-css-class" title="Перейти на стенку рекламодателя?" aria-hidden="true"></i>
							</a> 
							<a class="workvir" href="http://online.us.drweb.com/result/?url=<?=$sh_statlink_row['url']?>" target="_blank">
							  <i class="fa fa-shield workvir tiptip-css-class" title="Проверить ссылку на вирусы" aria-hidden="true"></i>
							</a>
						  </div>
						</td>
					  </tr>
					<?
				}
			}
		}
	  ?>
	</tbody>
</table>		