<?php 
session_start();
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); 
include('asli/conf.php');
include("asli/func.php");
include("asli/jdf.php");
error_reporting(E_ALL);
ini_set('display_errors', 0);
function clss($string) {
   $string = str_replace('"', ' ', $string); 
   $string = str_replace('#', ' ', $string); 
   $string = str_replace('\\', '/', $string); 

   return $string;
}
function catname($catid){
    if($catid=='1')
    { return "اصلی"; }
    if($catid=='2')
    { return "فرهنگ و هنر"; }
    if($catid=='3')
    { return "اخبار"; }
    if($catid=='4')
    { return "آموزش"; }
    if($catid=='5')
    { return "تفریحی"; }
    if($catid=='6')
    { return "ورزشی"; }
    if($catid=='7')
    { return "مذهبی"; }
    if($catid=='8')
    { return "علم و فناوری"; }
    if($catid=='9')
    { return "بانوان"; }
    if($catid=='10')
    { return "طبیعت و گردشگری"; }
    if($catid=='11')
    { return "گوناگون"; }
         
        if($catid=='12')
    { return "سایر مطالب"; }
     if($catid=='13')
    { return "سریال"; }
	
	 if($catid=='14')
    { return "فیلم"; }
         
      
    
 }
 function cataddress($catid){
     if($catid=='1')
    { return "lastvideo"; }
    if($catid=='2')
    { return "culture"; }
    if($catid=='3')
    { return "news"; }
    if($catid=='4')
    { return "educational"; }
    if($catid=='5')
    { return "funny"; }
    if($catid=='6')
    { return "sport"; }
    if($catid=='7')
    { return "religious"; }
    if($catid=='8')
    { return "technology"; }
    if($catid=='9')
    { return "womans"; }
    if($catid=='10')
    { return "tourism"; }
    if($catid=='11')
    { return "misc"; }
         
         if($catid=='13')
    { return "serial"; }
	
	if($catid=='14')
    { return "movie"; }
 }
 
 
 
 function genrename($genreid){
if($genreid=='1') { return "سریال"; }
if($genreid=='2') { return "فیلم"; }
if($genreid=='3') { return "انیمیشن"; }
if($genreid=='4') { return "انیمه"; }
if($genreid=='5') { return "مستند"; }
if($genreid=='6') { return "ایرانی"; }
if($genreid=='7') { return "خارجی"; }
if($genreid=='8') { return "هندی"; }
if($genreid=='9') { return "کره ای"; }
if($genreid=='10') { return "اکشن"; }
if($genreid=='11') { return "ماجراجویی"; }
if($genreid=='12') { return "بیوگرافی"; }
if($genreid=='13') { return "جنایی"; }
if($genreid=='14') { return "خانوادگی"; }
if($genreid=='15') { return "درام"; }
if($genreid=='16') { return "رازآلود"; }
if($genreid=='17') { return "سیاسی"; }
if($genreid=='18') { return "عاشقانه"; }
if($genreid=='19') { return "کمدی"; }
if($genreid=='20') { return "ابرقهرمانی"; } 
if($genreid=='21') { return "علمی تخیلی"; }
if($genreid=='22') { return "وسترن"; }
if($genreid=='23') { return "فانتزی"; } 
if($genreid=='24') { return "تاریخی"; }
if($genreid=='25') { return "ورزشی"; }
if($genreid=='26') { return "هیجان انگیز"; } 
if($genreid=='27') { return "جنگی"; } 
if($genreid=='28') { return "ترسناک"; }  
if($genreid=='29') { return "ترکی"; }  
if($genreid=='30') { return "250 فیلم برتر"; }  
if($genreid=='31') { return "کوتاه"; }  
if($genreid=='32') { return "کالکشن"; }
if($genreid=='33') { return "موزیکال"; }
if($genreid=='34') { return "پزشکی"; }
if($genreid=='35') { return "آموزشی"; }
if($genreid=='36') { return "عربی"; }
if($genreid=='37') { return "افغانستانی"; }
if($genreid=='38') { return "تئاتر"; }
if($genreid=='39') { return "تاک شو"; }
if($genreid=='40') { return "رئالیتی شو"; }
if($genreid=='41') { return "گیم شو"; }
 }
 
  function genreaddress($genreid){
 
if($genreid=='1'){ return "series"; }
if($genreid=='2'){ return "movie"; }
if($genreid=='3'){ return "download-new-animation"; }
if($genreid=='4'){ return "anime"; }
if($genreid=='5'){ return "documentary"; }
if($genreid=='6'){ return "irani"; }
if($genreid=='7'){ return "foreign"; }
if($genreid=='8'){ return "indian"; }
if($genreid=='9'){ return "korean"; }
if($genreid=='10'){ return "action"; }
if($genreid=='11'){ return "adventure"; }
if($genreid=='12'){ return "biography"; }
if($genreid=='13'){ return "criminal"; }
if($genreid=='14'){ return "family"; }
if($genreid=='15'){ return "drama"; }
if($genreid=='16'){ return "drama"; }
if($genreid=='17'){ return "political"; }
if($genreid=='18'){ return "love"; }
if($genreid=='19'){ return "comedy"; }
if($genreid=='20'){ return "Superhero"; }
if($genreid=='21'){ return "sci-fi"; }
if($genreid=='22'){ return "western"; }
if($genreid=='23'){ return "fantasy"; }
if($genreid=='24'){ return "history"; } 
if($genreid=='25'){ return "sport"; } 
if($genreid=='26'){ return "thriller"; } 
if($genreid=='27'){ return "war"; } 
if($genreid=='28'){ return "horror"; } 
if($genreid=='29'){ return "turkish"; } 
if($genreid=='30'){ return "top-250-Movies"; } 
if($genreid=='31'){ return "short"; } 
if($genreid=='32'){ return "collection"; } 
if($genreid=='33'){ return "musical"; } 
if($genreid=='34'){ return "medical"; } 
if($genreid=='35'){ return "educational"; } 
if($genreid=='36'){ return "arabic"; } 
if($genreid=='37'){ return "afghanistan"; } 
if($genreid=='38'){ return "Theater"; } 
if($genreid=='39'){ return "Talk-show"; } 
if($genreid=='40'){ return "reality-show"; } 
if($genreid=='41'){ return "game-show"; } 

  }
 
$stmt = $pdo->prepare("SELECT * FROM vvids where enable='1' and id = ?");
$iddd = strip_tags($_GET['vid']);
$stmt->execute([$iddd]);

$vids = $stmt->fetch(PDO::FETCH_ASSOC);

define("VIDEOTITLE",clss($vids['title']));
define("VIDEOTEXT",$vids['text']);
define("VIDEOT2",$vids['text2']);

$globalvideolink = "https://www.namavid.com/play/".$vids['file'].".mp4";
$str_time = $vids['time'];

sscanf($str_time, "%d:%d:%d", $hours, $minutes, $seconds);

$time_seconds = isset($seconds) ? $hours * 3600 + $minutes * 60 + $seconds : $hours * 60 + $minutes;
 if($str_time > '1800')
{ 
    
    if($vids['manba']=='fiilo')
    
{
        if($vids['id'] < '1957317')
    
{
    $vids['manba'] = 'aparat';
$randnumlink = $vids['id'];
$globalvideolink = "https://asset.namavid.com/$randnumlink.mp4";
}}

}


$cnt=0;
if($vids['title'])
{
$cnt=1;
}

if($cnt>0)

