function insertdata($url, $cjtype)
{
    global $db, $action, $rtype, $rpage, $rkey, $rday, $cjurl, $xt, $cjflag, $backurl;
    if ($xt == "1" || $xt == "2") {
        $xn_vod = '/<video><last>([\\s\\S]*?)<\\/last><id>([0-9]+)<\\/id><tid>([0-9]+)<\\/tid><name><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/name><type>([\\s\\S]*?)<\\/type><pic>([\\s\\S]*?)<\\/pic><lang>([\\s\\S]*?)<\\/lang><area>([\\s\\S]*?)<\\/area><year>([\\s\\S]*?)<\\/year><state>([\\s\\S]*?)<\\/state><note><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/note><actor><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/actor><director><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/director><dl>([\\s\\S]*?)<\\/dl><des><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/des><\\/video>/';
        $xn_url = '/<dd flag="([\\s\\S]*?)"><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/dd>/';
        $xn_vod_time = 1;
        $xn_vod_id = 2;
        $xn_vod_name = 4;
        $xn_vod_type = 3;
        $xn_vod_pic = 6;
        $xn_vod_language = 7;
        $xn_vod_area = 8;
        $xn_vod_year = 9;
        $xn_vod_state = 10;
        $xn_vod_remarks = 11;
        $xn_vod_starring = 12;
        $xn_vod_directed = 13;
        $xn_vod_urls = 14;
        $xn_vod_des = 15;
    } else {
        $xn_vod = '/<vod><id>([0-9]+)<\\/id><name><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/name><note><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/note><state>([\\s\\S]*?)<\\/state><type>([\\s\\S]*?)<\\/type><starring><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/starring><directed><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/directed><pic>([\\s\\S]*?)<\\/pic><time>([\\s\\S]*?)<\\/time><year>([\\s\\S]*?)<\\/year><area><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/area><language><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/language><urls>([\\s\\S]*?)<\\/urls><des><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/des><\\/vod>/';
        $xn_url = '/<url from="([\\s\\S]*?)"><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/url>/';
        $xn_vod_id = 1;
        $xn_vod_name = 2;
        $xn_vod_remarks = 3;
        $xn_vod_state = 4;
        $xn_vod_type = 5;
        $xn_vod_starring = 6;
        $xn_vod_directed = 7;
        $xn_vod_pic = 8;
        $xn_vod_time = 9;
        $xn_vod_year = 10;
        $xn_vod_area = 11;
        $xn_vod_language = 12;
        $xn_vod_des = 14;
        $xn_vod_urls = 13;
    }
    $html = getPage($url, "utf-8");
    if (html == false) {
        echo "err获取数据失败,请点击我重试";
        exit;
    }
    if ($xt == "1" || $xt == "2") {
        $pagecount = intval(getBody($html, "pagecount=\"", "\" pagesize"));
    } else {
        $pagecount = intval(getBody($html, "<pagecount>", "</pagecount>"));
    }
    if ($pagecount == 0) {
        echo "err没有任何可用数据";
        exit;
    }
    preg_match_all($xn_vod, $html, $array3);
    $i = 0;
    foreach ($array3[1] as $key => $value) {
        $rc = false;
        $vodid = $array3[$xn_vod_id][$key];
        $vodname = $array3[$xn_vod_name][$key];
        $vodremarks = $array3[$xn_vod_remarks][$key];
        $vodstate = $array3[$xn_vod_state][$key];
        $vodtype = $cjflag . $array3[$xn_vod_type][$key];
        $vodstarring = $array3[$xn_vod_starring][$key];
        $voddirected = $array3[$xn_vod_directed][$key];
        $vodpic = $array3[$xn_vod_pic][$key];
        $vodtime = $array3[$xn_vod_time][$key];
        $vodyear = $array3[$xn_vod_year][$key];
        $vodarea = $array3[$xn_vod_area][$key];
        $vodlanguage = $array3[$xn_vod_language][$key];
        $voddes = $array3[$xn_vod_des][$key];
        $vodurls = $array3[$xn_vod_urls][$key];
        preg_match_all($xn_url, $vodurls, $array4);
        $vodsubname = "";
        $vodcolor = "";
        $vodhitstime = "";
        $voddownurl = "";
        $vodplayserver = "0";
        $vodfrom = "";
        $vodurl = "";
        $vodname = replaceStr($vodname, "'", "");
        if (strlen($vodname) > 255) {
            $vodname = substring($vodname, 255);
        }
        $vodenname = Hanzi2PinYin($vodname);
        if (strlen($vodenname) > 255) {
            $vodenname = substring($vodenname, 255);
        }
        if (!isN($vodenname)) {
            $vodletter = strtoupper(substring($vodenname, 1));
        }
        $vodstate = replaceStr($vodstate, "[", "");
        $vodstate = replaceStr($vodstate, "]", "");
        if (!isNum($vodstate)) {
            $vodstate = 0;
        }
        $vodstarring = replaceStr($vodstarring, "'", "");
        $vodstarring = replaceStr($vodstarring, "、", " ");
        $vodstarring = replaceStr($vodstarring, ",", " ");
        $vodstarring = replaceStr($vodstarring, ",", " ");
        $vodstarring = replaceStr($vodstarring, "  ", " ");
        if (strlen($vodstarring) > 255) {
            $vodstarring = substring($vodstarring, 255);
        }
        $vodyear = replaceStr($vodyear, "'", "");
        if (strlen($vodyear) > 32) {
            $vodyear = substring($vodyear, 32);
        }
        $vodlanguage = replaceStr($vodlanguage, "'", "");
        if (strlen($vodlanguage) > 32) {
            $vodlanguage = substring($vodlanguage, 32);
        }
        $vodarea = replaceStr($vodarea, "'", "");
        if (strlen($vodarea) > 32) {
            $vodarea = substring($vodarea, 32);
        }
        $vodpic = replaceStr($vodpic, "'", "");
        if (strlen($vodpic) > 255) {
            $vodpic = substring($vodpic, 255);
        }
        $voddes = replaceStr($voddes, "'", "");
        $vodtype = getTypeID($vodtype);
        if (!isNum($vodtype)) {
            $vodtype = 0;
        }
        if ($vodtype > 0) {
            $sql = "SELECT * FROM {pre}vod WHERE d_name ='" . $vodname . "' ";
            $row = $db->getRow($sql);
            if (!$row) {
                foreach ($array4[1] as $key => $value) {
                    if ($rc) {
                        $vodfrom .= "\$\$\$";
                        $vodurl .= "\$\$\$";
                    }
                    $vodfrom .= getFrom($value);
                    if ($xt == "1" || $xt == "2") {
                        $vodurl .= getVUrl($array4[2][$key]);
                    } else {
                        $vodurl .= $array4[2][$key];
                    }
                    $vodurl = replaceStr($vodurl, Chr(10), Chr(13));
                    if (substring($vodurl, 1, strlen($vodurl) - 1) == Chr(13)) {
                        $vodurl = substring($vodurl, strlen($vodurl) - 1);
                    }
                    $vodurl = replaceStr($vodurl, Chr(13), "#");
                    $vodurl = replaceStr($vodurl, "##", "#");
                    $vodurl = replaceStr($vodurl, "'", "''");
                    $rc = true;
                }
                $db->Add("{pre}vod", array("d_type", "d_name", "d_subname", "d_enname", "d_letter", "d_state", "d_color", "d_content", "d_remarks", "d_pic", "d_level", "d_hits", "d_starring", "d_directed", "d_year", "d_area", "d_language", "d_addtime", "d_time", "d_playurl", "d_downurl", "d_playfrom", "d_playserver"), array($vodtype, $vodname, $vodsubname, $vodenname, $vodletter, $vodstate, $vodcolor, $voddes, $vodremarks, $vodpic, 0, 0, $vodstarring, $voddirected, $vodyear, $vodarea, $vodlanguage, date('Y-m-d H:i:s', time()), date('Y-m-d H:i:s', time()), $vodurl, $voddownurl, $vodfrom, $vodplayserver));
                wTips($vodname, "新增数据");
            } else {
                $tmpplayurl = $row["d_playurl"];
                $tmpplayfrom = $row["d_playfrom"];
                $tmpplayserver = $row["d_playserver"];
                foreach ($array4[1] as $key => $value) {
                    $vodfrom = getFrom($value);
                    if ($xt == "1" || $xt == "2") {
                        $vodurl = getVUrl($array4[2][$key]);
                    } else {
                        $vodurl = $array4[2][$key];
                    }
                    $vodurl = replaceStr($vodurl, Chr(10), Chr(13));
                    if (substring($vodurl, 1, strlen($vodurl) - 1) == Chr(13)) {
                        $vodurl = substring($vodurl, strlen($vodurl) - 1);
                    }
                    $vodurl = replaceStr($vodurl, Chr(13), "#");
                    $vodurl = replaceStr($vodurl, "##", "#");
                    $vodurl = replaceStr($vodurl, "'", "''");
                    if ($tmpplayurl == $vodurl) {
                        $resultdes = "无需更新播放地址";
                        continue;
                    } else {
                        if (isN($vodfrom)) {
                            wTips($vodname, "播放器类型为空,跳过");
                            continue;
                        } else {
                            if (isN($tmpplayurl) || strpos("," . $row["d_playfrom"], $vodfrom) <= 0) {
                                $resultdes = "新增播放地址组";
                                $tmpplayurl .= "\$\$\$" . $vodurl;
                                $tmpplayfrom .= "\$\$\$" . $vodfrom;
                                $tmpplayserver .= "\$\$\$" . $vodplayserver;
                            } else {
                                $resultdes = "更新播放地址";
                                $arr1 = explode("\$\$\$", $tmpplayurl);
                                $arr2 = explode("\$\$\$", $tmpplayfrom);
                                $rc = false;
                                $tmpplayurl = "";
                                for ($k = 0; $k < count($arr2); $k++) {
                                    if ($rc) {
                                        $tmpplayurl .= "\$\$\$";
                                    }
                                    if ($arr2[$k] == $vodfrom) {
                                        $arr1[$k] = $vodurl;
                                    }
                                    $tmpplayurl .= $arr1[$k];
                                    $rc = true;
                                }
                            }
                        }
                    }
                }
                $tmpplayurl = replaceStr($tmpplayurl, Chr(13), "#");
                if (strpos("," . $row["d_pic"], "http:") <= 0) {
                    $vodpic = $row["d_pic"];
                }
                $db->Update("{pre}vod", array("d_state", "d_pic", "d_remarks", "d_time", "d_playurl", "d_playfrom", "d_playserver"), array($vodstate, $vodpic, $vodremarks, date('Y-m-d H:i:s', time()), $tmpplayurl, $tmpplayfrom, $tmpplayserver), "d_id=" . $row["d_id"]);
                wTips($vodname, $resultdes);
            }
            unset($row);
        } else {
            wTips($vodname, "没有绑定分类、跳过");
        }
        unset($array4);
    }
    unset($array3);
    echo "ok第" . $rpage . "页完成,共" . $pagecount . "页";
    if ($rpage < $pagecount) {
        $rpage = $rpage + 1;
        cjday();
    }
}
Example #2
0
 $d_remarks = $array3[$xn_d_remarks][$key];
 $d_state = intval($array3[$xn_d_state][$key]);
 $d_type = $xt == '0' ? $array3[$xn_d_type][$key] : $flag . $array3[$xn_d_type][$key];
 $d_type = intval($bindcache[$d_type]);
 $d_starring = htmlspecialchars_decode($array3[$xn_d_starring][$key]);
 $d_directed = htmlspecialchars_decode($array3[$xn_d_directed][$key]);
 $d_pic = $array3[$xn_d_pic][$key];
 $d_time = $array3[$xn_d_time][$key];
 $d_year = intval($array3[$xn_d_year][$key]);
 $d_area = $array3[$xn_d_area][$key];
 $d_lang = $array3[$xn_d_lang][$key];
 $d_content = htmlspecialchars_decode($array3[$xn_d_content][$key]);
 $d_playurls = htmlspecialchars_decode($array3[$xn_d_urls][$key]);
 $d_playurls = str_replace("'", "''", $d_playurls);
 preg_match_all($xn_url, $d_playurls, $array4);
 $d_enname = Hanzi2PinYin($d_name);
 $d_letter = strtoupper(substring($d_enname, 1));
 $d_addtime = time();
 $d_time = $d_addtime;
 $d_hitstime = "";
 $d_hits = rand($MAC['collect']['vod']['hitsstart'], $MAC['collect']['vod']['hitsend']);
 $d_dayhits = rand($MAC['collect']['vod']['hitsstart'], $MAC['collect']['vod']['hitsend']);
 $d_weekhits = rand($MAC['collect']['vod']['hitsstart'], $MAC['collect']['vod']['hitsend']);
 $d_monthhits = rand($MAC['collect']['vod']['hitsstart'], $MAC['collect']['vod']['hitsend']);
 $d_scorenum = rand(1, 500);
 $d_scoreall = $d_scorenum * rand(1, 10);
 $d_score = round($d_scoreall / $d_scorenum, 1);
 $d_hide = $MAC['collect']['vod']['hide'];
 if ($MAC['collect']['vod']['psernd'] == 1) {
     $d_content = repPseRnd('vod', $d_content, $i);
 }
