ÿŰÿà 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/thietkewebvumi.com/code/ |
<?php class album{ function album() { global $CORE; switch ($CORE->input['code']) { default : $this -> goList(); break; case 'detail' : $this -> goDetail(); break; case 'vote' : $this -> goVote(); break; case 'index' : $this->goIndex(); break; } } function goIndex(){ global $smarty,$DB,$func; $smarty->assign('title','Cuá»c thi áșŁnh gia ÄĂŹnh trá»±c tuyáșżn!'); $q = $DB->query("SELECT * FROM NNCCMS_gallery WHERE `status`=1 ORDER BY time DESC LIMIT 9"); while($r = $DB->fetch_row($q)){ if($r['img_pos1']==1){ $r['img1'] = $r['img1']; } if($r['img_pos2']==1){ $r['img1'] = $r['img2']; } if($r['img_pos3']==1){ $r['img1'] = $r['img3']; } if($r['img_pos4']==1){ $r['img1'] = $r['img4']; } if($r['img_pos5']==1){ $r['img1'] = $r['img5']; } if(empty($r['title_gallery'])){ $r['title_gallery'] = 'KhĂŽng cĂł tĂȘn'; } $r['ftitle'] = $func->format_string($r['title_gallery']); $list[] = $r; } $smarty->assign('list_rand',$list); $q2 = $DB->query("SELECT * FROM NNCCMS_gallery WHERE `status`=1 ORDER BY vote DESC LIMIT 17"); while($r2 = $DB->fetch_row($q2)){ if($r2['img_pos1']==1){ $r2['img1'] = $r2['img1']; } if($r2['img_pos2']==1){ $r2['img1'] = $r2['img2']; } if($r2['img_pos3']==1){ $r2['img1'] = $r2['img3']; } if($r2['img_pos4']==1){ $r2['img1'] = $r2['img4']; } if($r2['img_pos5']==1){ $r2['img1'] = $r2['img5']; } if(empty($r2['title_gallery'])){ $r2['title_gallery'] = 'KhĂŽng cĂł tĂȘn'; } $r2['ftitle'] = $func->format_string($r2['title_gallery']); $list2[] = $r2; } $smarty->assign('list_vote',$list2); $q3 = $DB->query("SELECT * FROM NNCCMS_gallery WHERE `status`=1 ORDER BY rand() DESC LIMIT 30"); while($r3 = $DB->fetch_row($q3)){ if($r3['img_pos1']==1){ $r3['img1'] = $r3['img1']; } if($r3['img_pos2']==1){ $r3['img1'] = $r3['img2']; } if($r3['img_pos3']==1){ $r3['img1'] = $r3['img3']; } if($r3['img_pos4']==1){ $r3['img1'] = $r3['img4']; } if($r3['img_pos5']==1){ $r3['img1'] = $r3['img5']; } if(empty($r3['title_gallery'])){ $r3['title_gallery'] = 'KhĂŽng cĂł tĂȘn'; } $r3['ftitle'] = $func->format_string($r3['title_gallery']); $list3[] = $r3; } $smarty->assign('list_time',$list3); $q4 = $DB->query("SELECT * FROM NNCCMS_gallery WHERE `tuan_1`=1 ORDER BY vote DESC LIMIT 10"); while($r4 = $DB->fetch_row($q4)){ if($r4['img_pos1']==1){ $r4['img1'] = $r4['img1']; } if($r4['img_pos2']==1){ $r4['img1'] = $r4['img2']; } if($r4['img_pos3']==1){ $r4['img1'] = $r4['img3']; } if($r4['img_pos4']==1){ $r4['img1'] = $r4['img4']; } if($r4['img_pos5']==1){ $r4['img1'] = $r4['img5']; } if(empty($r4['title_gallery'])){ $r4['title_gallery'] = 'KhĂŽng cĂł tĂȘn'; } $r4['ftitle'] = $func->format_string($r4['title_gallery']); $list4[] = $r4; } $smarty->assign('list_tuan_1',$list4); $q5 = $DB->query("SELECT * FROM NNCCMS_gallery WHERE `tuan_2`=1 ORDER BY vote DESC LIMIT 10"); while($r5 = $DB->fetch_row($q5)){ if($r5['img_pos1']==1){ $r5['img1'] = $r5['img1']; } if($r5['img_pos2']==1){ $r5['img1'] = $r5['img2']; } if($r5['img_pos3']==1){ $r5['img1'] = $r5['img3']; } if($r5['img_pos4']==1){ $r5['img1'] = $r5['img4']; } if($r5['img_pos5']==1){ $r5['img1'] = $r5['img5']; } if(empty($r5['title_gallery'])){ $r5['title_gallery'] = 'KhĂŽng cĂł tĂȘn'; } $r5['ftitle'] = $func->format_string($r5['title_gallery']); $list5[] = $r5; } $smarty->assign('list_tuan_2',$list5); $q6 = $DB->query("SELECT * FROM NNCCMS_gallery WHERE `tuan_3`=1 ORDER BY vote DESC LIMIT 10"); while($r6 = $DB->fetch_row($q6)){ if($r6['img_pos1']==1){ $r6['img1'] = $r6['img1']; } if($r6['img_pos2']==1){ $r6['img1'] = $r6['img2']; } if($r6['img_pos3']==1){ $r6['img1'] = $r6['img3']; } if($r6['img_pos4']==1){ $r6['img1'] = $r6['img4']; } if($r6['img_pos5']==1){ $r6['img1'] = $r6['img5']; } if(empty($r6['title_gallery'])){ $r6['title_gallery'] = 'KhĂŽng cĂł tĂȘn'; } $r6['ftitle'] = $func->format_string($r6['title_gallery']); $list6[] = $r6; } $smarty->assign('list_tuan_3',$list6); } function goVote(){ global $CORE,$DB; if(!$_SESSION['user']['id']){ exit(); die(); } $id = $CORE->input['id']; $user_id = $_SESSION['user']['login_local'].'_'.$_SESSION['user']['id']; $row_check = $DB->fetch_row($DB->query("SELECT * FROM NNCCMS_gallery_vote WHERE user_id='$user_id' AND id_gallery='$id'")); if(!$row_check){ $DB->query("INSERT INTO `NNCCMS_gallery_vote` ( `user_id`, `id_gallery`, `time`) VALUES ( '$user_id', '$id', '".time()."');"); $DB->query("UPDATE NNCCMS_gallery SET vote=vote+1 WHERE id='$id'"); echo $id; exit(); }else{ echo '0'; exit(); } } function goDetail(){ global $CORE,$smarty,$DB,$func; $id = $CORE->input['id']; $row = $DB->fetch_row($DB->query("SELECT * FROM NNCCMS_gallery WHERE id='$id' AND status = '1'")); $row['time'] = date('d/m/Y',$row['time']); $smarty->assign('title',$row['title_gallery']); $smarty->assign('detail',$row); $DB->query("UPDATE NNCCMS_gallery SET hit=hit+1 WHERE id='$id' "); $_SESSION['url_album'] = $func->current_url(); $smarty->assign('cur_url',$func->current_url()); $login=0; if($_SESSION['user']['id']){ $login=1; } $smarty->assign('login',$login); } function goList(){ global $smarty,$DB,$print,$func,$CORE; $smarty->assign('title','Danh sĂĄch bĂŹnh chá»n'); $type = $CORE->input['type']; $keyword = trim($CORE->input['keyword']); $where = ' WHERE status=1 '; if(!empty($keyword)){ $where .= " AND (fullname LIKE '%$keyword%' OR title_gallery LIKE '%$keyword%' OR id='$keyword') "; } $pageNum = ($_GET['pageNum']>0) ? intval($_GET['pageNum']) : 1; $pageSize = 20; $from = (($pageNum * $pageSize) - $pageSize); $row_total = $DB->fetch_row($DB->query("SELECT count(*) as total FROM NNCCMS_gallery WHERE status=1")); $total = $row_total['total']; $totalPage = ceil($total/$pageSize); if($type!='vote'){ $smarty->assign('type_vote','Album má»i'); $q = $DB->query("SELECT * FROM NNCCMS_gallery ".$where." ORDER BY time DESC LIMIT $from,$pageSize"); }else{ $smarty->assign('type_vote','BĂŹnh chá»n nhiá»u'); $q = $DB->query("SELECT * FROM NNCCMS_gallery ".$where." ORDER BY vote DESC LIMIT $from,$pageSize"); } while($r = $DB->fetch_row($q)){ if($r['img_pos1']==1){ $r['img1'] = $r['img1']; } if($r['img_pos2']==1){ $r['img1'] = $r['img2']; } if($r['img_pos3']==1){ $r['img1'] = $r['img3']; } if($r['img_pos4']==1){ $r['img1'] = $r['img4']; } if($r['img_pos5']==1){ $r['img1'] = $r['img5']; } if(empty($r['title_gallery'])){ $r['title_gallery'] = 'KhĂŽng cĂł tĂȘn'; } $r['ftitle'] = $func->format_string($r['title_gallery']); $list[] = $r; } $smarty->assign('lists',$list); $cur_url = explode('&pageNum',$func->current_url()); $nav = $print->Pagination($totalPage,$pageNum,'pages',$cur_url[0]); $smarty->assign('nav',$nav); } }//end class // Run class $run = new album(); ?>