{
function getstringbetween($string, $start, $end){    $string = ' ' . $string;
    $ini = strpos($string, $start);
    if ($ini == 0) return '';
    $ini += strlen($start);
    $len = strpos($string, $end, $ini) - $ini;
    return substr($string, $ini, $len);
}
function cleanssss($string) {
   $string = str_replace('"', ' ', $string); 
   $string = str_replace('#', ' ', $string); 
   $string = str_replace('}', ' ', $string); 
$string = str_replace('{', ' ', $string); 
$string = str_replace("'", " ", $string); 
$string = str_replace(',', ' ', $string); 
$string = str_replace('\\', '/', $string); 
   return $string;
}



function getUserIpAddr() {if(!empty($_SERVER['HTTP_CLIENT_IP'])){$ip=$_SERVER['HTTP_CLIENT_IP'];} elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];} else{$ip=$_SERVER['REMOTE_ADDR'];}
return $ip;}
$userip=getUserIpAddr();$ip=$userip;$split=explode(".",$ip);$part1=$split[0];$part2=$split[1];$finalip=$part1.'.'.$part2.'.';$filenameqa='ip/list/'.$finalip.'.txt';$irani=1;if(!@include($filenameqa)){$irani=0;}
$irani=1;
$title=VIDEOTITLE;

if(strlen($vids['text'])>15)
{
define("METADESC",descclean(VIDEOTEXT));
}
if(strlen($vids['text'])<=15){
define("METADESC",clss(VIDEOTITLE));
}

$timesss = strtotime($vids['date']); $dccreatedd =  date("c", $timesss);

$newguid = str_replace(' ','-',$vids['guid']);
$newguid = str_replace('+','-',$newguid);
$newguid = str_replace('%','-',$newguid);

$thistarget='https://'.$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI];
$valedpage="https://www.namavid.com/video/".$vids['id']."/".urlencode($newguid);
$valedpage = str_replace('+','-',$valedpage);
$valedpage = str_replace('+','-',$valedpage);
$valedpage = str_replace('%','-',$valedpage);
$valedpage = str_replace('--','-',$valedpage);
$valedpage = str_replace('---','-',$valedpage);
if($thistarget!=$valedpage)
{
    
 header("HTTP/1.1 301 Moved Permanently");

header("Location: $valedpage");

exit();   
    
}




$meta = '
<link rel="preload" as="image" href="'.$vids["poster2"].'">
<meta name="description" content="'.METADESC.'"/>
<meta http-equiv="content-language" content="fa"/>
<meta name="language" content="fa"/>
<meta property="description" content="'.METADESC.'">
<link rel="canonical" href="https://www.namavid.com/video/'.$vids['id'].'/'.$newguid.'">
<meta property="og:url" content="https://www.namavid.com/video/'.$vids['id'].'/'.$newguid.'">
<meta property="og:title" content="'.clss(VIDEOTITLE).'">
<meta property="og:site_name" content="نماوید">
<meta property="og:description" content="'.METADESC.'">
<meta property="og:image" content="'.$vids["poster2"].'">
<meta property="og:image:secure_url" content="'.$vids["poster2"].'">
<meta property="og:image:width" content="800">
<meta property="og:image:height" content="451">
<meta property="og:image:type" content="image/jpg">
<link rel="alternate" hreflang="fa-IR" href="https://www.namavid.com"/>
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"/>
<link rel="schema.DCTERMS" href="http://purl.org/dc/terms/"/>
<meta name="DC.Identifier" content="https://www.namavid.com/video/'.$vids["id"].'/'.$newguid.'"/>
<meta name="DC.Date.Created" content="'.$dccreatedd.'"/>
<meta name="DC.Type" content="video"/>
<meta name="DC.Title" content="'.clss(VIDEOTITLE).'"/>
<meta name="DC.Description" content="'.METADESC.'"/>
<meta name="DC.Language" content="fa"/>
<meta name="DC.Publisher" content="نماوید"/>
<meta name="video_type" content="video/mp4" />
<meta property="og:type" content="video">
<meta property="og:video" content="'.$globalvideolink.'">
<link rel="amphtml" href="https://www.namavid.com/video/amp/'.$vids["id"].'/'.$newguid.'"/>
<meta property="og:video:url" content="https://www.namavid.com/file/'.$vids["file"].'.mp4">
<meta property="og:video:secure_url" content="'.$globalvideolink.'">
<meta property="og:video:type" content="video/mp4">
<meta property="og:video:width" content="640">
<meta property="og:video:height" content="360">
<meta property="og:video:duration" content="'.seconds_from_time($vids["time"]).'">
<link rel="image_src" href="'.$vids["poster2"].'"/>
<meta name="theme-color" content="#491f66" />
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:site" content="@namavid.videos"/>
<meta name="twitter:title" content="'.clss(VIDEOTITLE).'"/>
<meta name="twitter:description" content="'.METADESC.'"/>
<meta name="twitter:image" content="'.$vids["poster2"].'"/> 
           <script type="application/ld+json">
        {
            "@context": "http://schema.org",
            "@type": "VideoObject",
            "mainEntityOfPage": "https://www.namavid.com/video/'.$vids["id"].'/'.$newguid.'",
            "name": "'.clss(VIDEOTITLE).'",
            "description": "'.METADESC.'",
            "thumbnailUrl": "'.$vids["poster2"].'",
            "uploadDate": "'.$dccreatedd.'",
            "duration": "'.durationnew(seconds_from_time($vids["time"])).'",
            "contentUrl": "'.$globalvideolink.'",
            
            "publisher": {
                "@type": "Organization",
                "name": "نماوید",
                "url": "https://www.namavid.com",
                "logo": {
                    "@type": "ImageObject",
                    "url": "'.$vids["poster2"].'"
                }
            }
        }
        </script>
';

include('n_header.php');

