www.gusucode.com > 网猫影视系统NetMao Movie 4.6.6 开源版源码程序 > upload/search.php

    <?php
/*
*######################################
* Netmao Movie 4.x - NetMao Movie System
* Copyright (c) 2007-2008 NetMao.cn
* For further information go to http://www.netmao.cn/
* This copyright notice must stay intact for use.
*######################################
*/
require_once './inc/common.php';

$perpage='10';

if($keyword){
    switch($type){
        case 'name' :
            $where = " where isshow>0 and name like '%$keyword%'";
        break;
        case 'area' :
            $where = " where isshow>0 and area like '%$keyword%'";
        break;
        case 'lang' :
            $where = " where isshow>0 and language like '%$keyword%'";
        break;
        case 'actor' :
            $where = " where isshow>0 and actor like '%$keyword%'";
        break;
        case 'dctor' :
            $where = " where isshow>0 and director like '%$keyword%'";
        break;
        case 'cont' :
            $where = " where isshow>0 and content like '%$keyword%'";
        break;
        default :
            $where = " where isshow>0";
        break;
    }
}else{
    $where = " where isshow>0 order by mid desc";
}

$page = $page ? $page : 1;
$mpurl = "search.php?type=$type&keyword=$keyword";
$offset = $page ? ($page-1)*$perpage : 0;

$num=$db->num_rows($db->query("SELECT mid from {$tablepre}movies $where"));
$num = $keyword ? $num : 0;

$pages = phppage($num,$perpage,$page,$mpurl);
$query="select * from {$tablepre}movies $where limit $offset,$perpage";
$result = $db->query($query);
while($r = $db->fetch_array($result)){
    $r[category]=$_NCACHE['categorys'][$r[cid]];
    $r[movieurl]=movieurl($r[mid]);
    $r[picture]=moviepic($r[picture]);
    $r[srun]=movierun($r[isrun]);
    $r[stime]=date("Y-m-d",$r[addtime]);
    $r[sname]=cutstr($r[name],20);
    $r[scontent]=cutstr($r[content],130);
    $mlists[] = $r;
}

$navtitle = '';
$metakeywords = '';
if($keyword){$navtitle = "Searching ".$keyword;}else{$navtitle = "New Movie";}

include template('search');
?>