Example #3
0
     $a_dayhits = 0;
 }
 if (!isNum($a_weekhits)) {
     $a_weekhits = 0;
 }
 if (!isNum($a_monthhits)) {
     $a_monthhits = 0;
 }
 if (!isNum($a_up)) {
     $a_up = 0;
 }
 if (!isNum($a_down)) {
     $a_down = 0;
 }
 if (isN($a_enname)) {
     $a_enname = Hanzi2PinYin($a_name);
 }
 if (strpos($a_enname, "*") > 0 || strpos($a_enname, ":") > 0 || strpos($a_enname, "?") > 0 || strpos($a_enname, "\"") > 0 || strpos($a_enname, "<") > 0 || strpos($a_enname, ">") > 0 || strpos($a_enname, "|") > 0 || strpos($a_enname, "\\") > 0) {
     echo "名称和拼音名称中: 不能出现英文输入状态下的 * : ? \" < > | \\ 等特殊符号err";
     exit;
 }
 $a_letter = strtoupper(substring($a_enname, 1));
 if (!isNum($a_type)) {
     $a_type = gettypere("art", $a_type);
 }
 if ($a_type == 0) {
     echo "没有找到转换的分类err";
     exit;
 }
 if ($MAC['collect']['art']['psernd'] == 1) {
     $a_content = repPseRnd('art', $a_content, 0);
Example #4
0
function cj()
{
    global $MAC, $bindcache, $backurl, $typearr, $ac2, $apiurl, $flag, $xt, $ct, $group, $wd, $type, $pg, $hour, $db;
    switch ($ac2) {
        case 'sel':
            $ids = be("arr", "ids");
            if (empty($ids)) {
                errMsg("采集提示", "请选择采集数据");
            }
            switch ($xt) {
                case '1':
                    $url = "?ac=videolist&rid=" . $group . "&ids=" . $ids;
                    break;
                case '2':
                    $url = "-action-ids-vodids-" . $ids . "-cid--play--inputer--wd--h-0-p-1";
                    break;
            }
            break;
        case 'day':
            switch ($xt) {
                case '1':
                    $url = "?ac=videolist&rid=" . $group . "&h=" . $hour . "&pg=" . $pg;
                    break;
                case '2':
                    $url = "-action-day-vodids--cid--play--inputer--wd--h-" . $hour . "-p-" . $pg;
                    break;
            }
            break;
        case 'type':
            if (empty($type)) {
                errMsg("请先进入分类,否则无法使用采集分类!");
            }
            switch ($xt) {
                case '1':
                    $url = "?ac=videolist&rid=" . $group . "&pg=" . $pg . "&t=" . $type;
                    break;
                case '2':
                    $url = "-action-all-vodids--cid-" . $type . "-play--inputer--wd--h-0-p-" . $pg;
                    break;
            }
            break;
        case 'all':
            switch ($xt) {
                case '1':
                    $url = "?ac=videolist&rid=" . $group . "&pg=" . $pg;
                    break;
                case '2':
                    $url = "-action-all-vodids--cid--play--inputer--wd--h-0-p-" . $pg;
                    break;
            }
            break;
    }
    $url = $apiurl . $url;
    if ($xt == "0") {
        $xn_list = '/<pagecount>([0-9]+)<\\/pagecount>/';
        $xn_pagesize = 1;
        $xn_pagecount = 1;
        $xn_recordcount = 1;
        $xn_d = '/<vod><id>([0-9]+)<\\/id><name><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/name><note><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/note><state>([\\s\\S]*?)<\\/state><type>([\\s\\S]*?)<\\/type><starring><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/starring><directed><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/directed><pic>([\\s\\S]*?)<\\/pic><time>([\\s\\S]*?)<\\/time><year>([\\s\\S]*?)<\\/year><area><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/area><language><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/language><urls>([\\s\\S]*?)<\\/urls><des><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/des><\\/vod>/';
        $xn_url = '/<url from="([\\s\\S]*?)"><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/url>/';
        $xn_d_id = 1;
        $xn_d_name = 2;
        $xn_d_remarks = 3;
        $xn_d_state = 4;
        $xn_d_type = 5;
        $xn_d_starring = 6;
        $xn_d_directed = 7;
        $xn_d_pic = 8;
        $xn_d_time = 9;
        $xn_d_year = 10;
        $xn_d_area = 11;
        $xn_d_lang = 12;
        $xn_d_des = 14;
        $xn_d_urls = 13;
    } elseif ($xt == "1") {
        $xn_list = '<list page="([\\s\\S]*?)" pagecount="([0-9]+)" pagesize="([0-9]+)" recordcount="([0-9]+)">';
        $xn_pagesize = 3;
        $xn_pagecount = 2;
        $xn_recordcount = 4;
        $xn_d = '/<video><last>([\\s\\S]*?)<\\/last><id>([0-9]+)<\\/id><tid>([0-9]+)<\\/tid><name><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/name><type>([\\s\\S]*?)<\\/type><pic>([\\s\\S]*?)<\\/pic><lang>([\\s\\S]*?)<\\/lang><area>([\\s\\S]*?)<\\/area><year>([\\s\\S]*?)<\\/year><state>([\\s\\S]*?)<\\/state><note><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/note><actor><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/actor><director><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/director><dl>([\\s\\S]*?)<\\/dl><des><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/des>([\\s\\S]*?)<\\/video>/';
        $xn_url = '/<dd flag="([\\s\\S]*?)"><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/dd>/';
        $xn_d_time = 1;
        $xn_d_id = 2;
        $xn_d_type = 3;
        $xn_d_name = 4;
        $xn_d_pic = 6;
        $xn_d_lang = 7;
        $xn_d_area = 8;
        $xn_d_year = 9;
        $xn_d_state = 10;
        $xn_d_remarks = 11;
        $xn_d_starring = 12;
        $xn_d_directed = 13;
        $xn_d_urls = 14;
        $xn_d_content = 15;
    } elseif ($xt == "2") {
        $url = str_replace('|', '-', $url);
        $xn_list = '<list page="([\\s\\S]*?)" pagecount="([0-9]+)" pagesize="([0-9]+)" recordcount="([0-9]+)">';
        $xn_pagesize = 3;
        $xn_pagecount = 2;
        $xn_recordcount = 4;
        $xn_d = '/<video><last>([\\s\\S]*?)<\\/last><id>([0-9]+)<\\/id><tid>([0-9]+)<\\/tid><name><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/name><type>([\\s\\S]*?)<\\/type><pic>([\\s\\S]*?)<\\/pic><lang>([\\s\\S]*?)<\\/lang><area>([\\s\\S]*?)<\\/area><year>([\\s\\S]*?)<\\/year><state>([\\s\\S]*?)<\\/state><note><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/note><actor><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/actor><director><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/director><dl>([\\s\\S]*?)<\\/dl><des><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/des>([\\s\\S]*?)<\\/video>/';
        $xn_url = '/<dd flag="([\\s\\S]*?)"><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/dd>/';
        $xn_d_time = 1;
        $xn_d_id = 2;
        $xn_d_type = 3;
        $xn_d_name = 4;
        $xn_d_pic = 6;
        $xn_d_lang = 7;
        $xn_d_area = 8;
        $xn_d_year = 9;
        $xn_d_state = 10;
        $xn_d_remarks = 11;
        $xn_d_starring = 12;
        $xn_d_directed = 13;
        $xn_d_urls = 14;
        $xn_d_content = 15;
    }
    $html = getPage($url, "utf-8");
    preg_match($xn_list, $html, $array1);
    $pgsize = $array1[$xn_pagesize];
    $pgcount = $array1[$xn_pagecount];
    $recordcount = $array1[$xn_recordcount];
    unset($array1);
    if (count($recordcount) == 0) {
        echo '没有任何可用数据' . jump('?m=collect-list-xt-' . $xt . "-ct-" . $ct . '-group-' . $group . '-flag-' . $flag . '-apiurl-' . $apiurl, 1);
        return;
    }
    echo '当前采集任务<strong class="green">' . $pg . '</strong>/<span class="green">' . $pgcount . '</span>页 采集地址&nbsp;' . $url;
    ob_flush();
    flush();
    $inrule = $MAC['collect']['vod']['inrule'];
    $uprule = $MAC['collect']['vod']['uprule'];
    $filter = $MAC['collect']['vod']['filter'];
    preg_match_all($xn_d, $html, $array3);
    $i = 0;
    foreach ($array3[1] as $key => $value) {
        $i++;
        $rc = false;
        $d_id = $array3[$xn_d_id][$key];
        $d_name = format_vodname($array3[$xn_d_name][$key]);
        $d_remarks = $array3[$xn_d_remarks][$key];
        $d_state = intval($array3[$xn_d_state][$key]);
        $d_type = intval($bindcache[$flag . $array3[$xn_d_type][$key]]);
        $d_starring = htmlspecialchars_decode($array3[$xn_d_starring][$key]);
        $d_directed = htmlspecialchars_decode($array3[$xn_d_directed][$key]);
        $d_pic = $array3[$xn_d_pic][$key];
        $d_time = $array3[$xn_d_time][$key];
        $d_year = intval($array3[$xn_d_year][$key]);
        $d_area = $array3[$xn_d_area][$key];
        $d_lang = $array3[$xn_d_lang][$key];
        $d_content = htmlspecialchars_decode($array3[$xn_d_content][$key]);
        $d_playurls = htmlspecialchars_decode($array3[$xn_d_urls][$key]);
        $d_playurls = str_replace("'", "''", $d_playurls);
        preg_match_all($xn_url, $d_playurls, $array4);
        $d_enname = Hanzi2PinYin($d_name);
        $d_letter = strtoupper(substring($d_enname, 1));
        $d_addtime = time();
        $d_time = $d_addtime;
        $d_hitstime = "";
        $d_hits = rand($MAC['collect']['vod']['hitsstart'], $MAC['collect']['vod']['hitsend']);
        $d_dayhits = rand($MAC['collect']['vod']['hitsstart'], $MAC['collect']['vod']['hitsend']);
        $d_weekhits = rand($MAC['collect']['vod']['hitsstart'], $MAC['collect']['vod']['hitsend']);
        $d_monthhits = rand($MAC['collect']['vod']['hitsstart'], $MAC['collect']['vod']['hitsend']);
        $d_score = 0;
        $d_scoreall = 0;
        $d_scorenum = 0;
        if ($MAC['collect']['vod']['score'] == 1) {
            $d_scorenum = rand(1, 500);
            $d_scoreall = $d_scorenum * rand(1, 10);
            $d_score = round($d_scoreall / $d_scorenum, 1);
        }
        $d_hide = $MAC['collect']['vod']['hide'];
        if ($MAC['collect']['vod']['psernd'] == 1) {
            $d_content = repPseRnd('vod', $d_content, $i);
        }
        if ($MAC['collect']['vod']['psesyn'] == 1) {
            $d_content = repPseSyn('vod', $d_content);
        }
        $d_downfrom = '';
        $d_downserver = '';
        $d_downnote = '';
        $d_downurl = '';
        $d_playfrom = '';
        $d_playserver = '';
        $d_playnote = '';
        $d_playurl = '';
        $d_tag = '';
        $color = 'red';
        $msg = '';
        if ($d_type < 1) {
            $des = "分类未绑定,系统跳过采集。";
        } elseif (empty($d_name)) {
            $des = "数据不完整,不进行处理。";
        } elseif (strpos(',' . $filter, $d_name)) {
            $des = "数据在过滤单中,系统跳过采集。";
        } else {
            $sql = "SELECT * FROM {pre}vod WHERE d_name ='" . $d_name . "' ";
            if (strpos($inrule, 'b')) {
                $sql .= ' and d_type=' . $d_type;
            }
            if (strpos($inrule, 'c')) {
                $sql .= ' and d_year=' . $d_year;
            }
            if (strpos($inrule, 'd')) {
                $sql .= ' and d_area=\'' . $d_area . '\'';
            }
            if (strpos($inrule, 'e')) {
                $sql .= ' and d_lang=\'' . $d_lang . '\'';
            }
            if (strpos($inrule, 'f')) {
                $sql .= ' and d_starring=\'' . $d_starring . '\'';
            }
            if (strpos($inrule, 'g')) {
                $sql .= ' and d_directed=\'' . $d_directed . '\'';
            }
            if ($MAC['collect']['vod']['tag'] == 1) {
                $d_tag = getTag($d_name, $d_content);
            }
            $row = $db->getRow($sql);
            if (!$row) {
                foreach ($array4[1] as $key => $value) {
                    if ($rc) {
                        $d_playfrom .= "\$\$\$";
                        $d_playserver .= "\$\$\$";
                        $d_playnote .= "\$\$\$";
                        $d_playurl .= "\$\$\$";
                    }
                    $d_playfrom .= getFrom($value);
                    if ($xt == "1") {
                        $d_playurl .= getVUrl($array4[2][$key]);
                    } else {
                        $d_playurl .= $array4[2][$key];
                    }
                    $d_playserver .= '0';
                    $d_playnote .= '';
                    $rc = true;
                }
                if ($MAC['collect']['vod']['pic'] == 1) {
                    $st = strrpos($d_pic, '/');
                    $fname = substring($d_pic, strlen($d_pic) - $st, $st + 1);
                    $path = "upload/vod/" . getSavePicPath('') . "/";
                    $thumbpath = "upload/vodthumb/" . getSavePicPath('vodthumb') . "/";
                    $ps = savepic($d_pic, $path, $thumbpath, $fname, 'vod', $msg);
                    if ($ps) {
                        $d_pic = $path . $fname;
                        $d_picthumb = $thumbpath . $fname;
                    }
                }
                if ($ct == "1") {
                    $d_downfrom = $d_playfrom;
                    $d_downserver = "";
                    $d_downnote = "";
                    $d_downurl = $d_playurl;
                    $d_playfrom = "";
                    $d_playserver = "";
                    $d_playnote = "";
                    $d_playurl = "";
                } else {
                    $d_playserver = "";
                    $d_downfrom = "";
                    $d_downserver = "";
                    $d_downnote = "";
                    $d_downurl = "";
                }
                $db->Add("{pre}vod", array("d_type", "d_name", "d_enname", "d_letter", "d_state", "d_remarks", "d_tag", "d_pic", 'd_picthumb', "d_hits", "d_dayhits", "d_weekhits", "d_monthhits", "d_score", "d_scoreall", "d_scorenum", "d_starring", "d_directed", "d_year", "d_area", "d_lang", "d_addtime", "d_time", "d_hide", "d_content", "d_playfrom", "d_playserver", "d_playnote", "d_playurl", "d_downfrom", "d_downserver", "d_downnote", "d_downurl"), array($d_type, $d_name, $d_enname, $d_letter, $d_state, $d_remarks, $d_tag, $d_pic, $d_picthumb, $d_hits, $d_dayhits, $d_weekhits, $d_monthhits, $d_score, $d_scoreall, $d_scorenum, $d_starring, $d_directed, $d_year, $d_area, $d_lang, $d_addtime, $d_time, $d_hide, $d_content, $d_playfrom, $d_playserver, $d_playnote, $d_playurl, $d_downfrom, $d_downserver, $d_downnote, $d_downurl));
                $color = 'green';
                $des = "无重名,新加入库成功。";
            } else {
                if ($row['d_lock'] == 1) {
                    $des = "数据已经锁定,系统跳过采集更新。";
                } else {
                    if ($ct == "1") {
                        $n_from = $row["d_downfrom"];
                        $n_server = $row["d_downserver"];
                        $n_note = $row['d_downnote'];
                        $n_url = $row["d_downurl"];
                    } else {
                        $n_from = $row["d_playfrom"];
                        $n_server = $row["d_playserver"];
                        $n_note = $row['d_playnote'];
                        $n_url = $row["d_playurl"];
                    }
                    $color = 'red';
                    foreach ($array4[1] as $key => $value) {
                        $d_playfrom = getFrom($value);
                        $d_playserver = '0';
                        if ($xt == "1") {
                            $d_playurl = getVUrl($array4[2][$key]);
                        } else {
                            $d_playurl = $array4[2][$key];
                        }
                        $rc = false;
                        if ($n_url == $d_playurl) {
                            $des = "数据相同,暂不更新数据";
                            continue;
                        } elseif (isN($d_playfrom)) {
                            $des = "播放器类型为空,跳过组合播放地址";
                            continue;
                        } elseif (strpos("," . $n_from, $d_playfrom) <= 0) {
                            $rc = true;
                            $color = 'green';
                            $des = "数据发生改变,新增播放组。";
                            $n_url .= "\$\$\$" . $d_playurl;
                            $n_from .= "\$\$\$" . $d_playfrom;
                            $n_server .= "\$\$\$" . $d_playserver;
                            $n_note .= "\$\$\$" . $d_playnote;
                        } else {
                            $color = 'green';
                            $des = "数据发生改变,更新播放组。";
                            $arr1 = explode("\$\$\$", $n_url);
                            $arr2 = explode("\$\$\$", $n_from);
                            $n_url = "";
                            for ($k = 0; $k < count($arr2); $k++) {
                                if ($rc) {
                                    $n_url .= "\$\$\$";
                                }
                                if (count($arr1) >= $k) {
                                    if ($arr2[$k] == $d_playfrom) {
                                        $arr1[$k] = $d_playurl;
                                    }
                                    $n_url .= $arr1[$k];
                                } else {
                                    $n_url .= $d_playurl;
                                }
                                $rc = true;
                            }
                        }
                    }
                    if ($rc) {
                        $colarr = array();
                        $valarr = array();
                        array_push($colarr, 'd_time');
                        array_push($valarr, time());
                        if (strpos(',' . $uprule, 'a') && $ct != 1) {
                            array_push($colarr, 'd_playfrom', 'd_playserver', 'd_playnote', 'd_playurl');
                            array_push($valarr, $n_from, $n_server, $n_note, $n_url);
                        }
                        if (strpos(',' . $uprule, 'b') && $ct == 1) {
                            array_push($colarr, 'd_downfrom', 'd_downserver', 'd_downnote', 'd_downurl');
                            array_push($valarr, $n_from, $n_server, $n_note, $n_url);
                        }
                        if (strpos(',' . $uprule, 'c')) {
                            array_push($colarr, 'd_state');
                            array_push($valarr, $d_state);
                        }
                        if (strpos(',' . $uprule, 'd')) {
                            array_push($colarr, 'd_remarks');
                            array_push($valarr, $d_remarks);
                        }
                        if (strpos(',' . $uprule, 'e')) {
                            array_push($colarr, 'd_directed');
                            array_push($valarr, $d_directed);
                        }
                        if (strpos(',' . $uprule, 'f')) {
                            array_push($colarr, 'd_starring');
                            array_push($valarr, $d_starring);
                        }
                        if (strpos(',' . $uprule, 'g')) {
                            array_push($colarr, 'd_year');
                            array_push($valarr, $d_year);
                        }
                        if (strpos(',' . $uprule, 'h')) {
                            array_push($colarr, 'd_area');
                            array_push($valarr, $d_area);
                        }
                        if (strpos(',' . $uprule, 'i')) {
                            array_push($colarr, 'd_lang');
                            array_push($valarr, $d_lang);
                        }
                        if (strpos(',' . $uprule, 'j')) {
                            if ($MAC['collect']['vod']['pic'] == 1) {
                                $st = strrpos($d_pic, '/');
                                $fname = substring($d_pic, strlen($d_pic) - $st, $st + 1);
                                $path = "upload/vod/" . getSavePicPath('') . "/";
                                $thumbpath = "upload/vodthumb/" . getSavePicPath('vodthumb') . "/";
                                $ps = savepic($d_pic, $path, $thumbpath, $fname, 'vod', $msg);
                                if ($ps) {
                                    $d_pic = $path . $fname;
                                    $d_picthumb = $thumbpath . $fname;
                                    array_push($colarr, 'd_pic');
                                    array_push($valarr, $d_pic);
                                    array_push($colarr, 'd_picthumb');
                                    array_push($valarr, $d_picthumb);
                                }
                            }
                        }
                        if (strpos(',' . $uprule, 'k')) {
                            array_push($colarr, 'd_content');
                            array_push($valarr, $d_content);
                        }
                        if (strpos(',' . $uprule, 'l')) {
                            array_push($colarr, 'd_tag');
                            array_push($valarr, $d_tag);
                        }
                        if (count($colarr) > 0) {
                            $db->Update("{pre}vod", $colarr, $valarr, "d_id=" . $row["d_id"]);
                        }
                    }
                }
            }
            unset($row);
            unset($array4);
        }
        //echo <<<EOT
        //<div>$i.  $d_name  <font color="$color"> $des</font>  $msg </div>
        //EOT;
        ob_flush();
        flush();
    }
    unset($array3);
    //unset($pinyins);
    if ($pg < $pgcount) {
        $pg = $pg + 1;
        cj();
    } else {
        echo '<br>采集完毕...';
    }
}
function art()
{
    global $db, $safepass, $pass;
    if ($safepass != $pass) {
        echo "非法使用";
        exit;
    }
    $a_id = be("all", "a_id");
    $a_title = be("all", "a_title");
    $a_subtitle = be("all", "a_subtitle");
    $a_entitle = be("all", "a_entitle");
    $a_type = be("all", "a_type");
    $a_content = be("all", "a_content");
    $a_author = be("all", "a_author");
    $a_color = be("all", "a_color");
    $a_hits = be("all", "a_hits");
    $a_dayhits = be("all", "a_dayhits");
    $a_weekhits = be("all", "a_weekhits");
    $a_monthhits = be("all", "a_monthhits");
    $a_from = be("all", "a_from");
    $a_hide = be("all", "a_hide");
    $a_addtime = be("all", "a_addtime");
    $a_time = be("all", "a_time");
    $a_hitstime = be("all", "a_hitstime");
    $a_addtime = date('Y-m-d H:i:s', time());
    $a_time = date('Y-m-d H:i:s', time());
    if (isN($a_title)) {
        echo "文章标题不能为空err";
        exit;
    }
    if (isN($a_type)) {
        echo "文章分类不能为空err";
        exit;
    }
    if (!isNum($a_hits)) {
        $a_hits = 0;
    }
    if (isN($a_hide)) {
        $a_hide = 0;
    } else {
        $a_hide = 1;
    }
    if (isN($a_entitle)) {
        $a_entitle = Hanzi2PinYin($a_title);
    }
    if (strpos($a_entitle, "*") > 0 || strpos($a_entitle, ":") > 0 || strpos($a_entitle, "?") > 0 || strpos($a_entitle, "\"") > 0 || strpos($a_entitle, "<") > 0 || strpos($a_entitle, ">") > 0 || strpos($a_entitle, "|") > 0 || strpos($a_entitle, "\\") > 0) {
        echo "名称和拼音名称中: 不能出现英文输入状态下的 * : ? \" < > | \\ 等特殊符号err";
        exit;
    }
    $a_letter = strtoupper(substring($a_entitle, 1));
    if (!isNum($a_type)) {
        $a_type = gettypere("art", $a_type);
    }
    if ($a_type == 0) {
        echo "没有找到转换的分类err";
        exit;
    }
    $sql = "SELECT * FROM {pre}art WHERE a_title ='" . $a_title . "' ";
    $row = $db->getRow($sql);
    if (!$row) {
        $db->Add("{pre}art", array("a_title", "a_subtitle", "a_entitle", "a_type", "a_letter", "a_content", "a_author", "a_color", "a_from", "a_hits", "a_addtime", "a_time"), array($a_title, $a_subtitle, $a_entitle, $a_type, $a_letter, $a_content, $a_author, $a_color, $a_from, $a_hits, $a_addtime, $a_time));
    } else {
        $db->Update("{pre}art", array("a_content"), array($a_content), "a_id=" . $row["a_id"]);
    }
    unset($row);
    echo "ok";
}
Example #6
0
function insertdata($url, $cjtype)
{
    global $db, $action, $rtype, $rpage, $rkey, $rday, $cjurl, $xt, $rid, $cjflag, $backurl;
    wBreakpoint("../upload/maccjbreakpoint", "admin_maccj.php?action=" . $action . "&xt=" . $xt . "&rid=" . $rid . "&cjflag=" . $cjflag . "&rpage=" . $rpage . "&rtype=" . $rtype . "&rkey=" . $rkey . "&cjurl=" . $cjurl);
    if ($xt == "1") {
        $xn_vod = '/<video><last>([\\s\\S]*?)<\\/last><id>([0-9]+)<\\/id><tid>([0-9]+)<\\/tid><name><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/name><type>([\\s\\S]*?)<\\/type><pic>([\\s\\S]*?)<\\/pic><lang>([\\s\\S]*?)<\\/lang><area>([\\s\\S]*?)<\\/area><year>([\\s\\S]*?)<\\/year><state>([\\s\\S]*?)<\\/state><note><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/note><actor><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/actor><director><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/director><dl>([\\s\\S]*?)<\\/dl><des><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/des>([\\s\\S]*?)<\\/video>/';
        $xn_url = '/<dd flag="([\\s\\S]*?)"><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/dd>/';
        $xn_vod_time = 1;
        $xn_vod_id = 2;
        $xn_vod_name = 4;
        $xn_vod_type = 3;
        $xn_vod_pic = 6;
        $xn_vod_language = 7;
        $xn_vod_area = 8;
        $xn_vod_year = 9;
        $xn_vod_state = 10;
        $xn_vod_remarks = 11;
        $xn_vod_starring = 12;
        $xn_vod_directed = 13;
        $xn_vod_urls = 14;
        $xn_vod_des = 15;
    } else {
        if ($xt == "2") {
            $xn_vod = '/<video><last>([\\s\\S]*?)<\\/last><id>([0-9]+)<\\/id><tid>([0-9]+)<\\/tid><name><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/name><type>([\\s\\S]*?)<\\/type><dt>([\\s\\S]*?)<\\/dt><pic>([\\s\\S]*?)<\\/pic><lang>([\\s\\S]*?)<\\/lang><area>([\\s\\S]*?)<\\/area><year>([\\s\\S]*?)<\\/year><state>([\\s\\S]*?)<\\/state><note><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/note><actor><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/actor><director><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/director><dl>([\\s\\S]*?)<\\/dl><des><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/des><reurl>([\\s\\S]*?)<\\/reurl><\\/video>/';
            $xn_url = '/<dd flag="([\\s\\S]*?)"><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/dd>/';
            $xn_vod_time = 1;
            $xn_vod_id = 2;
            $xn_vod_name = 4;
            $xn_vod_type = 3;
            $xn_vod_pic = 7;
            $xn_vod_language = 8;
            $xn_vod_area = 9;
            $xn_vod_year = 10;
            $xn_vod_state = 11;
            $xn_vod_remarks = 12;
            $xn_vod_starring = 13;
            $xn_vod_directed = 14;
            $xn_vod_urls = 15;
            $xn_vod_des = 16;
        } else {
            $xn_vod = '/<vod><id>([0-9]+)<\\/id><name><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/name><note><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/note><state>([\\s\\S]*?)<\\/state><type>([\\s\\S]*?)<\\/type><starring><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/starring><directed><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/directed><pic>([\\s\\S]*?)<\\/pic><time>([\\s\\S]*?)<\\/time><year>([\\s\\S]*?)<\\/year><area><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/area><language><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/language><urls>([\\s\\S]*?)<\\/urls><des><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/des><\\/vod>/';
            $xn_url = '/<url from="([\\s\\S]*?)"><\\!\\[CDATA\\[([\\s\\S]*?)\\]\\]><\\/url>/';
            $xn_vod_id = 1;
            $xn_vod_name = 2;
            $xn_vod_remarks = 3;
            $xn_vod_state = 4;
            $xn_vod_type = 5;
            $xn_vod_starring = 6;
            $xn_vod_directed = 7;
            $xn_vod_pic = 8;
            $xn_vod_time = 9;
            $xn_vod_year = 10;
            $xn_vod_area = 11;
            $xn_vod_language = 12;
            $xn_vod_des = 14;
            $xn_vod_urls = 13;
        }
    }
    $html = getPage($url, "utf-8");
    if (html == false) {
        echo "<table class=\"tb\"><tr><td colspan=2>&nbsp;<a href=\"javascript:void(0)\" onclick=\"location.reload();\">获取数据失败,请点击我重试</a></td></tr></table>";
        exit;
    }
    if ($xt == "1" || $xt == "2") {
        $pagecount = intval(getBody($html, "pagecount=\"", "\" pagesize"));
    } else {
        $pagecount = intval(getBody($html, "<pagecount>", "</pagecount>"));
    }
    if ($pagecount == 0) {
        echo "<table class=\"tb\"><tr><td><br>没有任何可用数据<script language=\"javascript\">setTimeout(\"gonextpage();\",5000);function gonextpage(){location.href='?action=list&xt=" . $xt . "&rid=" . $rid . "&cjflag=" . $cjflag . "&cjurl=" . $cjurl . "';}</script></td></tr></table>";
        exit;
    }
    echo "<table class=\"tb\"><tr><td colspan=2>视频采集地址&nbsp;" . $url . "</td></tr><tr><td colspan=2>&nbsp;共" . $pagecount . "页,正在采集第" . $rpage . "页</td></tr>";
    preg_match_all($xn_vod, $html, $array3);
    $i = 0;
    foreach ($array3[1] as $key => $value) {
        $rc = false;
        $vodid = $array3[$xn_vod_id][$key];
        $vodname = $array3[$xn_vod_name][$key];
        $vodremarks = $array3[$xn_vod_remarks][$key];
        $vodstate = $array3[$xn_vod_state][$key];
        $vodtype = $cjflag . $array3[$xn_vod_type][$key];
        $vodstarring = $array3[$xn_vod_starring][$key];
        $voddirected = $array3[$xn_vod_directed][$key];
        $vodpic = $array3[$xn_vod_pic][$key];
        $vodtime = $array3[$xn_vod_time][$key];
        $vodyear = $array3[$xn_vod_year][$key];
        $vodarea = $array3[$xn_vod_area][$key];
        $vodlanguage = $array3[$xn_vod_language][$key];
        $voddes = $array3[$xn_vod_des][$key];
        $vodurls = $array3[$xn_vod_urls][$key];
        preg_match_all($xn_url, $vodurls, $array4);
        $vodsubname = "";
        $vodcolor = "";
        $vodhitstime = "";
        $voddownurl = "";
        $vodplayserver = "0";
        $vodfrom = "";
        $vodurl = "";
        $vodname = replaceStr($vodname, "'", "");
        if (strlen($vodname) > 255) {
            $vodname = substring($vodname, 255);
        }
        $vodenname = Hanzi2PinYin($vodname);
        if (strlen($vodenname) > 255) {
            $vodenname = substring($vodenname, 255);
        }
        if (!isN($vodenname)) {
            $vodletter = strtoupper(substring($vodenname, 1));
        }
        $vodstate = replaceStr($vodstate, "[", "");
        $vodstate = replaceStr($vodstate, "]", "");
        if (!isNum($vodstate)) {
            $vodstate = 0;
        }
        $vodstarring = replaceStr($vodstarring, "'", "");
        $vodstarring = replaceStr($vodstarring, "、", " ");
        $vodstarring = replaceStr($vodstarring, ",", " ");
        $vodstarring = replaceStr($vodstarring, ",", " ");
        $vodstarring = replaceStr($vodstarring, "  ", " ");
        if (strlen($vodstarring) > 255) {
            $vodstarring = substring($vodstarring, 255);
        }
        $vodyear = replaceStr($vodyear, "'", "");
        if (strlen($vodyear) > 32) {
            $vodyear = substring($vodyear, 32);
        }
        $vodlanguage = replaceStr($vodlanguage, "'", "");
        if (strlen($vodlanguage) > 32) {
            $vodlanguage = substring($vodlanguage, 32);
        }
        $vodarea = replaceStr($vodarea, "'", "");
        if (strlen($vodarea) > 32) {
            $vodarea = substring($vodarea, 32);
        }
        $vodpic = replaceStr($vodpic, "'", "");
        if (strlen($vodpic) > 255) {
            $vodpic = substring($vodpic, 255);
        }
        $voddes = htmlDecode($voddes);
        $voddes = replaceStr($voddes, "'", "");
        $vodtype = getTypeID($vodtype);
        if (!isNum($vodtype)) {
            $vodtype = 0;
        }
        if ($vodtype > 0) {
            $sql = "SELECT * FROM {pre}vod WHERE d_name ='" . $vodname . "' ";
            $row = $db->getRow($sql);
            if (!$row) {
                foreach ($array4[1] as $key => $value) {
                    if ($rc) {
                        $vodfrom .= "\$\$\$";
                        $vodurl .= "\$\$\$";
                    }
                    $vodfrom .= getFrom($value);
                    if ($xt == "1") {
                        $vodurl .= getVUrl($array4[2][$key]);
                    } else {
                        $vodurl .= $array4[2][$key];
                    }
                    if (substring($vodurl, 1, strlen($vodurl) - 1) == Chr(13)) {
                        $vodurl = substring($vodurl, strlen($vodurl) - 1);
                    }
                    $vodurl = replaceStr($vodurl, Chr(10), "#");
                    $vodurl = replaceStr($vodurl, Chr(13), "#");
                    $vodurl = replaceStr($vodurl, "##", "#");
                    $vodurl = replaceStr($vodurl, "'", "''");
                    $rc = true;
                }
                $db->Add("{pre}vod", array("d_type", "d_name", "d_subname", "d_enname", "d_letter", "d_state", "d_color", "d_content", "d_remarks", "d_pic", "d_level", "d_hits", "d_starring", "d_directed", "d_year", "d_area", "d_language", "d_addtime", "d_time", "d_playurl", "d_downurl", "d_playfrom", "d_playserver"), array($vodtype, $vodname, $vodsubname, $vodenname, $vodletter, $vodstate, $vodcolor, $voddes, $vodremarks, $vodpic, 0, 0, $vodstarring, $voddirected, $vodyear, $vodarea, $vodlanguage, date('Y-m-d H:i:s', time()), date('Y-m-d H:i:s', time()), $vodurl, $voddownurl, $vodfrom, $vodplayserver));
                wTips($vodname, "新增数据");
            } else {
                $tmpplayurl = $row["d_playurl"];
                $tmpplayfrom = $row["d_playfrom"];
                $tmpplayserver = $row["d_playserver"];
                foreach ($array4[1] as $key => $value) {
                    $vodfrom = getFrom($value);
                    if ($xt == "1") {
                        $vodurl = getVUrl($array4[2][$key]);
                    } else {
                        $vodurl = $array4[2][$key];
                    }
                    if (substring($vodurl, 1, strlen($vodurl) - 1) == Chr(13)) {
                        $vodurl = substring($vodurl, strlen($vodurl) - 1);
                    }
                    $vodurl = replaceStr($vodurl, Chr(10), "#");
                    $vodurl = replaceStr($vodurl, Chr(13), "#");
                    $vodurl = replaceStr($vodurl, "##", "#");
                    $vodurl = replaceStr($vodurl, "'", "''");
                    if ($tmpplayurl == $vodurl) {
                        $resultdes = "无需更新播放地址";
                        continue;
                    } else {
                        if (isN($vodfrom)) {
                            wTips($vodname, "播放器类型为空,跳过");
                            continue;
                        } else {
                            if (isN($tmpplayurl) || strpos("," . $row["d_playfrom"], $vodfrom) <= 0) {
                                $resultdes = "新增播放地址组";
                                $tmpplayurl .= "\$\$\$" . $vodurl;
                                $tmpplayfrom .= "\$\$\$" . $vodfrom;
                                $tmpplayserver .= "\$\$\$" . $vodplayserver;
                            } else {
                                $resultdes = "更新播放地址";
                                $arr1 = explode("\$\$\$", $tmpplayurl);
                                $arr2 = explode("\$\$\$", $tmpplayfrom);
                                $rc = false;
                                $tmpplayurl = "";
                                for ($k = 0; $k < count($arr2); $k++) {
                                    if ($rc) {
                                        $tmpplayurl .= "\$\$\$";
                                    }
                                    if ($arr2[$k] == $vodfrom) {
                                        $arr1[$k] = $vodurl;
                                    }
                                    $tmpplayurl .= $arr1[$k];
                                    $rc = true;
                                }
                            }
                        }
                    }
                }
                $tmpplayurl = replaceStr($tmpplayurl, Chr(13), "#");
                if (strpos("," . $row["d_pic"], "http:") <= 0) {
                    $vodpic = $row["d_pic"];
                }
                $db->Update("{pre}vod", array("d_state", "d_pic", "d_remarks", "d_time", "d_playurl", "d_playfrom", "d_playserver"), array($vodstate, $vodpic, $vodremarks, date('Y-m-d H:i:s', time()), $tmpplayurl, $tmpplayfrom, $tmpplayserver), "d_id=" . $row["d_id"]);
                wTips($vodname, $resultdes);
            }
            unset($row);
        } else {
            wTips($vodname, "没有绑定分类、跳过");
        }
        unset($array4);
    }
    unset($array3);
    echo "</table>";
    if ($action == "cjday" || $action == "cjall" || $action == "cjtype") {
        if ($rpage >= $pagecount) {
            dBreakpoint("../upload/maccjbreakpoint");
            echo "<br>数据采集完成<script language=\"javascript\">setTimeout(\"gonextpage();\",3000);function gonextpage(){location.href='?action=list&fa=1&xt=" . $xt . "&rid=" . $rid . "&cjflag=" . $cjflag . "&rtype=" . $rtype . "&cjurl=" . $cjurl . "';}</script>";
        } else {
            echo "<br>暂停3秒后继续采集...<script language=\"javascript\">setTimeout(\"gonextpage();\",3000);function gonextpage(){location.href='?action=" . $action . "&rpage=" . ($rpage + 1) . "&rtype=" . $rtype . "&rday=" . $rday . "&xt=" . $xt . "&rid=" . $rid . "&cjflag=" . $cjflag . "&cjurl=" . $cjurl . "';}</script><a href=\"?action=" . $action . "&rpage=" . ($rpage + 1) . "&rtype=" . $rtype . "&xt=" . $xt . "&rid=" . $rid . "&cjflag=" . $cjflag . "&cjurl=" . $cjurl . "\" >点击进入下一页</a>";
        }
    } else {
        dBreakpoint("../upload/maccjbreakpoint");
        echo "<br>数据采集完成<script language=\"javascript\">setTimeout(\"gonextpage();\",3000);function gonextpage(){location.href='?action=list&fa=1&xt=" . $xt . "&rid=" . $rid . "&cjflag=" . $cjflag . "&rpage=" . $rpage . "&rtype=" . $rtype . "&cjurl=" . $cjurl . "';}</script>";
    }
}
Example #7
0
function save()
{
    //    $username= getCookie("adminname");
    //	writetofile("opearte.log", "operator:".$username.'{;Array===Array;}'.json_encode($_POST,JSON_UNESCAPED_UNICODE));
    //
    global $db;
    $backurl = be("post", "backurl");
    $flag = be("post", "flag");
    $uptime = be("post", "uptime");
    $oldtime = be("post", "oldtime");
    $d_id = be("post", "d_id");
    $d_name = be("post", "d_name");
    $d_subname = be("post", "d_subname");
    $d_enname = be("post", "d_enname");
    $d_type = be("post", "d_type");
    $d_state = be("post", "d_state");
    $d_color = be("post", "d_color");
    $d_pic = be("post", "pic");
    $d_starring = be("post", "d_starring");
    $d_directed = be("post", "d_directed");
    $d_area = be("post", "d_area");
    $d_language = be("post", "d_language");
    $d_level = be("post", "d_level");
    $d_stint = be("post", "d_stint");
    $d_hits = be("post", "d_hits");
    $d_dayhits = be("post", "d_dayhits");
    $d_weekhits = be("post", "d_weekhits");
    $d_monthhits = be("post", "d_monthhits");
    $d_topic = be("post", "d_topic");
    $d_content = be("post", "d_content");
    $d_remarks = be("post", "d_remarks");
    $d_hide = be("post", "d_hide");
    $d_good = be("post", "d_good");
    $d_bad = be("post", "d_bad");
    $d_usergroup = be("post", "d_usergroup");
    $d_year = be("post", "d_year");
    $d_addtime = be("post", "d_addtime");
    $d_time = be("post", "d_time");
    $d_score = be("post", "d_score");
    $d_playurl = be("post", "d_playurl");
    $d_downurl = be("post", "d_downurl");
    $d_scorecount = be("post", "d_scorecount");
    $d_letter = be("post", "d_letter");
    $d_type_name = be("arr", "d_type_name");
    $d_pic_ipad = be("post", "d_pic_ipad");
    $can_play_device = be("post", "can_play_device");
    $d_capital_name = be("post", "d_capital_name");
    $can_search_device = be("arr", "can_search_device");
    $d_status = be("post", "d_status");
    $duraning = be("post", "duraning");
    $d_video_desc_url = be("post", "d_video_desc_url");
    $d_play_check = be("post", "d_play_check");
    $urlid = be("arr", "urlid");
    $url = be("arr", "url");
    $urlfrom = be("arr", "urlfrom");
    if (strpos($urlfrom, "no") !== false) {
        echo 'no';
        return;
    }
    $urlidsarr = explode(",", $urlid);
    $urlarr = explode(",", $url);
    $urlfromarr = explode(",", $urlfrom);
    $urlarr = $_POST["url"];
    $d_douban_id = $_POST["d_douban_id"];
    $downurlid = be("arr", "downurlid");
    $downurl = be("arr", "downurl");
    $downurlfrom = be("arr", "downurlfrom");
    if (strpos($downurlfrom, "no") !== false) {
        echo 'no';
        return;
    }
    $downurlidsarr = explode(",", $downurlid);
    $downurlarr = explode(",", $downurl);
    $downurlfromarr = explode(",", $downurlfrom);
    $downurlarr = $_POST["downurl"];
    $rc = false;
    for ($i = 0; $i < count($urlidsarr); $i++) {
        if (count($urlarr) >= $i && count($urlfromarr) >= $i) {
            if ($rc) {
                $d_playurl .= "\$\$\$";
                $d_playfrom .= "\$\$\$";
                $d_playserver .= "\$\$\$";
            }
            $d_playfrom .= trim($urlfromarr[$i]);
            $d_playurl .= replaceStr(replaceStr(trim($urlarr[$i]), Chr(10), ""), Chr(13), "{Array}");
            // writetofile("ddd.txt", replaceStr(replaceStr(trim($urlarr[$i]), Chr(10), ""), Chr(13), "{Array}"));
            $rc = true;
        }
    }
    $rc = false;
    for ($i = 0; $i < count($downurlidsarr); $i++) {
        if (count($downurlarr) >= $i && count($downurlfromarr) >= $i) {
            if ($rc) {
                $d_downurl .= "\$\$\$";
            }
            if (!isN($downurlfromarr[$i]) && !isN($downurlarr[$i])) {
                $d_downurl .= trim($downurlfromarr[$i]) . "\$\$" . replaceStr(replaceStr(trim($downurlarr[$i]), Chr(10), ""), Chr(13), "{Array}");
                $rc = true;
            }
        }
    }
    $d_addtime = date('Y-m-d H:i:s', time());
    $d_time = date('Y-m-d H:i:s', time());
    if ($uptime == "") {
        $d_time = $oldtime;
    }
    if (isN($d_name)) {
        echo "名称不能为空";
        exit;
    }
    if (isN($d_type)) {
        echo "分类不能为空";
        exit;
    }
    if (!isNum($d_hide)) {
        $d_hide = 0;
    }
    if (!isNum($d_level)) {
        $d_level = 0;
    }
    if (!isNum($d_hits)) {
        $d_hits = 0;
    }
    if (!isNum($d_dayhits)) {
        $d_dayhits = 0;
    }
    if (!isNum($d_weekhits)) {
        $d_weekhits = 0;
    }
    if (!isNum($d_monthhits)) {
        $d_monthhits = 0;
    }
    if (!isNum($d_topic)) {
        $d_topic = 0;
    }
    if (!isNum($d_stint)) {
        $d_stint = 0;
    }
    if (!isNum($d_state)) {
        $d_state = 0;
    }
    if (!isNum($d_score)) {
        $d_score = 0;
    }
    if (!isNum($d_scorecount)) {
        $d_scorecount = 0;
    }
    if (!isNum($d_good)) {
        $d_good = 0;
    }
    if (!isNum($d_bad)) {
        $d_bad = 0;
    }
    if (!isNum($d_usergroup)) {
        $d_usergroup = 0;
    }
    if (isN($d_enname)) {
        $d_enname = Hanzi2PinYin($d_name);
    }
    if (isN($d_capital_name)) {
        $d_capital_name = Hanzi2PinYin_Captial($d_name);
    }
    //var_dump($d_capital_name);
    if (isN($d_letter)) {
        $d_letter = strtoupper(substring($d_enname, 1));
    }
    //$d_play_check
    if (strpos($d_enname, "*") > 0 || strpos($d_enname, ":") > 0 || strpos($d_enname, "?") > 0 || strpos($d_enname, "\"") > 0 || strpos($d_enname, "<") > 0 || strpos($d_enname, ">") > 0 || strpos($d_enname, "|") > 0 || strpos($d_enname, "\\") > 0) {
        echo "名称和拼音名称中: 不能出现英文输入状态下的 * : ? \" < > | \\ 等特殊符号";
        exit;
    }
    if (strpos($d_downurl, "magnet") === false && strpos($d_downurl, "ed2k") === false && strpos($d_downurl, "http") === false && strpos($d_downurl, "rtmp") === false && strpos($d_downurl, "rtsp") === false && strpos($d_downurl, "mmsh") === false && strpos($d_downurl, "mms") === false) {
        //iPad,iphone,apad,aphone,web
        $can_search_device = "iPad,iphone,apad,aphone,web,Vendor";
    }
    if ($d_playfrom === "so_hu_cp") {
        $can_search_device = "TV";
    }
    if ($flag == "edit") {
        $db->Update("{pre}vod", array("d_capital_name", "duraning", "d_status", "can_search_device", "d_douban_id", "can_play_device", "d_video_desc_url", "d_play_check", "d_pic_ipad", "d_type_name", "d_name", "d_subname", "d_enname", "d_type", "d_letter", "d_state", "d_color", "d_pic", "d_starring", "d_directed", "d_area", "d_year", "d_language", "d_level", "d_stint", "d_hits", "d_dayhits", "d_weekhits", "d_monthhits", "d_topic", "d_content", "d_remarks", "d_good", "d_bad", "d_usergroup", "d_score", "d_scorecount", "d_hide", "d_time", "webUrls", "d_downurl", "d_playfrom", "d_playserver"), array($d_capital_name, $duraning, $d_status, $can_search_device, $d_douban_id, $can_play_device, $d_video_desc_url, $d_play_check, $d_pic_ipad, $d_type_name, $d_name, $d_subname, $d_enname, $d_type, $d_letter, $d_state, $d_color, $d_pic, $d_starring, $d_directed, $d_area, $d_year, $d_language, $d_level, $d_stint, $d_hits, $d_dayhits, $d_weekhits, $d_monthhits, $d_topic, $d_content, $d_remarks, $d_good, $d_bad, $d_usergroup, $d_score, $d_scorecount, $d_hide, $d_time, $d_playurl, $d_downurl, $d_playfrom, $d_playserver), "d_id=" . $d_id);
    } else {
        $backurl = "admin_vod.php?action=add";
        $db->Add("{pre}vod", array("d_capital_name", "duraning", "d_status", "can_search_device", "d_douban_id", "can_play_device", "d_video_desc_url", "d_pic_ipad", "d_type_name", "d_name", "d_subname", "d_enname", "d_type", "d_letter", "d_state", "d_color", "d_pic", "d_starring", "d_directed", "d_area", "d_year", "d_language", "d_level", "d_stint", "d_hits", "d_dayhits", "d_weekhits", "d_monthhits", "d_topic", "d_content", "d_remarks", "d_good", "d_bad", "d_usergroup", "d_score", "d_scorecount", "d_addtime", "d_time", "webUrls", "d_downurl", "d_playfrom", "d_playserver"), array($d_capital_name, $duraning, $d_status, $can_search_device, $d_douban_id, $can_play_device, $d_video_desc_url, $d_pic_ipad, $d_type_name, $d_name, $d_subname, $d_enname, $d_type, $d_letter, $d_state, $d_color, $d_pic, $d_starring, $d_directed, $d_area, $d_year, $d_language, $d_level, $d_stint, $d_hits, $d_dayhits, $d_weekhits, $d_monthhits, $d_topic, $d_content, $d_remarks, $d_good, $d_bad, $d_usergroup, $d_score, $d_scorecount, $d_addtime, $d_time, $d_playurl, $d_downurl, $d_playfrom, $d_playserver));
    }
    echo "保存完毕";
}