if(isset($_POST['report'])){
	
	$stmt = $pdo->prepare("insert into vabuse (guid,des,time) values(?,?,?)");

$stmt->execute([$_GET['vid'],$_POST["des"],date('Y/m/d-G:i:s')]);

if($_POST["des"]=='رها' || $_POST["des"]=='علی')
{
    $sql = "update vvids set enable='0' where id = ?";
$pdo->prepare($sql)->execute([$_GET['vid']]);
unlink($filename);
}

echo '
<script language="javascript">';echo 'alert("با تشکر ، گزارش با موفقیت ارسال شد .")';echo '
</script>';}
?> <div class="main-content" style="display:block"> <div class="row"> <div class="col-lg-8" style="margin-bottom:30px"><div class="yn-bnr" id="ynpos-13579" style="background-color: #fff;border-radius: 8px;"></div> <?php
if(strlen($vids['hls'])>15)
{
    ?> <script src="https://www.namavid.com/client/jwplayer.js"></script> <div id="srmonline">در حال بارگزاری ...</div><script type="text/javascript">/*<![CDATA[*/jwp=jwplayer("srmonline").setup({"playlist":[{"type":"hls","file":"<?php echo $vids['hls'];?>","tracks":[],"autostart":true}],"height":"100%","width":"100%","aspectratio":"16:9","displaytitle":true,"autostart":true});jwp.on('ready',(e)=>{if(document.getElementById('srmonline')){myDiv=document.createElement("span")
myDiv.innerHTML=''
document.getElementsByClassName("jwplayer")[0].appendChild(myDiv)}})/*]]>*/</script> <style>.jw-logo-button,.jwlogo{visibility:hidden;display:none!important}.jwplayer.jw-flag-aspect-mode{height:100%!important}.jw-settings-topbar .jw-settings-topbar-buttons{height:auto}.jwplayer #flowplayer-rate{display:block;position:absolute;top:22px;right:30px;z-index:10;pointer-events:auto;direction:rtl;color:#fff;font-family:dana VF,tahoma}.jwplayer #flowplayer-rate:hover{cursor:pointer}.jw-flag-play-rejected #flowplayer-rate{visibility:hidden}.jw-flag-user-inactive.jw-state-buffering:not(.jw-flag-media-audio):not(.jw-flag-audio-player):not(.jw-flag-ads-vpaid-controls):not(.jw-flag-casting) #flowplayer-back-button,.jw-flag-user-inactive.jw-state-buffering:not(.jw-flag-media-audio):not(.jw-flag-audio-player):not(.jw-flag-ads-vpaid-controls):not(.jw-flag-casting) #flowplayer-rate,.jw-flag-user-inactive.jw-state-playing:not(.jw-flag-media-audio):not(.jw-flag-audio-player):not(.jw-flag-ads-vpaid-controls):not(.jw-flag-casting) #flowplayer-back-button,.jw-flag-user-inactive.jw-state-playing:not(.jw-flag-media-audio):not(.jw-flag-audio-player):not(.jw-flag-ads-vpaid-controls):not(.jw-flag-casting) #flowplayer-rate{visibility:hidden;pointer-events:none;opacity:0;transition-delay:0s,.25s}</style> <?php } ?> <?php
if(strlen($vids['upera'])>15 && strlen($vids['hls'])<15)
{
echo '<style>.h_iframe-namavid_embed_frame{position:relative;}.h_iframe-namavid_embed_frame .ratio{display:block;width:100%;height:auto;}.h_iframe-namavid_embed_frame iframe{position:absolute;top:0;left:0;width:100%;height:100%;}</style><div class="h_iframe-namavid_embed_frame"><span style="display: block;padding-top: 57%"></span><iframe src="'.$vids['upera'].'" allowFullScreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe></div>
     ';
}
if(strlen($vids['upera'])<15 && strlen($vids['upera'])<15 && strlen($vids['hls'])<15)
{

?> <style>.placeholder{background-color:#f0f0f0;width:100%;height:100%;max-height:420px;background-image:linear-gradient(90deg,#f0f0f0 25%,#e0e0e0 50%,#f0f0f0 75%);background-size:200% 100%;animation:loading 1.5s infinite}@keyframes loading{0%{background-position:200% 0}100%{background-position:-200% 0}}</style> <video preload="none" controls playsinline poster="<?php echo $vids['poster2'];?>" style="width:100%;max-height:420px;border-radius:8px;background:#000;min-height: 30vh;" width="100%" height="100%"> <source src="<?php echo $globalvideolink;?>" type="video/mp4"> </video> <?php } ?> <style>.vinfo-container{background-color:white;border-radius:10px;padding:20px;box-shadow:0 4px 6px rgba(0,0,0,0.1)}.vinfo-title{font-weight:bold;margin-bottom:15px}.vinfo-title a{color:#0a57aa;text-decoration:none;font-size:60%!important;line-height:300%!important}.vinfo-user-section{display:flex;justify-content:space-between;align-items:center;margin-bottom:15px;position:relative;background:whitesmoke;padding:10px;border-radius:8px}.vinfo-user-info{display:flex;align-items:center}.vinfo-user-avatar{width:38px;height:38px;border-radius:50%;margin-left:10px}.vinfo-user-name{font-weight:bold}.vinfo-user-name a{color:#515151;text-decoration:none}.vinfo-actions{display:flex;gap:15px}.vinfo-actions button{background:0;border:0;cursor:pointer;font-size:1.1rem;color:#333;position:relative}.vinfo-description{margin-bottom:15px;line-height:2;font-size: 14px}.vinfo-meta{display:flex;justify-content:space-between;align-items:center}.vinfo-tags{display:flex;gap:10px}.vinfo-tag{text-decoration:none;color:#007bff;display:flex;align-items:center;gap:5px}.vinfo-dropdown-menu{position:absolute;top:100%;left:0;background-color:white;border-radius:8px;box-shadow:0 4px 6px rgba(0,0,0,0.1);min-width:150px;z-index:10;display:none;padding:10px 0;border:1px solid #e0e0e0}.vinfo-dropdown-menu a{display:block;padding:10px 15px;text-decoration:none;color:#333;transition:background-color .3s ease}.vinfo-dropdown-menu a:hover{background-color:#f4f4f4}@media(max-width:600px){.vinfo-user-section{flex-direction:column;align-items:flex-start}.vinfo-actions{margin-top:10px;width:100%;justify-content:space-between}}.vinfo-categories-container{display:flex;justify-content:space-between;align-items:center;margin-bottom:15px;background-color:#f9f9f9;padding:10px;border-radius:8px;margin-top:20px}.vinfo-category-title,.vinfo-genre-title{margin-left:10px}.vinfo-category-item,.vinfo-genre-item{text-decoration:none;color:#0050a5;margin-left:10px;font-size:.9rem}.vinfo-tags{display:flex;flex-wrap:wrap;gap:10px;row-gap:10px;align-items:center}.vinfo-tag{text-decoration:none;color:#007bff;display:flex;align-items:center;gap:5px;margin-bottom:5px;font-size: 0.8em}@media(max-width:600px){.vinfo-meta{flex-direction:column;align-items:flex-start}.vinfo-tags{width:100%;margin-top:10px}}</style> <style>.overlay{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.7);display:none;justify-content:center;align-items:center;z-index:19000}.modal{background:#fff;border-radius:12px;padding:20px;width:90%;max-width:400px;position:relative;box-shadow:0 4px 15px rgba(0,0,0,0.3);animation:fadeIn .4s ease}@keyframes fadeIn{from{transform:scale(0.9);opacity:0}to{transform:scale(1);opacity:1}}.modal-header{display:flex;justify-content:space-between;align-items:center}.modal-header span{font-size:1.5rem;margin:0}.close-btn{background:0;border:0;font-size:2.2rem;cursor:pointer;color:red}.modal-content{margin-top:20px}.share-buttons{display:flex;justify-content:space-around;flex-wrap:wrap;gap:10px}.share-buttons a{display:inline-block;font-size:1.5rem;text-decoration:none;color:#fff;width:60px;height:60px;border-radius:50%;display:flex;justify-content:center;align-items:center;transition:transform .2s ease,background-color .3s ease}.share-buttons a:hover{transform:scale(1.1)}.share-facebook{background-color:#1877f2}.share-whatsapp{background-color:#25d366}.share-instagram{background-color:#e1306c}.share-telegram{background-color:#08c}.share-twitter{background-color:#1da1f2}.share-linkedin{background-color:#0077b5}@media(max-width:500px){.share-buttons{justify-content:center}.modal{padding:15px}.modal-header span{font-size:1.2rem}.share-buttons a{width:50px;height:50px;font-size:1.2rem}}.rprt-overlay{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.7);display:none;justify-content:center;align-items:center;z-index:19000}.rprt-modal{background:#fff;border-radius:16px;padding:20px;width:90%;max-width:400px;position:relative;box-shadow:0 4px 15px rgba(0,0,0,0.3);animation:rprt-slideIn .4s ease}@keyframes rprt-slideIn{from{transform:translateY(20%);opacity:0}to{transform:translateY(0);opacity:1}}.rprt-modal-header{justify-content:space-between;align-items:center;margin-bottom:20px}.rprt-modal-header span{font-size:1.5rem;margin:0;text-align:right;flex:1}.rprt-close-btn{background:0;border:0;font-size:1.5rem;color:#555;cursor:pointer;margin-right:auto;margin-left:10px;float:left}.rprt-modal-content p{font-size:1rem;color:#555;margin-bottom:15px}.rprt-modal-content form textarea{width:100%;height:100px;padding:10px;border:1px solid #ccc;border-radius:8px;font-size:1rem;resize:none;outline:0;transition:border-color .2s ease}.rprt-modal-content form textarea:focus{border-color:#007bff}.rprt-modal-content form button{width:100%;background-color:#007bff;color:white;font-size:1rem;padding:10px;border:0;border-radius:8px;cursor:pointer;margin-top:15px;transition:background-color .3s ease}.rprt-modal-content form button:hover{background-color:#0056b3}@media(max-width:500px){.rprt-modal{padding:15px}.rprt-modal-header span{font-size:1.2rem}.rprt-modal-content p{font-size:.9rem}}.frm-button{background-color:#007bff;color:white;padding:10px 20px;font-size:16px;border:0;border-radius:5px;cursor:pointer;display:flex;align-items:center;gap:10px}.frm-button i{font-size:18px}.frm-modal{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.6);justify-content:center;align-items:center;z-index:19000}.frm-modal-content{background:white;padding:20px;border-radius:10px;width:450px;position:relative;box-shadow:0 5px 15px rgba(0,0,0,0.3)}.frm-modal-content span{margin:0 0 20px;font-size:18px}.frm-modal-content label{font-size:14px;display:block;margin:10px 0 5px}.frm-modal-content select{width:100%;padding:10px;border:1px solid #ccc;border-radius:5px;margin-bottom:15px}.frm-modal-content textarea{width:100%;height:80px;padding:8px;border:1px solid #ccc;border-radius:5px;resize:none}.frm-modal-content .frm-close{position:absolute;top:10px;left:10px;background:0;border:0;font-size:239%;cursor:pointer;color:#888}.frm-modal-content .frm-close:hover{color:black}.frm-copy-btn{background-color:#17a2b8;color:white;padding:8px 10px;border:0;border-radius:5px;cursor:pointer;margin-top:10px;float:right}.frm-copy-msg{color:green;font-size:14px;margin-top:10px;float:left;display:none;background:#36d683;padding:7px;padding-top:7px;padding-bottom:7px;border-radius:8px;padding-top:2px;padding-bottom:2px;font-size:110%}.custom-alert{position:fixed;top:20px;left:50%;transform:translateX(-50%);background-color:#fff;border-radius:10px;box-shadow:0 4px 6px rgba(0,0,0,0.1);padding:15px;max-width:330px;text-align:center;z-index:19000;opacity:0;transition:opacity .3s,transform .3s}.custom-alert.success{background-color:#e6f3e6;border-left:5px solid #4caf50}.custom-alert.error{background-color:#f8e6e6;border-left:5px solid #f44336}.custom-alert-icon{font-size:24px;margin-bottom:10px}.custom-alert.show{opacity:1;transform:translateX(-50%) translateY(0)}.clickbtnred{background-color:#e31717;color:white;border:0;padding:4px 5px;border-radius:20px;cursor:pointer;margin-right:10px}.clickbtn{background-color:#3498db;color:white;border:0;padding:4px 5px;border-radius:20px;cursor:pointer;margin-right:10px}</style> <div class="vinfo-container"> <div class="vinfo-title"> <a href="/video/<?php echo $vids['id'].'/'.$newguid;?>" title="<?php echo cleanssss(VIDEOTITLE);?>"><h1><?php echo $vids['title'];?></h1></a> </div> <div class="vinfo-user-section"> <div class="vinfo-user-info"> <?php
                if($vids['userid']!='')
                {
                    $snid = $vids['userid'];
                }
                if($vids['userid']=='')
                {
                    $snid = '6';
                }
$stmtqq = $pdot->prepare("select * from vuser where id = ?");
$stmtqq->execute([$snid]);
$sender = $stmtqq->fetch(PDO::FETCH_ASSOC);

?> <img src="<?php echo user_avatar($pdot,$sender['id']);?>" alt="<?php echo $sender['name'];?>" class="vinfo-user-avatar"> <span class="vinfo-user-name"><a href="https://www.namavid.com/channel/<?php echo $sender['user'];?>" title="<?php echo $sender['name'];?>"><?php if($sender['verify']=='1'){echo '<i class="icon-ok-circle" style="color: #009448;"></i>&nbsp;';} ?><?php echo $sender['name'];?></a></span> <?php if ($karbar['id']!='') { ?> <?php 
$sqll = "SELECT * from follow WHERE uid = '".$karbar['id']."' and fid = '".$snid."'";

						$stmtwe = $pdot->query($sqll);
						$hastt=$stmtwe->rowCount();
					
					?> <?php if($hastt==0)
					{
					    ?> <button class="clickbtn" id="followButton" data-userid="<?php echo $snid;?>"><i class="icon-user-plus"></i>&nbsp;دنبال کردن</button> <?php } ?> <?php if($hastt>0)
					{
					    ?> <button class="clickbtnred" id="followButton" data-userid="<?php echo $snid;?>"><i class="icon-user-times"></i>&nbsp;لغو دنبال کردن</button> <?php } ?> <script>/*<![CDATA[*/function showCustomAlert(message,type='success'){const existingAlerts=document.querySelectorAll('.custom-alert');existingAlerts.forEach(alert=>alert.remove());const alertDiv=document.createElement('div');alertDiv.classList.add('custom-alert',type,'show');const iconHtml=type==='success'?'<div class="custom-alert-icon"><i class="icon-ok"></i></div>':'<div class="custom-alert-icon"><i class="icon-cancel"></i></div>';alertDiv.innerHTML=`${iconHtml}<div class="custom-alert-text">${message}</div>`;document.body.appendChild(alertDiv);setTimeout(()=>{alertDiv.classList.remove('show');setTimeout(()=>alertDiv.remove(),300);},3000);}
  document.addEventListener("DOMContentLoaded",function(){var followButton=document.getElementById('followButton');followButton.addEventListener('click',function(){var isFollowing=followButton.innerText.trim()==='دنبال کردن';var userId=followButton.getAttribute('data-userid');var xhr=new XMLHttpRequest();xhr.open('POST','https://www.namavid.com/follow.php',true);xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');var data='isFollowing='+isFollowing+'&userId='+userId;xhr.onreadystatechange=function(){if(xhr.readyState===4){if(xhr.status===200){var response=xhr.responseText;if(response==='success'){if(isFollowing){followButton.innerHTML='<i class="icon-user-times"></i>&nbsp;لغو دنبال کردن';followButton.classList.remove('clickbtn');followButton.classList.add('clickbtnred');showCustomAlert('کاربر مورد نظر دنبال شد');}else{followButton.innerHTML='<i class="icon-user-plus"></i>&nbsp;دنبال کردن';followButton.classList.remove('clickbtnred');followButton.classList.add('clickbtn');showCustomAlert('دنبال کردن کاربر مورد نظر لغو شد','error');}}else{alert('خطا در انجام عملیات.');}}else{alert('خطا در ارتباط با سرور.');}}};xhr.send(data);});});/*]]>*/</script> <?php } ?> </div> <div class="vinfo-actions"> <a rel="nofollow noreferrer" href="<?php echo $globalvideolink;?>" target="_blank"> <button><i class="icon-download"></i>&nbsp;دانلود</button></a> <button id="open-modal"><i class="icon-share"></i>&nbsp;اشتراک</button> <button id="vinfo-more-options"> <i class="icon-ellipsis-vert"></i>&nbsp;بیشتر </button> </div> <div class="vinfo-dropdown-menu"> <a id="rprt-open-report-modal" href="#"> <i class="icon-flag"></i> گزارش تخلف </a> <a id="frmOpenModal" href="#"> <i class="icon-code"></i> نمایش در سایت شما </a> </div> </div> <div class="vinfo-description"> <p><?php echo $vids['title'];?></p> <p><?php echo VIDEOTEXT;?></p> <?php if($irani>0){
echo '<div class="videodes">'.VIDEOT2.'</div>';

	    $smvw="SELECT DISTINCT episode FROM download_links WHERE vidid = '".$_GET['vid']."'";
	    $dss=$pdo->query($smvw);
while($downloadd=$dss->fetch())
{?> <?php 
$htmlll = '<center style="font-size: 110% !important;">قسمت '.$downloadd['episode'];
	    $smvwv="SELECT * FROM download_links WHERE vidid = '".$_GET['vid']."'and episode='".$downloadd['episode']."' order by id ASC";
	    $dssv=$pdo->query($smvwv);
while($downloaddv=$dssv->fetch())
{

$htmlll = $htmlll. ' [<a target="_blank" href="'.$downloaddv['download_link'].'">'.$downloaddv['quality'].'</a>]&nbsp;';

?> <?php } echo $htmlll.'</center><br>'; ?> <?php } ?> <?php 


if($vids['shopid'] !='0')
	{?> <?php 
	
$stmt = $pdo->prepare("select * from shop where id = ?");
$iddd = $vids['shopid'];
$stmt->execute([$iddd]);

$shop = $stmt->fetch(PDO::FETCH_ASSOC);
 ?> <table style="width:100%;border:1px solid #999;padding:20px;border-right:0;border-left:0"> <thead> <tr> <th><center>دانلود نیم بها و قانونی</center></th> </tr> </thead> <tbody> <?php if($shop['480link']!='')
	{?> <tr> <td><center><a target="_blank" rel="nofollow noreferrer" href="<?php echo $shop['480link'];?>"><button class="clickbtn" style="margin:5px"> کیفیت 480 - قیمت : <?php echo number_format($shop['480price']).'&nbsp;تومان';?>&nbsp;<i class="icon-download-cloud"></i></button> </a></center></td> </tr> <?php } ?> <?php if($shop['720link']!='')
	{?> <tr> <td><center><a target="_blank" rel="nofollow noreferrer" href="<?php echo $shop['720link'];?>"><button class="clickbtn" style="margin:5px"> کیفیت 720 - قیمت : <?php echo number_format($shop['720price']).'&nbsp;تومان';?>&nbsp;<i class="icon-download-cloud"></i></button> </a></center></td> </tr> <?php } ?> <?php if($shop['1080link']!='')
	{?> <tr> <td><center><a target="_blank" rel="nofollow noreferrer" href="<?php echo $shop['1080link'];?>"><button class="clickbtn" style="margin:5px"> کیفیت 1080 - قیمت : <?php echo number_format($shop['1080price']).'&nbsp;تومان';?>&nbsp;<i class="icon-download-cloud"></i></button> </a></center></td> </tr> <?php } ?> <?php if($shop['HQlink']!='')
	{?> <tr> <td><center><a target="_blank" rel="nofollow noreferrer" href="<?php echo $shop['HQlink'];?>"><button class="clickbtn" style="margin:5px"> کیفیت HQ_1080 - قیمت : <?php echo number_format($shop['HQprice']).'&nbsp;تومان';?>&nbsp;<i class="icon-download-cloud"></i></button> </a></center></td> </tr> <?php } ?> <?php if($shop['alllink']!='')
	{?> <tr> <td><center><a target="_blank" rel="nofollow noreferrer" href="<?php echo $shop['alllink'];?>"><button class="clickbtn" style="margin:5px">همه کیفیت ها - قیمت : <?php echo number_format($shop['allprice']).'&nbsp;تومان';?>&nbsp;<i class="icon-download-cloud"></i></button> </a></center></td> </tr> <?php } ?> </tbody> </table> <?php } ?> <style>.collapsible{background-color:#3e115d;color:white;cursor:pointer;padding:18px;width:100%;border:0;outline:0;font-size:15px;display:flex;justify-content:space-between;margin-right:10px;margin-left:10px;margin-right:auto;margin-left:auto}.active,.collapsible:hover{background-color:#160423}.collapsible::after{content:'\002B';color:white;font-weight:bold;float:right!important;margin-left:5px;text-align:left}.collapsible.active::after{content:"\2212"}.contentt{display:none;overflow:hidden}</style> <?php if($vids['serial']!='0'){$smv="SELECT *
from movieshop
WHERE movieid = '".$vids['serial']."'
ORDER BY id desc";$stmtmv=$pdo->query($smv);
while($shopmv=$stmtmv->fetch()){?> <?php if($shopmv['title']!=''){?> <button type="button" class="collapsible"><?php echo $shopmv['title'];?></button> <div class="contentt"> <?php if($shopmv['480link']!=''){?> <tr> <td> <center> <a target="_blank" rel="nofollow noreferrer" href="
				<?php echo $shopmv['480link'];?>"> <button class="" style="font-size:15px;background:#003d8d;padding:7px;width:100%;text-align:right;color:white;border:0;cursor:pointer;direction:ltr;text-align:center"> کیفیت 480 - قیمت : <?php echo number_format($shopmv['480price']).'&nbsp;تومان';?>&nbsp; <i class="icon-download-cloud"></i> </button> </a> </center> </td> </tr> <?php }?> <?php if($shopmv['720link']!=''){?> <tr> <td> <center> <a target="_blank" rel="nofollow noreferrer" href="
				<?php echo $shopmv['720link'];?>"> <button class="" style="font-size:15px;background:#003d8d;padding:7px;width:100%;text-align:right;color:white;border:0;cursor:pointer;direction:ltr;text-align:center"> کیفیت 720 - قیمت : <?php echo number_format($shopmv['720price']).'&nbsp;تومان';?>&nbsp; <i class="icon-download-cloud"></i> </button> </a> </center> </td> </tr> <?php }?> <?php if($shopmv['1080link']!=''){?> <tr> <td> <center> <a target="_blank" rel="nofollow noreferrer" href="
				<?php echo $shopmv['1080link'];?>"> <button class="" style="font-size:15px;background:#003d8d;padding:7px;width:100%;text-align:right;color:white;border:0;cursor:pointer;direction:ltr;text-align:center"> کیفیت 1080 - قیمت : <?php echo number_format($shopmv['1080price']).'&nbsp;تومان';?>&nbsp; <i class="icon-download-cloud"></i> </button> </center> </a> </td> </tr> <?php }?> <?php if($shopmv['HQlink']!=''){?> <tr> <td> <center> <a target="_blank" rel="nofollow noreferrer" href="
				<?php echo $shopmv['HQlink'];?>"> <button class="" style="font-size:15px;background:#003d8d;padding:7px;width:100%;text-align:right;color:white;border:0;cursor:pointer;direction:ltr;text-align:center"> کیفیت HQ_1080 - قیمت : <?php echo number_format($shopmv['HQprice']).'&nbsp;تومان';?>&nbsp; <i class="icon-download-cloud"></i> </button> </a> </center> </td> </tr> <?php }?> <?php if($shopmv['bluraylink']!=''){?> <tr> <td> <center> <a target="_blank" rel="nofollow noreferrer" href="
				<?php echo $shopmv['bluraylink'];?>"> <button class="" style="font-size:15px;background:#003d8d;padding:7px;width:100%;text-align:right;color:white;border:0;cursor:pointer;direction:ltr;text-align:center"> کیفیت bluray - قیمت : <?php echo number_format($shopmv['blurayprice']).'&nbsp;تومان';?>&nbsp; <i class="icon-download-cloud"></i> </button> </a> </center> </td> </tr> <?php }?> <?php if($shopmv['alllink']!=''){?> <tr> <td> <center> <a target="_blank" rel="nofollow noreferrer" href="
				<?php echo $shopmv['alllink'];?>"> <button class="" style="font-size:15px;background:#003d8d;padding:7px;width:100%;text-align:right;color:white;border:0;cursor:pointer;direction:ltr;text-align:center">همه کیفیت ها - قیمت : <?php echo number_format($shopmv['allprice']).'&nbsp;تومان';?>&nbsp; <i class="icon-download-cloud"></i> </button> </a> </center> </td> </tr> <?php }?> <?php if($shopmv['oklink']!=''){?> <tr> <td> <center> <a target="_blank" rel="nofollow noreferrer" href="
				<?php echo $shopmv['oklink'];?>"> <button class="" style="font-size:15px;background:#003d8d;padding:7px;width:100%;text-align:right;color:white;border:0;cursor:pointer;direction:ltr;text-align:center"> برای ورود به صفحه دانلود کلیک کنید &nbsp; <i class="icon-download-cloud"></i> </button> </a> </center> </td> </tr> <?php }?> <?php if($shopmv['vplay']!=''){?> <tr> <td> <center> <a target="_blank" rel="nofollow noreferrer" href="
				<?php echo $shopmv['vplay'];?>"> <button class="" style="font-size:15px;background:#003d8d;padding:7px;width:100%;text-align:right;color:white;border:0;cursor:pointer;direction:ltr;text-align:center"> لینک پخش آنلاین &nbsp; <i class="icon-download-cloud"></i> </button> </a> </center> </td> </tr> <?php }?> </div> <?php }}}?> <?php } ?> <script>/*<![CDATA[*/var coll=document.getElementsByClassName("collapsible");var i;for(i=0;i<coll.length;i++){coll[i].addEventListener("click",function(){this.classList.toggle("active");var content=this.nextElementSibling;if(content.style.display==="block"){content.style.display="none";}else{content.style.display="block";}});}/*]]>*/</script> <style>#parent{margin:15px}#parent div{display:contents}#first{text-align:right}#second{text-align:center}#third{text-align:left}</style> <?php
if($vids['ads']!='0' && $vids['ads']!=''){
    $stmte = $pdo->prepare("select * from ads where id = ?");
$iddda = $vids['ads'];
$stmte->execute([$iddda]);

$ads = $stmte->fetch(PDO::FETCH_ASSOC);
	    echo '<hr> <center><a target="_blank" rel="nofollow noreferrer" href="'.$ads['url'].'"><button class="clickbtnred" style="margin:5px;font-size:13px;background:#2c64ac;padding:7px">'.$ads['title'].'</button> </a></center><hr>';
	}
	?> </div> <div class="vinfo-meta"> <div class="vinfo-date"> <i class="icon-calendar"></i>&nbsp;<?php echo ago(strtotime($vids['date']));?> </div> <?php

function generateAndDisplayTags($title) {
    
    $title = preg_replace('/[^آ-یa-zA-Z\s]/u', '', $title);
   
    $words = explode(' ', $title);

  
    $stopWords = ['با', 'از', 'و', 'به', 'در', 'که', 'را', 'های'];
    $filteredWords = array_filter($words, function ($word) use ($stopWords) {
        return mb_strlen($word) > 2 && !in_array($word, $stopWords);
    });

    $tags = [];

   
    $count = count($filteredWords);
    for ($i = 0; $i < $count; $i++) {
        $tags[] = $filteredWords[$i]; 
        if ($i + 1 < $count) {
            $tags[] = $filteredWords[$i] . ' ' . $filteredWords[$i + 1]; 
        }
    }

   
    $tags = array_unique($tags);

   
    usort($tags, function ($a, $b) {
        return strlen($b) - strlen($a);
    });

   
    $selectedTags = array_slice($tags, 0, 4);

   
    echo '<div class="vinfo-tags">';
    foreach ($selectedTags as $tag) {
        echo '<a href="https://www.namavid.com/search/'.str_replace(' ','+',htmlspecialchars($tag)).'" title="'.$tag.'" class="vinfo-tag">';
        echo '<i class="icon-hashtag"></i> ' . htmlspecialchars($tag);
        echo '</a>';
    }
    echo '</div>';
}



generateAndDisplayTags($vids['title']);

?> </div> <div class="vinfo-categories"><div class="vinfo-categories-container"><div class="vinfo-categories-right"><span class="vinfo-category-title"><ul style="list-style:none" itemscope="" itemtype="http://schema.org/BreadcrumbList" class="breadcrumb"><li itemprop="itemListElement" itemscope="" itemtype="http://schema.org/ListItem"><a class="vinfo-category-item" itemprop="item" href="/plist/<?php echo cataddress($vids['cat']);?>" title="<?php echo catname($vids['cat']);?>"><span itemprop="name"><i class="icon-folder-open"></i>&nbsp;<?php echo catname($vids['cat']);?></span></a><meta itemprop="position" content="1"></li></ul></span></div><?php if($vids['genre'] !='0' && $vids['genre'] !=''): ?><div class="vinfo-categories-left"><i class="icon-video"></i><span class="vinfo-category-title">ژانر:</span><?php $allgenre=$vids['genre'];$genresnum=explode(',',$allgenre);foreach($genresnum as $genber){if($genber!=''){echo '<a class="vinfo-genre-item" href="/genre/'.genreaddress($genber).'" title="'.genrename($genber).'"> '.genrename($genber).'</a>';}}?></div><?php endif; ?></div></div> </div> <?php
if(isset($_POST['comment'])){
	
	if(strlen($_POST["matn"])>5)
{
	$stmt = $pdot->prepare("insert into comment (uid,vid,matn,type) values(?,?,?,?)");

$stmt->execute([$karbar['id'],$_GET['vid'],$_POST["matn"],'2']);


echo '
<script language="javascript">';echo 'alert("نظر شما با موفقیت ارسال و بعد از تایید مدیریت نمایش داده می شود.")';echo '
</script>';
} 
}

if(isset($_POST['reply'])){

	if(strlen($_POST["matn"])>5)
{
	$stmt = $pdot->prepare("insert into comment (uid,vid,matn,type,parent) values(?,?,?,?,?)");

$stmt->execute([$karbar['id'],$_GET['vid'],$_POST["matn"],'2',$_POST["parent"]]);


echo '
<script language="javascript">';echo 'alert("نظر شما با موفقیت ارسال و بعد از تایید مدیریت نمایش داده می شود.")';echo '
</script>';
} 
}

?> <style>.comment-container{margin:0 auto;background-color:white;border-radius:8px;box-shadow:0 4px 6px rgba(0,0,0,0.1);padding:20px;margin-top:30px}.comment{position:relative;margin-bottom:15px}.comment-header{display:flex;align-items:center;margin-bottom:10px}.user-avatar{width:40px;height:40px;border-radius:50%;margin-left:10px;background-color:#e1e1e1;display:flex;align-items:center;justify-content:center;color:#666}.comment-user{display:flex;align-items:center;gap:5px;font-weight:bold}.comment-user a{color:#515151;text-decoration:none}.verified-badge{color:#1da1f2;font-size:14px}.comment-body{margin-right:50px;line-height:200%;margin-bottom:20px}.comment-actions{position:absolute;left:0;top:0;height:100%}.reply-btn{color:#65676b;cursor:pointer;transition:color .3s;margin-left:10px;font-size:90%;text-decoration:none}.reply-btn:hover{color:#1da1f2}.nested-comments{margin-right:30px;border-right:2px solid #e1e1e1;padding-right:15px;background:whitesmoke;padding:10px;padding-bottom:10px;padding-bottom:0}.reply-form{background-color:#f0f2f5;border-radius:8px;padding:15px;margin-top:10px}.reply-form textarea{width:100%;border:1px solid #ddd;border-radius:4px;padding:10px;resize:vertical}.submit-btn{background-color:#1da1f2;color:white;border:0;padding:10px 15px;border-radius:4px;cursor:pointer;margin-top:10px}.login-prompt{background-color:#dc3545;color:white;text-align:center;padding:10px;border-radius:4px}.login-prompt a{color:white;text-decoration:none;border:1px solid #cfaaaa;border-radius:8px;padding:4px}.new-comment-form{background-color:#f0f2f5;border-radius:8px;padding:15px;margin-top:20px}.new-comment-form textarea{width:100%;border:1px solid #ddd;border-radius:4px;padding:10px;resize:vertical}.cmmodal{display:none;position:fixed;z-index:19000;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:rgba(0,0,0,0.6)}.cmmodal-content{background-color:#fefefe;margin:15% auto;padding:0;border-radius:8px;width:80%;max-width:500px;box-shadow:0 4px 8px rgba(0,0,0,0.2)}.cmmodal-header{display:flex;justify-content:space-between;align-items:center;background-color:#f0f2f5;padding:15px;border-top-left-radius:8px;border-top-right-radius:8px}.cmmodal-header h2{margin:0;font-size:1.1em}.cmclose-btn{color:#aaa;font-size:24px;font-weight:bold;cursor:pointer}.cmmodal-body{padding:20px}.cmmodal-body textarea{width:100%;border:1px solid #ddd;border-radius:4px;padding:10px;resize:vertical;min-height:100px}</style> <div class="comment-container"> <?php 
        $smv="select * from comment where vid = '".$_GET['vid']."' and type='2' and parent ='0' and approve='1'";
        $cmtt=$pdot->query($smv);
        while($comments=$cmtt->fetch())
        {
            $stmtqqr = $pdot->prepare("select * from vuser where id = ?");
            $stmtqqr->execute([$comments['uid']]);
            $csender = $stmtqqr->fetch(PDO::FETCH_ASSOC);
        ?> <div class="comment" id="comment-<?php echo $comments['id'];?>" name="comment-<?php echo $comments['id'];?>"> <div class="comment-header"> <div class="user-avatar"> <img class="prfl-profile-img" src="<?php echo user_avatar($pdot,$csender['id']);?>" alt="<?php echo $csender['name'].'';?>"> </div> <div class="comment-user"> <?php if($csender['verify']=='1'){ ?> <i class="icon-ok-circle" style="color:#009448"></i> <?php } ?> <a href="https://www.namavid.com/channel/<?php echo $csender['user'];?>"> <?php echo $csender['name'];?> </a> </div> <?php if ($karbar['id']!='') { ?> <div class="comment-actions"> <a href="#comment-<?php echo $comments['id'];?>" class="reply-btn" onclick="openReplyModal('<?php echo $comments['id'];?>','<?php echo $csender['name'];?>')"> <i class="icon-reply"></i>&nbsp;پاسخ </a> </div> <?php } ?> </div> <div class="comment-body"> <?php echo $comments['matn'];?> </div> <?php 
                $smvv="select * from comment where vid = '".$_GET['vid']."' and type='2' and parent='".$comments['id']."' and approve='1'";
                $cmttt=$pdot->query($smvv);
                while($commentss=$cmttt->fetch())
                {
                    $stmtqqrr = $pdot->prepare("select * from vuser where id = ?");
                    $stmtqqrr->execute([$commentss['uid']]);
                    $csenderr = $stmtqqrr->fetch(PDO::FETCH_ASSOC);
                ?> <div class="nested-comments"> <div class="comment"> <div class="comment-header"> <div class="user-avatar"> <img class="prfl-profile-img" src="<?php echo user_avatar($pdot,$csenderr['id']);?>" alt="<?php echo $csenderr['name'].'';?>"> </div> <div class="comment-user"> <?php if($csenderr['verify']=='1'){ ?> <i class="icon-ok-circle" style="color:#009448"></i> <?php } ?> <a href="https://www.namavid.com/channel/<?php echo $csenderr['user'];?>"> <?php echo $csenderr['name'];?> </a> </div> </div> <div class="comment-body"> <?php echo $commentss['matn'];?> </div> </div> </div> <?php } ?> </div> <?php } ?> <?php if ($karbar['id']=='') { ?> <div class="login-prompt"><i class="icon-commenting-o"></i> برای ارسال نظر وارد حساب کاربری خود شوید <a href="/newlogin"><i class="icon-login"></i>&nbsp;ورود/عضویت</a> </div> <?php } else { ?> <form class="new-comment-form" method="POST" action=""> <textarea placeholder="نظر خود را بنویسید..." name="matn" required></textarea> <button type="submit" name="comment" class="submit-btn"> <i class="icon-paper-plane"></i> ارسال نظر </button> </form> <?php } ?> </div> <div id="replyModal" class="cmmodal"> <div class="cmmodal-content"> <div class="cmmodal-header"> <h2 id="replyModalTitle">پاسخ به</h2> <span class="cmclose-btn" onclick="closeReplyModal()">&times;</span> </div> <div class="cmmodal-body"> <form method="POST" action=""> <input type="hidden" id="parentCommentId" name="parent" value=""> <textarea placeholder="پاسخ خود را بنویسید..." name="matn" required></textarea> <button type="submit" name="reply" class="submit-btn"> <i class="icon-paper-plane"></i> ارسال پاسخ </button> </form> </div> </div> </div> <script>function openReplyModal(commentId,username){const modal=document.getElementById('replyModal');const modalTitle=document.getElementById('replyModalTitle');const parentInput=document.getElementById('parentCommentId');modalTitle.textContent=`پاسخ به:${username}`;parentInput.value=commentId;modal.style.display='block';}
function closeReplyModal(){const modal=document.getElementById('replyModal');modal.style.display='none';}
window.onclick=function(event){const modal=document.getElementById('replyModal');if(event.target==modal){modal.style.display='none';}}</script> </div> <style>.related-videos-rtl{max-width:800px;margin:0 auto}.video-item-rtl{display:flex;background-color:white;margin-bottom:15px;box-shadow:0 2px 5px rgba(0,0,0,0.1);overflow:hidden;height:140px}.video-thumbnail-rtl{width:186px;height:100%;position:relative}.video-thumbnail-rtl img{height:100%;object-fit:cover}.video-time-rtl{position:absolute;bottom:5px;left:5px;background-color:rgba(0,0,0,0.7);color:white;padding:2px 5px;border-radius:3px;font-size:12px}.video-details-rtl{padding:10px;display:flex;flex-direction:column;justify-content:space-between;flex-grow:1;overflow:hidden}.video-title-rtl{font-weight:bold;line-height:1.4em;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}.video-title-rtl a{color:black;text-decoration:none;font-size:64%;line-height:200%!important}.video-upload-time-rtl{font-size:.8em;align-self:flex-end}@media screen and (max-width:400px){.video-thumbnail-rtl img{width:100%!important;object-fit:cover}.video-item-rtl{flex-direction:column;height:auto}.video-thumbnail-rtl{width:100%!important;height:200px}.video-details-rtl{padding:10px;text-align:center}.video-upload-time-rtl{align-self:center}}</style> <div class="col-lg-4"> <div class="related-videos-rtl"> <?php 

$sqllq = "SELECT id,date,title,guid,manba,thumb2,time
from vvids
WHERE enable ='1'
ORDER BY id DESC LIMIT 15";


						
						$stmtq = $pdo->query($sqllq);
						
						


while ($row1 = $stmtq->fetch())
{
	
		
		?> <div class="video-item-rtl"> <a href="/<?php if($row1['manba']=='post'){echo 'post';} else {echo 'video';}?>/<?php echo $row1['id'];?>/<?php echo $row1['guid'];?>" title="<?php echo cleanssss($row1['title']);?>"> <div class="video-thumbnail-rtl lazyarea"> <img id="lazy" loading="lazy" width="186" height="140" alt="<?php echo cleanssss($row1['title']);?>" data-src="<?php echo $row1['thumb2'];?>"> <div class="video-time-rtl"><?php echo $row1['time'];?></div> </div> </a> <div class="video-details-rtl"> <div class="video-title-rtl"><h2 class="vt"><a href="/<?php if($row1['manba']=='post'){echo 'post';} else {echo 'video';}?>/<?php echo $row1['id'];?>/<?php echo $row1['guid'];?>" title="<?php echo cleanssss($row1['title']);?>"><?php echo $row1['title'];?></a></h2></div> <div class="video-upload-time-rtl"><i class="icon-clock"></i>&nbsp;<?php echo ago(strtotime($row1['date']));?></div> </div> </div> <?php } ?> </div> </div> </div> </div> <div class="overlay" id="modal-overlay"> <div class="modal"> <div class="modal-header"> <span><i class="icon-share"></i>&nbsp;اشتراک‌گذاری</span> <button class="close-btn" id="close-modal">&times;</button> </div> <div class="modal-content"> <div class="share-buttons"> <a rel="nofollow noreferrer" href="whatsapp://send?text=https://www.namavid.com/video/<?php echo $_GET['vid'];?>" target="_blank" title="ارسال به واتس اپ" class="share-whatsapp" title="WhatsApp"><i class="icon-whatsapp"></i></a> <a rel="nofollow noreferrer" target="_blank" href="https://telegram.me/share/url?url=https://www.namavid.com/video/<?php echo $_GET['vid'];?>&amp;text=" title="ارسال به تلگرام" class="share-telegram" title="Telegram"><i class="icon-telegram"></i></a> <a rel="nofollow noreferrer" href="https://www.twitter.com/intent/tweet?url=https://www.namavid.com/video/<?php echo $vids['id'];?>&amp;text=<?php echo str_replace(" ","+",VIDEOTITLE);?>" target="_blank" class="share-twitter" title="Twitter"><i class="icon-twitter"></i></a> <a rel="nofollow noreferrer" target="_blank" href="https://www.linkedin.com/shareArticle?mini=true&url=https://www.namavid.com/video/<?php echo $vids['id'];?>&title=<?php echo str_replace(" ","+",VIDEOTITLE);?>" class="share-linkedin" title="LinkedIn"><i class="icon-linkedin"></i></a> </div> </div> </div> </div> <script>const modalOverlay=document.getElementById('modal-overlay');const openModal=document.getElementById('open-modal');const closeModal=document.getElementById('close-modal');openModal.addEventListener('click',()=>{modalOverlay.style.display='flex';});closeModal.addEventListener('click',()=>{modalOverlay.style.display='none';});modalOverlay.addEventListener('click',(e)=>{if(e.target===modalOverlay){modalOverlay.style.display='none';}});</script> <div class="rprt-overlay" id="rprt-report-modal-overlay"> <div class="rprt-modal"> <div class="rprt-modal-header"> <button class="rprt-close-btn" id="rprt-close-report-modal"><i class="icon-cancel"></i></button> <span><i class="icon-flag"></i>&nbsp;گزارش تخلف</span> </div> <div class="rprt-modal-content"> <p><i class="icon-info"></i> لطفاً دلیل گزارش خود را بنویسید:</p> <form action="" method="POST"> <textarea name="des" required="" placeholder="توضیحات خود را اینجا بنویسید..."></textarea> <button name="report" type="submit"><i class="icon-ok"></i> ارسال گزارش</button> </form> </div> </div> </div> <script>const rprtReportModalOverlay=document.getElementById('rprt-report-modal-overlay');const rprtOpenReportModal=document.getElementById('rprt-open-report-modal');const rprtCloseReportModal=document.getElementById('rprt-close-report-modal');rprtOpenReportModal.addEventListener('click',()=>{rprtReportModalOverlay.style.display='flex';});rprtCloseReportModal.addEventListener('click',()=>{rprtReportModalOverlay.style.display='none';});rprtReportModalOverlay.addEventListener('click',(e)=>{if(e.target===rprtReportModalOverlay){rprtReportModalOverlay.style.display='none';}});</script> <script>const moreOptionsBtn=document.getElementById('vinfo-more-options');const dropdownMenu=document.querySelector('.vinfo-dropdown-menu');moreOptionsBtn.addEventListener('click',function(e){e.stopPropagation();dropdownMenu.style.display=dropdownMenu.style.display==='none'||dropdownMenu.style.display===''?'block':'none';});document.addEventListener('click',function(){dropdownMenu.style.display='none';});</script> <div class="frm-modal" id="frmModal"> <div class="frm-modal-content"> <button class="frm-close" id="frmCloseModal">&times;</button> <span><i class="icon-code"></i>&nbsp;کد پخش ویدیو در سایت شما</span> <label for="frmSelSize">اندازه آیفریم:</label> <select id="frmSelSize"> <option value="640,360">640x360</option> <option value="570,320">570x320</option> <option value="480,270">480x270</option> <option value="240,135">240x135</option> <option value="responsive" selected>واکنشگرا (responsive)</option> </select> <label>کد آیفریم:</label> <textarea id="frmIframeCode" readonly></textarea> <div> <button class="frm-copy-btn" id="frmCopyCode"><i class="icon-docs"></i> کپی</button> <span class="frm-copy-msg" id="frmCopyMsg">کپی شد!</span> </div> </div> </div> <script>/*<![CDATA[*/const frmOpenModal=document.getElementById('frmOpenModal');const frmCloseModal=document.getElementById('frmCloseModal');const frmModal=document.getElementById('frmModal');const frmSelSize=document.getElementById('frmSelSize');const frmIframeCode=document.getElementById('frmIframeCode');const frmCopyCode=document.getElementById('frmCopyCode');const frmCopyMsg=document.getElementById('frmCopyMsg');const defaultResponsiveCode=`<style>.iframe-filo iframe{width:100%;aspect-ratio:16/9;}</style><div class="iframe-filo"><iframe src="https://www.namavid.com/embed/<?php echo $_GET['vid'];?>"allowFullScreen="true"webkitallowfullscreen="true"mozallowfullscreen="true"scrolling="no"></iframe></div>`;frmIframeCode.value=defaultResponsiveCode;frmOpenModal.addEventListener('click',()=>{frmModal.style.display='flex';});frmCloseModal.addEventListener('click',()=>{frmModal.style.display='none';});frmSelSize.addEventListener('change',()=>{const value=frmSelSize.value;let iframe='';if(value==='responsive'){iframe=defaultResponsiveCode;}else{const[width,height]=value.split(',');iframe=`<iframe src="https://www.namavid.com/embed/<?php echo $_GET['vid'];?>"allowFullScreen="true"width="${width}"height="${height}"webkitallowfullscreen="true"mozallowfullscreen="true"scrolling="no"></iframe>`;}
frmIframeCode.value=iframe;});frmCopyCode.addEventListener('click',()=>{frmIframeCode.select();document.execCommand('copy');frmCopyMsg.style.display='inline';setTimeout(()=>{frmCopyMsg.style.display='none';},2000);});window.addEventListener('click',(e)=>{if(e.target===frmModal){frmModal.style.display='none';}});/*]]>*/</script> <?php 
  
} 
else
{
	include("404.php");
	
}
if ($cnt > 0) {
    $video_id = $_GET['vid'];
?>
<script>
// اسکریپت ردیابی سمت کلاینت
(function() {
    const videoId = '<?php echo $video_id; ?>';
    
    // تابع ارسال درخواست
    function sendTracking(action, data = {}) {
        const payload = {
            action: action,
            video_id: videoId,
            ...data
        };
        
        // استفاده از sendBeacon برای عدم مسدود کردن صفحه
        if (navigator.sendBeacon) {
            navigator.sendBeacon('/api/track.php', JSON.stringify(payload));
        } else {
            fetch('/api/track.php', {
                method: 'POST',
                headers: { 'Content-Type': 'application/json' },
                body: JSON.stringify(payload),
                keepalive: true
            });
        }
    }
    
    // 1. ثبت بازدید صفحه (با تشخیص گوگل)
    sendTracking('view', { referrer: document.referrer });
    
    // 2. ثبت زمان در صفحه (بعد از ۱۰ ثانیه)
    let startTime = Date.now();
    let hasSentTime = false;
    
    const checkTime = setInterval(function() {
        const duration = (Date.now() - startTime) / 1000;
        if (duration > 10 && !hasSentTime) {
            sendTracking('time', { duration: Math.floor(duration) });
            hasSentTime = true;
            clearInterval(checkTime);
        }
    }, 5000);
    
    // اگر کاربر صفحه را قبل از ۱۰ ثانیه ببندد
    window.addEventListener('beforeunload', function() {
        clearInterval(checkTime);
    });
    
    // 3. ثبت پخش ویدئو (رویداد play)
    const videoElement = document.querySelector('video');
    if (videoElement) {
        videoElement.addEventListener('play', function() {
            sendTracking('play');
        });
    }
})();
</script>
<?php
}

include('n_footer.php');
?>