ÿØÿà JFIF ÿÛ „ ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/netphim/include/functions/ |
<?php function history_phim($limit=5){ global $DB,$ob_user,$memcache,$ip; if(!isset($ob_user->user_id) or $ob_user->user_id==0){ $where = " ip='".$ip."' "; }else{ $where = " ip='".$ip."' OR user_id='".$ob_user->user_id."' "; } $txt_history = ''; $key_history_phim = md5("SELECT * FROM tb_history WHERE " . $where . " ORDER BY history_time DESC LIMIT 0,$limit"); if($memcache->get($key_history_phim)){ $txt_history = $memcache->get($key_history_phim); }else { $q_history = $DB->query("SELECT * FROM tb_history WHERE " . $where . " ORDER BY history_time DESC LIMIT 0,$limit"); while ($r_history = $DB->fetch_row($q_history)) { $txt_xemtiep = ''; if ($r_history['epi'] > 0) { $txt_xemtiep = '<div class="wextra"><a href="/' . $r_history['phim_slug'] . '/' . $r_history['epi'] . '-' . $r_history['epi_slug'] . '/"><span class="year">Xem tiếp táºp ' . ($r_history['epi'] + 1) . '</span></a></div>'; } $txt_history .= '<article class="w_item_b" id="history-right-' . $r_history['phim_id'] . '"> <a href="/' . $r_history['phim_slug'] . '/"> <div class="image"><img src="' . $r_history['phim_thumb'] . '" alt="' . $r_history['phim_name'] . '" /></div> <div class="data"> <h3>' . $r_history['phim_name'] . '</h3> <div class="dt_wb" style="float: right"><a href="javascript:void(0);" class="delete-history" data-id="' . $r_history['phim_id'] . '"><i class="fal fa-trash"></i> Xóa</a></div> ' . $txt_xemtiep . ' </div> </a> </article>'; } $memcache->set($key_history_phim,$txt_history,MEMCACHE_COMPRESSED,10); } return $txt_history; } function follow_phim($limit=5){ global $DB,$ob_user,$memcache,$func; if(!isset($ob_user->user_id) or $ob_user->user_id==0){ return false; } $txt_follow = ''; $where = " user_id='".intval($ob_user->user_id)."' "; $key_follow_phim = md5("SELECT phim_data,time_post FROM tb_follow WHERE " . $where . " ORDER BY time_post DESC LIMIT 0,$limit"); if($memcache->get($key_follow_phim)){ $txt_follow = $memcache->get($key_follow_phim); }else { $q_follow = $DB->query("SELECT phim_data,time_post FROM tb_follow WHERE " . $where . " ORDER BY time_post DESC LIMIT 0,$limit"); while ($r_follow = $DB->fetch_row($q_follow)) { if (!empty($r_follow['phim_data'])) { $arr_data = json_decode($r_follow['phim_data'], true); $txt_xemtiep = ''; if ($arr_data['epi'] > 0) { $txt_xemtiep = '<div class="wextra"><a href="/' . $arr_data['phim_slug'] . '/' . $arr_data['epi'] . '-' . $arr_data['epi_slug'] . '/"><span class="year">Xem tiếp táºp ' . ($arr_data['epi'] + 1) . '</span></a></div>'; } $time = $func->time_ago(strtotime($r_follow['time_post'])); $txt_follow .= '<article class="w_item_b" id="follow-right-' . $arr_data['phim_slug'] . '"> <a href="/' . $arr_data['phim_slug'] . '/"> <div class="image"><img src="' . $arr_data['phim_thumb'] . '" alt="' . $arr_data['phim_name'] . '" /></div> <div class="data"> <h3>' . $arr_data['phim_name'] . '</h3> <div class="dt_wb" style="float: right">' . $time . '</div> ' . $txt_xemtiep . ' </div> </a> </article>'; } } $memcache->set($key_follow_phim,$txt_follow,MEMCACHE_COMPRESSED,10); } return $txt_follow; } function related_phim($arr_genres,$phim_id,$limit=9){ global $DB,$memcache; $where = " AND phim_id!='$phim_id' "; $list = ''; if(!empty($arr_genres)){ $arr_sub_where = array(); foreach($arr_genres as $val){ if(!empty($val)){ $arr_sub_where[] = " category LIKE '%".$val."@%' "; } } if(!empty($arr_sub_where)){ $where .= " AND (".implode(' OR ',$arr_sub_where).") "; } $key_related_phim = md5("SELECT name,slug,thumb_url,year FROM tb_phim WHERE 1 ".$where." ORDER BY rand() LIMIT 0,$limit"); if($memcache->get($key_related_phim)){ $list = $memcache->get($key_related_phim); }else { $query = $DB->query("SELECT name,slug,thumb_url,year FROM tb_phim WHERE 1 " . $where . " ORDER BY rand() LIMIT 0,$limit"); while ($row = $DB->fetch_row($query)) { $list .= '<article><a href="/' . $row['slug'] . '/"><img src="' . $row['thumb_url'] . '" alt="' . $row['name'] . '"/></a><div class="data dfeatur"><h3><a href="/' . $row['slug'] . '/">' . $row['name'] . '</a></h3><span>' . $row['year'] . '</span></div></article>'; } $memcache->set($key_related_phim,$list,MEMCACHE_COMPRESSED,600); } } return $list; } function related_phim_right($arr_genres,$phim_id,$type,$limit=5){ global $DB,$memcache; $where = " AND phim_id!='$phim_id' AND type='$type' AND poster_url!='' "; if(!empty($arr_genres)){ $arr_sub_where = array(); foreach($arr_genres as $val){ if(!empty($val)){ $arr_sub_where[] = " category LIKE '%".$val."@%' "; } } if(!empty($arr_sub_where)){ $where .= " AND (".implode(' OR ',$arr_sub_where).") "; } $arr= array('list_top'=>'','list'=>''); $key_related_phim_right = md5("SELECT name,slug,type,thumb_url,poster_url,episode_current,quality,lang,year,phim_danhgia FROM tb_phim WHERE 1 ".$where." ORDER BY rand() LIMIT 1,$limit "); if($memcache->get($key_related_phim_right)){ $arr = $memcache->get($key_related_phim_right); }else { $q_phim = $DB->query("SELECT name,slug,type,thumb_url,poster_url,episode_current,quality,lang,year,phim_danhgia FROM tb_phim WHERE 1 ".$where." ORDER BY rand() LIMIT 0,$limit "); $i = 1; while ($r_phim = $DB->fetch_row($q_phim)) { if ($i == 1) { $arr['list_top'] = '<aside id="dtw_content-2" class="widget doothemes_widget"> <div class="dtw_content"> <article class="w_item_a" id="post-617"> <a href="/' . $r_phim['slug'] . '/" title="' . $r_phim['name'] . '"> <div class="image"> <img src="' . $r_phim['poster_url'] . '" alt="' . $r_phim['name'] . '" /> <div class="data"> <h3>' . $r_phim['name'] . '</h3> <span class="wdate">' . $r_phim['year'] . '</span> </div> </div> </a> </article> </div> </aside>'; } else { $txt_type = ''; if ($r_phim['type'] == 'single') { $txt_type = $r_phim['quality'] . ' ' . $r_phim['lang']; } if ($r_phim['type'] == 'series' or $r_phim['type'] == 'tvshows' or $r_phim['type'] == 'hoathinh') { $txt_type = $r_phim['episode_current'] . ' ' . $r_phim['lang']; } $arr['list'] .= '<article class="w_item_b" id="post-688"> <a href="/' . $r_phim['slug'] . '/"> <div class="image"><img src="' . $r_phim['thumb_url'] . '" alt="' . $r_phim['name'] . '" /></div> <div class="data"> <h3>' . $r_phim['name'] . '</h3> <div class="dt_wb">' . $txt_type . '</div> <div class="wextra"><b>' . round($r_phim['phim_danhgia'], 0) . '</b><span class="year">' . $r_phim['year'] . '</span></div> </div> </a> </article>'; } $i++; } $memcache->set($key_related_phim_right,$arr,MEMCACHE_COMPRESSED,600); } } return $arr; } function namphathanh($limit=6){ $year = date('Y'); $list=''; for($i=0;$i<$limit;$i++){ $list.='<li><a href="/nam-phat-hanh/'.($year-$i).'/">'.($year-$i).'</a></li>'; } return $list; } function phimquantam($limit=10){ global $DB,$memcache; $arr= array('list_top'=>'','list'=>''); $key_phimquantam = md5("SELECT name,slug,type,thumb_url,poster_url,episode_current,quality,lang,year,phim_danhgia FROM tb_phim WHERE poster_url!='' ORDER BY phim_danhgia DESC,phim_count_danhgia DESC,phim_theodoi DESC,phim_hitcomment DESC LIMIT 0,$limit "); if($memcache->get($key_phimquantam)){ $arr = $memcache->get($key_phimquantam); }else { $q_phim = $DB->query("SELECT name,slug,type,thumb_url,poster_url,episode_current,quality,lang,year,phim_danhgia FROM tb_phim WHERE poster_url!='' ORDER BY phim_danhgia DESC,phim_count_danhgia DESC,phim_theodoi DESC,phim_hitcomment DESC LIMIT 0,$limit "); $i = 1; while ($r_phim = $DB->fetch_row($q_phim)) { if ($i == 1) { $arr['list_top'] = '<aside id="dtw_content-2" class="widget doothemes_widget"> <div class="dtw_content"> <article class="w_item_a" id="post-617"> <a href="/' . $r_phim['slug'] . '/"> <div class="image"> <img src="' . $r_phim['poster_url'] . '" alt="' . $r_phim['name'] . '" /> <div class="data"> <h3>' . $r_phim['name'] . '</h3> <span class="wdate">' . $r_phim['year'] . '</span> </div> </div> </a> </article> </div> </aside>'; } else { $txt_type = ''; if ($r_phim['type'] == 'single') { $txt_type = $r_phim['quality'] . ' ' . $r_phim['lang']; } if ($r_phim['type'] == 'series' or $r_phim['type'] == 'tvshows' or $r_phim['type'] == 'hoathinh') { $txt_type = $r_phim['episode_current'] . ' ' . $r_phim['lang']; } $arr['list'] .= '<article class="w_item_b" id="post-688"> <a href="/' . $r_phim['slug'] . '/"> <div class="image"><img src="' . $r_phim['thumb_url'] . '" alt="' . $r_phim['name'] . '" /></div> <div class="data"> <h3>' . $r_phim['name'] . '</h3> <div class="dt_wb">' . $txt_type . '</div> <div class="wextra"><b>' . round($r_phim['phim_danhgia'], 0) . '</b><span class="year">' . $r_phim['year'] . '</span></div> </div> </a> </article>'; } $i++; } $memcache->set($key_phimquantam,$arr,MEMCACHE_COMPRESSED,1200); } return $arr; } ?>