<?php
# author Drk in
require_once ( $_SERVER['DOCUMENT_ROOT']."/_core/system.php" );
$id = isset( $_GET['id'] ) ? htmlspecialchars($_GET['id']): null;
if($id == null)system::header('/');
$watch = '/video/'.$id.'.html';
# cache
$cache = cache::watch($watch);
# meta
$title = $cache->meta[0]->title;
$description = $cache->meta[0]->description.' на '.domain;
$keywords = $cache->meta[0]->keywords.' на '.domain;
$tl = $cache->meta[0]->tl;
# view
$view = DB :: $dbh -> querySingle("SELECT count(*) FROM `view` WHERE `video`=? AND `ip`=? AND `ua`=?;", array($id, ip, ua));
if(empty($view)):
DB :: $dbh -> query("INSERT INTO `view` (`video`, `ip`, `ua`, `time`) VALUES (?, ?, ?, ?);",array($id, ip, ua,time()));
endif;
#cn
$cn_view = DB :: $dbh -> querySingle("SELECT count(*) FROM `view` WHERE `video`=?;", array($id));
$cn_like = DB :: $dbh -> querySingle("SELECT count(*) FROM `like` WHERE `video`=?;", array($id));
$cn_dizlike = DB :: $dbh -> querySingle("SELECT count(*) FROM `dizlike` WHERE `video`=?;", array($id));
$cn_download = DB :: $dbh -> querySingle("SELECT count(*) FROM `download` WHERE `video`=?;", array($id));
# like
if (isset($_POST['like'])):
$like = DB :: $dbh -> querySingle("SELECT count(*) FROM `like` WHERE `video`=? AND `ip`=? AND `ua`=?;", array($id, ip, ua));
if(empty($like)):
DB :: $dbh -> query("INSERT INTO `like` (`video`, `ip`, `ua`, `time`) VALUES (?, ?, ?, ?);",array($id, ip, ua,time()));
endif;
system::header('/watch/'.$id);
endif;
# dizlike
if (isset($_POST['dizlike'])):
$dizlike = DB :: $dbh -> querySingle("SELECT count(*) FROM `dizlike` WHERE `video`=? AND `ip`=? AND `ua`=?;", array($id, ip, ua));
if(empty($dizlike)):
DB :: $dbh -> query("INSERT INTO `dizlike` (`video`, `ip`, `ua`, `time`) VALUES (?, ?, ?, ?);",array($id, ip, ua,time()));
endif;
system::header('/watch/'.$id);
endif;
# download
if (isset($_POST['download'])):
$download = DB :: $dbh -> querySingle("SELECT count(*) FROM `download` WHERE `video`=? AND `ip`=? AND `ua`=?;", array($id, ip, ua));
if(empty($download)):
DB :: $dbh -> query("INSERT INTO `download` (`video`, `ip`, `ua`, `time`) VALUES (?, ?, ?, ?);",array($id, ip, ua,time()));
endif;
system::header($config['url'].$cache->video[0]->d_href);
endif;
# head
require_once ( head );
# video
play::video($config['url'].$cache->video[0]->href,$config['url'].$cache->video[0]->src);
# like и тд
echo '
<div style="background: #ffffff;"><ul align="center" class="nav nav-pills">
<li>
<form method="post">
<button type="submit" name="like" class="btn btn-link">
<span style="color:green;font-size:18px;">
<img src="'.ico.'like_video.png" width="20"> '.$cn_like.'</span>
</button>
</form>
</li>
<li>
<form method="post">
<button type="submit" name="dizlike" class="btn btn-link">
<span style="color:red;font-size:18px;">
<img src="'.ico.'rating_minus.png" width="20"> '.$cn_dizlike.'</span>
</button>
</form>
</li>
<li class="disabled"><a href="#"><img src="'.ico.'box-share.png" alt="Скачали видео"> '.$cn_download.'</a></li>
<li class="disabled"><a href="#"><img src="'.ico.'heylook.png"> '.$cn_view.'</a></li>
<li class="disabled"><a href="#"><img src="'.ico.'durdl.png">
<meta itemprop="duration" content="'.$cache->video[0]->duration.'">'.$cache->video[0]->duration.'
</a></li>
<li class="disabled"><a href="#"><img src="'.ico.'cv.png"> '.$cache->video[0]->time.'</a></li></ul></div>';
# mess
echo '<div class="list-group-item" itemprop="description">'.$cache->video[0]->mess.'</div>';
# tag
echo '<div class="list-group-item"><b>Категории</b>:';
foreach ($cache->tag as $tag):
if ($tag->href != null ):
echo '
<span class="teg"><a href="/tag/'.$tag->href.'">'.$tag->name.'</a></span>
';
endif;
endforeach;
echo '<span itemprop="actor" itemscope="" itemtype="http://schema.org/Person"><a href="/actress//"><span itemprop="name"></span></a></span> </div>';
# download
echo '
<div class="list-group-item">
<center>
<form method="post" style=" margin: 0px 0 0 0;">
<button type="submit" name="download" class="btn btn-primary">
<img src="'.ico.'box-share.png" alt="Скачать видео"> Скачать порно ['.$cache->video[0]->d_name.']</button>
</form>
</center></div>
';
# video top
echo '<div class="list-group"><div class="list-group-item"><h2>Лучшее порно видео за сегодня:</h2></div><div style="background: #ffffff;">';
$i = 0;
foreach ($cache->video_sel as $video_sel):
if ($video_sel->href != null):
$i++;
if ($i <= 3):
$img = $config['url'].$video_sel->src;
echo '
<div class="col-sm-7 col-md-4" style="background: #ffffff;">
<div class="list-group">
<div class="image">
<a href="/watch/'.$video_sel->href.'" itemprop="url">
<h2><span class="namev">'.$video_sel->title.'</span></h2></a>
<a href="/watch/'.$video_sel->href.'">
<img width="100%" height="200px" src="'.$img.'" alt="'.$video_sel->title.'" title="'.$video_sel->title.'"></a>
<span class="like"><img src="'.ico.'like_up.png" width="16" alt="*"> 4</span>
<span class="videoviews"><img src="'.ico.'heylook.png" width="16" alt="*"> 732</span>
<span class="timevideo">'.$video_sel->duration.'</span>
</div>
</div>
</div>';
endif;
endif;
endforeach;
echo '</div></div><div class="clear"></div>';
# foot
require_once ( foot ) ;
?>