function GetVid($url) { if (empty($url)) { return false; } $geturl = getfile($url, 'http://video.sina.com.cn', null); //手机版 preg_match('#ipad\\_vid\\:\'(.*?)\'#is', $geturl, $key_str); //电脑版 if (empty($key_str[1])) { preg_match('#vid\\:\'(.*?)\\|#is', $geturl, $key_str); } if (empty($key_str[1])) { preg_match('#vid\\:\'(.*?)\'#is', $geturl, $key_str); } //新浪新闻 if (empty($key_str[1])) { preg_match('#videoId\\:\'(.*?)\'#is', $geturl, $key_str); } //新浪娱乐 // if(empty($key_str[1]))preg_match('#CurrentPlayingVideo[\s]\=[\s](.*?)\'#is', $geturl, $key_str); if (!empty($key_str[1])) { $key = $key_str[1]; } if (empty($key)) { return false; } return $key; }
function GetVid($url) { if (empty($url)) { return false; } $geturl = getfile($url, 'http://www.fun.tv', null); //网址形式 preg_match('#\\"galleryid\\"\\:(.*?)\\,#is', $geturl, $key_str); //网址形式 preg_match('#vplay\\.videoid[\\s]\\=[\\s](.*?)\\;#is', $geturl, $videoid); // //电脑版 // if(empty($key_str[1]))preg_match('#vid\:\'(.*?)\|#is', $geturl, $key_str); // if(empty($key_str[1]))preg_match('#vid\:\'(.*?)\'#is', $geturl, $key_str); // //新浪新闻 // if(empty($key_str[1]))preg_match('#videoId\:\'(.*?)\'#is', $geturl, $key_str); // //新浪娱乐 //// if(empty($key_str[1]))preg_match('#CurrentPlayingVideo[\s]\=[\s](.*?)\'#is', $geturl, $key_str); if (!empty($key_str[1])) { $key = $key_str[1]; } if (!empty($videoid[1])) { $key .= '_' . $videoid[1]; } if (empty($key)) { return false; } return $key; }
function GetVid($url) { if (empty($url)) { return false; } preg_match("/\\/v\\/(.*?)\\//i", $url, $ketStr); if (empty($ketStr)) { for ($i = 0; $i < 3; $i++) { $c = getfile($url, $url, null); if ($c) { break; } } preg_match("/,vcode:[\\s]+\\'([X]{1}.*?)\\'/i", $c, $ketStr); if (empty($ketStr)) { preg_match("/,iid:[\\s]+([0-9]+)/i", $c, $ketStr); } } if (!empty($ketStr[1])) { $key = $ketStr[1]; } if (empty($key)) { return false; } return $key; }
function GetVid($url) { if (empty($url)) { return false; } $key = ''; preg_match('/xiyou\\.cntv\\.cn\\/v-([0-9a-z-]+)\\.html/', $url, $keyStr); if (!empty($keyStr[1])) { $key = $keyStr[1]; } if (!empty($key)) { return $key; } for ($i = 0; $i < 3; $i++) { $c = getfile($url, null, null); if (!empty($c)) { break; } } preg_match('/contentid\\"[\\s]+content=\\"([0-9a-z]+)\\">/i', $c, $keyStr); if (!empty($keyStr[1])) { preg_match('/videoCenterId\\",\\"([0-9a-z]+)\\"/i', $c, $keyStr); } if (!empty($keyStr[1])) { preg_match('/<!--repaste.video.code.begin-->([0-9a-z]+)<!--repaste.video.code.end-->/i', $c, $keyStr); } if (!empty($keyStr[1])) { $key = $keyStr[1]; } if (empty($key)) { return false; } return $key; }
function GetVideo_HTML5($key, $hdstyle) { for ($i = 0; $i < 3; $i++) { $c = getfile('http://m.yinyuetai.com/video/' . $key, 'http://m.yinyuetai.com', null); preg_match('/videoUrl[\\s]:[\\s]\\"(.*?)\\",/', $c, $mp4); if (empty($mp4[1])) { preg_match('/window\\.location\\.herf[\\s]=[\\s]\\"(.*?)\\";/', $c, $mp4); } if (empty($mp4[1])) { preg_match('/video[\\s]preload[\\s]controls[\\s]x-webkit-airplay=\\"allow\\" src=\\"(.*?)\\"/', $c, $mp4); } if (empty($mp4[1])) { preg_match('/a class=\\"video-cover\\"[^>]*href=\\"(.*?)\\">/', $c, $mp4); } if (empty($mp4[1])) { preg_match('/source src=\\"(.*?)\\"/', $c, $mp4); } if (!empty($mp4[1])) { break; } } if (!empty($mp4[1])) { $video['data'][0]['src'] = $mp4[1]; } return $video; }
function GetVideo_FLASH($key, $hdstyle) { $banben = date('Y-m-d'); //插件名字 $video['name'] = "☆解析插件-ku6系统☆-" . $banben; //高清格式信息 $hdstr = array(1 => "normal", 2 => "clear", 3 => "super"); $video['Nowhds'] = $hdstyle >= 0 && $hdstyle < 4 ? $hdstyle : 3; $video['mixhds'] = 3; for ($i = 0; $i < 3; $i++) { $info = getfile('http://v.ku6.com/fetchVideo4Player/' . $key . '.html', 'http://v.ku6.com', null); if (!empty($info)) { break; } } $json = json_decode($info); $data = $json; if (!empty($data->data->t)) { $video['subject'] = $data->data->t; } // // $vtimems = $data->vtimems; // $vtime = $data->vtime; // $f = $data->f; // $vtimems = explode(',',$vtimems); // $vtime = explode(',',$vtime); // $f = explode(',',$f); // foreach ($vtime as $value1){ // $video['data'][$i]['bytes'] = $vtimems; // $video['data'][$i]['duration'] = $vtime; // $video['data'][$i]['src'] = $f; // $i++; // } // if(!empty($vtimems))$video['data'][$i]['bytes'] = $vtimems; // if(!empty($vtime))$video['data'][$i]['duration'] = $vtime; // if(!empty($f))$video['data'][$i]['src'] = $f; // $i++; // if(!empty($vtime))$video['data'][$i]['duration'] = $vtime; // if(!empty($f))$video['data'][$i]['src'] = $f; // $data->data->vtime = explode(',',$data->data->vtime); // $data->data->vtimems = explode(',',$data->data->vtimems); $data->data->f = explode(',', $data->data->f); $i = 0; foreach ($data as $value) { for ($i = 0; $i < count($value->f); $i++) { // if(!empty($value->vtimems[$i]))$video['data'][$i]['bytes'] = $value->vtimems[$i]; // if(!empty($value->vtime[$i]))$video['data'][$i]['duration'] = $value->vtime[$i]; if (!empty($value->f[$i])) { $video['data'][$i]['src'] = $value->f[$i]; } // $i++; } } if (empty($video['data'][0]['src'])) { return false; } return $video; }
function get_url_content($url) { $data = getFileContents($url); if ($data["state"] == "ok") { return $data["file"]; } else { return getfile($url); } }
function Get_FLVCD($url, $hdstyle) { // HD Style Information $hdstr = array(0 => "normal", 1 => "high", 2 => "super"); // --END-- HD Style Information $video['Nowhds'] = $hds = $hdstyle >= 0 && $hdstyle < 3 ? $hdstyle : 2; $video['mixhds'] = 3; for ($i = 0; $i < 3; $i++) { $data = getfile('http://www.flvcd.com/parse.php?kw=' . $url . '&format=' . $hdstr[$hds], 'http://www.flvcd.com/', null); if (!empty($data)) { break; } } if (!empty($data)) { $data = kms_iconv($data, 'GBK', 'UTF-8'); preg_match("/document.title[\\s]+=[\\s]+\"(.*?)\"/i", $data, $datarow); if (empty($datarow[1])) { preg_match("/hidden\"[\\s]+name=\"name\"[\\s]+value=\"(.*?)\"/i", $data, $datarow); } if (empty($datarow[1])) { preg_match("/hidden\"[\\s]+name=\"filename\"[\\s]+value=\"(.*?)\"/i", $data, $datarow); } if (!empty($datarow[1])) { $video['subject'] = $datarow[1]; } preg_match("/<input[\\s]+type=\"hidden\"[\\s]+name=\"inf\"[\\s]+value=\"(.*?)\"\\/>/i", $data, $str); if (empty($str[1])) { preg_match_all("/<BR><a[\\s]+href=\"(.*?)\"/i", $data, $str2); } if (empty($str2[1]) && empty($str[1])) { preg_match_all("/<a[\\s]+href=\"(.*?)\"[\\s]+target=\"_blank\"[\\s]+class=\"link/i", $data, $str2); } if (!empty($str)) { $part = array_filter(explode("|", $str[1]), "strlen"); } if (!empty($str2)) { $part = array_filter($str2[1], "strlen"); } if (empty($part)) { return false; } $i = 0; foreach ($part as $value) { $video['data'][$i]['src'] = $value; $i++; } } if (empty($video['data'][0]['src'])) { return false; } return $video; }
function GetVideo_HTML5($key, $hdstyle, $userkey) { if (hostmd5key() != $userkey) { $video['data'][0]['src'] = '对不起您的授权码错误,暂不能提供解析!'; return $video; exit; } else { for ($i = 0; $i < 3; $i++) { $token = getfile('http://api.lyhaoyu.cn/Index.php/Index/index/License/token/' . $userkey, '', null); if (!empty($token)) { break; } } $token = json_decode($token); $keytime = $token[0]->keytime; if ($keytime <= date('Y-m-d')) { $video['data'][0]['src'] = '对不起您的许可码已过期,暂不能提供解析!'; return $video; exit; } $whtime = $token[0]->whtime; $banben = "2015-04-24"; if ($whtime <= $banben) { $video['data'][0]['src'] = '对不起您的维护期已过期,暂不能使用此版本!'; return $video; exit; } } // 插件名字 $video['name'] = "☆宁哥解析插件-bilibili系统☆"; //高清格式信息 $hdstr = array(0 => "720P", 1 => "350", 2 => "1080P", 3 => "1000"); $video['Nowhds'] = $hds = $hdstyle >= 0 && $hdstyle < 4 ? $hdstyle : 2; $video['mixhds'] = 4; //加载信息 $info = getfile('http://www.bilibili.com/m/html5?cid=' . $key, 'http://www.bilibili.com', null); preg_match('#src\\"\\:\\"(.*?)\\"\\}#i', $info, $vurl); if (empty($vurl[1])) { $info = getfile('http://www.bilibili.com/m/html5?aid=' . $key, 'http://www.bilibili.com', null); } preg_match('#src\\"\\:\\"(.*?)\\"\\}#i', $info, $vurl); $i = 0; if (!empty($vurl[1])) { $video['data'][$i]['src'] = str_replace('&', '&', $vurl[1]); } if (empty($video['data'][0]['src'])) { return false; } return $video; }
function getfile($path, $dbxClient) { $fileOrfolder = $dbxClient->getMetadataWithChildren($path); if (sizeof($fileOrfolder["contents"] > 0)) { $f = 0; foreach ($fileOrfolder["contents"] as $content) { if ($content["is_dir"] != 1) { echo '<li>' . $content["path"] . '</li>'; } else { $f = 1; getfile($content["path"], $dbxClient); } } if ($f == 0) { return; } } }
function GetVid($url) { if (empty($url)) { return false; } preg_match("/^http\\:\\/\\/static\\.video\\.qq\\.com\\/TPout\\.swf\\?[0-9a-z&=_-]*vid=(\\w+)/i", $url, $ketStr); if (empty($ketStr)) { $geturl = getfile($url, 'http://v.qq.com', null); preg_match('#vid:"([0-9a-z]+)"#is', $geturl, $key_str); } if (!empty($key_str[1])) { $key = $key_str[1]; } if (empty($key)) { return false; } return $key; }
function GetVideo_HTML5($key, $hdstyle) { // 插件名字 //http://vv.video.qq.com/geturl?vid= $content = getfile('http://vv.video.qq.com/geturl?vid=' . $key . '&otype=json', 'http://v.qq.com'); preg_match('~QZOutputJson\\s*=\\s*(.*);~iUs', $content, $info); $json = json_decode($info[1]); $vd = $json->vd->vi[0]; $url = $vd->url; $i = 0; if (!empty($url)) { $video['data'][$i]['src'] = $url; } if (empty($video['data'][0]['src'])) { return false; } return $video; }
function GetVideo_HTML5($key, $hdstyle) { $info = getfile('http://www.wasu.cn/Api/getPlayInfoById/id/' . $key . '/datatype/xml', 'http://www.wasu.cn', null); preg_match('#<video>(.*)</video>#i', $info, $vurl); $getkey = getfile('http://www.wasu.cn/Play/show/id/' . $key, 'http://www.wasu.cn', null); preg_match("#playKey[\\s]=[\\s]'(.*)',_playTitle#i", $getkey, $urlkey); $url = 'http://www.wasu.cn/Api/getVideoUrl/id/' . $key . '/url/' . $vurl[1] . '/key/' . $urlkey[1] . '/'; $content = getfile($url, 'http://s.wasu.cn/', null); preg_match('#<video><!\\[CDATA\\[(.*)\\]\\]></video>#i', $content, $vurl); if (empty($vurl[1])) { return; } $i = 0; //视频标题 $video['data'][$i]['src'] = $vurl[1] . '?version=MIPlayer_V1.3.2'; if (empty($video['data'][0]['src'])) { return false; } return $video; }
function get($m) { /*{{{*/ require_once 'api/function.getfile.php'; $param0 = $m->getParam(0); $file = $param0->scalarval(); if ($m->getNumParams() == 2) { $param1 = $m->getParam(1); $format = $param1->scalarval(); } if ($format != "raw" && $format != "gzip") { $format = "raw"; } $data = getfile($file, $format); if (!$data || empty($data)) { $error = "Could not read file: {$file}, in format: {$format}"; return new XML_RPC_Response(0, $GLOBALS['XML_RPC_erruser'], $error); } return new XML_RPC_Response(new XML_RPC_Value($data, $GLOBALS['XML_RPC_Base64'])); }
function GetVideo_HTML5($key, $hdstyle) { for ($i = 0; $i < 3; $i++) { $info = getfile('http://vdn.apps.cntv.cn/api/getHttpVideoInfo.do?pid=' . $key, 'http://www.cntv.cn', null); if (!empty($info)) { break; } } $json = json_decode($info); $data = $json; $video['data'][0]['bpsrc'] = $data->hls_url; if (empty($video['data'][0]['src'])) { $video['data'][0]['src'] = $data->hls_url; $video['data'][0]['bpsrc'] = null; } if (empty($video['data'][0]['src'])) { return false; } return $video; }
function GetVid($url) { if (empty($url)) { return false; } /* preg_match("/^http\:\/\/static\.video\.qq\.com\/TPout\.swf\?[0-9a-z&=_-]*vid=(\w+)/i", $url, $ketStr); if(empty($ketStr)){*/ $geturl = getfile($url, 'http://www.iqiyi.com', null); preg_match('#videoid="(.*?)"#is', $geturl, $key_str); // } if (!empty($key_str[1])) { $key = $key_str[1]; } if (empty($key)) { return false; } return $key; }
function GetVideo_HTML5($key, $hdstyle) { for ($i = 0; $i < 3; $i++) { $info = getfile('http://m.api.hunantv.com/video/relatedVideos/?_1&videoId=' . $key, 'http://m.hunantv.com', null); if (!empty($info)) { break; } } $json = json_decode($info); $data = $json->data; $url = $data[0]->downloadUrl; $url = getfile($url, 'http://m.hunantv.com', null); $data = json_decode($url); $src = $data->info; if (!empty($src)) { $video['data'][0]['src'] = $src; } if (empty($video['data'][0]['src'])) { return false; } return $video; }
function GetVideo_HTML5($key, $hdstyle) { //加载信息 $url = geturl($key); for ($i = 0; $i < 3; $i++) { $info = getfile($url, 'http://video.sina.com.cn', null); if (!empty($info)) { break; } } preg_match_all('#\\<url\\>\\<\\!\\[CDATA\\[(.*?)\\]\\]\\>\\<\\/url\\>#i', $info, $vurl); $i = 0; foreach ($vurl[1] as $value) { if (!empty($value)) { $video['data'][$i]['src'] = $value; } $i++; } if (empty($video['data'][0]['src'])) { return false; } return $video; }
function GetVideo_FLASH($key, $hdstyle) { $banben = date('Y-m-d'); //插件名字 $video['name'] = "☆解析插件-56系统☆-" . $banben; //高清格式信息 $hdstr = array(0 => "normal", 1 => "clear", 2 => "super"); $video['Nowhds'] = $hdstyle >= 0 && $hdstyle < 3 ? $hdstyle : 2; $video['mixhds'] = 2; for ($i = 0; $i < 3; $i++) { $info = getfile('http://vxml.56.com/json/' . $key . '/?src=out', 'http://vxml.56.com', null); if (!empty($info)) { break; } } $json = json_decode($info); $data = $json->info; if (!empty($data->Subject)) { $video['subject'] = $data->Subject; } $i = 0; foreach ($data->rfiles as $value) { if (!empty($value->filesize)) { $video['data'][$i]['bytes'] = $value->filesize; } if (!empty($value->totaltime)) { $video['data'][$i]['duration'] = $value->totaltime; } if (!empty($value->url)) { $video['data'][$i]['src'] = $value->url; } } if (empty($video['data'][0]['src'])) { return false; } return $video; }
function GetVid($url) { if (empty($url)) { return false; } for ($i = 0; $i < 3; $i++) { $c = getfile($url, null, null); if (!empty($c)) { break; } } preg_match("/var[\\s]+vid=\"([0-9]+)\"/i", $c, $key_str); if (empty($key_str[1])) { preg_match("/var[\\s]+vid[\\s]+=[\\s]+\\'([0-9]+)\\'/i", $c, $key_str); } if (empty($key_str[1])) { preg_match("/,vid:[\\s]+\\'([0-9]+)\\'/i", $c, $key_str); } if (empty($key_str[1])) { return false; } $key = $key_str[1]; return $key; }
function add_dir_parsed($dir, $group_id, $parent_id = -1) { // Add all pictures under the Directory $dir to categories and series depending on the relativ path to $dir global $db, $config_vars, $filetypes; if ($parent_id == -1) { $parent_id = $config_vars['root_categorie']; } $dir_handle = opendir($dir); while ($file = readdir($dir_handle)) { if ($file != "." && $file != "..") { $dir_and_file = $dir . '/' . $file; if (isset($filetypes[getext($file)])) { // $file is content // generate a new album_content obj add_content($file, $dir_and_file, getfile($file), $parent_id, 0, $group_id); } elseif (is_dir($dir_and_file)) { //file is a sub dir $cat = new categorie(); $cat->set_name($file); $cat->set_parent_id($parent_id); $cat->fill_up(); $cat->set_catgroup_id($group_id); if (!isset($cat->id)) { $cat->commit(); } add_dir_parsed($dir . '/' . $file, $group_id, $cat->get_id()); } } } closedir($dir_handle); }
public static function store_file($file, $md5) { //清除缓存 clearstatcache(); //创建临时目录 $tmpdir = create_dir(self::get_temp_file($file), TRUE, 0777); //var_dump( $tmpdir ); //var_dump( file_exists( $tmpdir ) ); //var_dump( is_dir( $tmpdir ) ); //发生错误 if ($tmpdir === FALSE) { //记录在案 self::$lastfile = str_replace(VI_ROOT, '', self::$filehash); return -10002; } ////////////////////// //清除缓存 clearstatcache(); //本地文件名 $locale = self::get_pack_file($file); if (self::valid_file($locale, $md5)) { //直接使用已有包 $package = $locale; } else { //下载文件包 $package = getfile($file, $locale); } //发生错误 if ($package === FALSE) { //记录在案 self::$lastfile = filename($file); return -10001; } ////////////////////// //实例zip类 $zip = new PclZip($package); //解压到临时目录 $stat = $zip->extract(PCLZIP_OPT_PATH, $tmpdir); //返回文件数量 return count($stat); }
/** * Generate the HTML, using the defined page template */ function generate($page) { // process the variable for the page $data = array('{{YEAR}}' => date('Y'), '{{VERSION}}' => VERSION, '{{BASEURL}}' => BASEURL, '{{INDEX}}' => getindex(), '{{CONTENT}}' => markdown(getfile($page))); // generate defined page template $template = str_replace(array_keys($data), array_values($data), getfile(TEMPLATE)); // and return it return $template; }
function GetVideo_HTML5($key, $hdstyle) { list($videoid_str, $key_str) = explode('_', strrev($key), 2); $vodkey = strrev($key_str); $videoid = strrev($videoid_str); //获取数据 $content = getfile('http://api.funshion.com/ajax/vod_panel/' . $key . $vodkey . '/w-1', 'api.funshion.com'); $data = json_decode($content); $data = $data->data->fsps->mult; if (!empty($vodkey)) { $i = 0; //得到集数 foreach ($data as $value) { $serialid[$i] = $value->serialid; $hashid[$i] = $value->hashid; $full[$i] = $value->full; $i++; } //得到full $full = array_combine($serialid, $full); $full = $full[$videoid]; //得到集数的hashid $data = array_combine($serialid, $hashid); $data = $data[$videoid]; } else { $full = $data[0]->name; $data = $data[0]->hashid; } //组建json $content = getfile('http://jobsfe.funshion.com/query/v1/mp4/' . $data . '.json', 'http://api.funshion.com'); $json = json_decode($content); //得到标题 if (!empty($full)) { $video['subject'] = $full; } //得到bytes $bits = $json->playlist[0]->bits; $video['data'][0]['bytes'] = $bits; //得到duration $size = $json->playlist[0]->size; $video['data'][0]['duration'] = $size; //得到MP4 $mp4 = $json->playlist[0]->urls[0]; $video['data'][0]['src'] = $mp4; if (empty($video['data'][0]['src'])) { return false; } return $video; }
if ($q[Timeleft] <= 0 && !file_exists($fname) || file_exists($site_path . "files/ord/" . $id . "-{$q['UserID1']}.ord") && file_exists($site_path . "files/ord/" . $id . "-{$q['UserID2']}.ord")) { print "Генерируем бой"; $file = fopen($fname, "w"); function getfile($fname) { $file = fopen($fname, "r"); $str = fread($file, filesize($fname)); fclose($file); return pack("l", strlen($str)) . $str; } $q = mysql_query("select Date+60*Timeout Date,UserID1,UserID2,TypeID,ExtraGlad,LimitGlad,LimitSkl from ft_agreements where RecordID='{$id}'"); $q = mysql_fetch_array($q, 1); $gam = $q; $gam[Date] = mktime(); if ($q[Date]) { $str = serialize($gam) . getfile($site_path . "files/rst/" . $q[UserID1] . ".rst") . getfile($site_path . "files/ord/{$id}-" . $q[UserID1] . ".ord") . getfile($site_path . "files/rst/" . $q[UserID2] . ".rst") . getfile($site_path . "files/ord/{$id}-" . $q[UserID2] . ".ord"); /* $time=microtime(1); for($i=1;$i<=1000;$i++) { $a=gzcompress($str); } print "<br>".(microtime(1)-$time); $time=microtime(1); for($i=1;$i<=1000;$i++) { $a=gzcompress($str,0); }
echo "\n"; echo echo_partie("3"); echo echo_test("1.1"); echo "1 ligne de 4 caracteres avec \\n:\n", getfile(TEST . "7"); echo echo_test("1.2"); echo "2 lignes de 4 caracteres avec \\n:\n", getfile(TEST . "8"); echo echo_test("1.3"); echo "X lignes de 4 caracteres avec \\n:\n", getfile(TEST . "9"); echo echo_test("2.1"); echo "1 ligne de 4 caracteres avec \\n depuis l'entree standard:\n", getfile(TEST . "7", 1); echo echo_test("2.2"); echo "2 lignes de 4 caracteres avec \\n depuis l'entree standard:\n", getfile(TEST . "8", 1); echo echo_test("2.3"); echo "X lignes de 4 caracteres avec \\n depuis l'entree standard:\n", getfile(TEST . "9", 1); echo "\n"; echo echo_partie("4"); echo echo_test("1.1"); echo "1 ligne de 4 caracteres sans \\n:\n", getfile(TEST . "10"); echo echo_test("1.2"); echo "1 ligne de 8 caracteres sans \\n:\n", getfile(TEST . "11"); echo echo_test("1.3"); echo "1 ligne de 16 caracteres sans \\n:\n", getfile(TEST . "12"); echo echo_test("2.1"); echo "Fichier vide avec \\n:\n", getfile(TEST . "13"); echo echo_test("2.1"); echo "Fichier vide avec \\n depuis l'entree standard:\n", getfile(TEST . "13", 1); echo "\n"; echo echo_partie("5"); echo echo_test("1.1"); echo "Tester avec un faux file descriptor:\n", test_fd(); echo "\n";
} if ($noc > $length) { $n -= $tn; } $strcut = substr($string, 0, $n); } else { $dotlen = strlen($dot); $maxi = $length - $dotlen - 1; for ($i = 0; $i < $maxi; $i++) { $strcut .= ord($string[$i]) > 127 ? $string[$i] . $string[++$i] : $string[$i]; } } $strcut = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $strcut); return $strcut . $dot; } $data = getfile(dirname(__FILE__) . "/encoding/big5-gb.table"); @eval("?>{$data}<?php "); } if (!function_exists('ip')) { function ip() { if (getenv('HTTP_CLIENT_IP') && strcasecmp(getenv('HTTP_CLIENT_IP'), 'unknown')) { $ip = getenv('HTTP_CLIENT_IP'); } elseif (getenv('HTTP_X_FORWARDED_FOR') && strcasecmp(getenv('HTTP_X_FORWARDED_FOR'), 'unknown')) { $ip = getenv('HTTP_X_FORWARDED_FOR'); } elseif (getenv('REMOTE_ADDR') && strcasecmp(getenv('REMOTE_ADDR'), 'unknown')) { $ip = getenv('REMOTE_ADDR'); } elseif (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], 'unknown')) { $ip = $_SERVER['REMOTE_ADDR']; } return preg_match("/[\\d\\.]{7,15}/", $ip, $matches) ? $matches[0] : 'unknown';
<?php include_once "functions.php"; //including functions.php dbconnect(); //database connection startover(); // Delete records older that no of days defined in settings file. if (isset($_GET['dc']) && !empty($_GET['dc'])) { // Check if download code is set if (authenticate($_GET['dc'])) { //Verify if download code is correct. $filename = getfile($_GET['dc']); $fakename = fakefilename($_GET['dc']); $extension = fileexten($filename); if ($filename != false && ($fakename != false && @fopen($filename, 'r') == true)) { $mime = contenttype($extension); set_time_limit(0); header('Pragma: public'); header('Expires: 0'); header("Content-Type:" . $mime); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Content-Disposition: attachment;filename=' . $fakename . '.' . $extension); header("Content-Transfer-Encoding: binary"); if (ob_get_length() > 0) { ob_end_clean(); } flush(); @readfile($filename); } else { $error = UNAUTHACCESSMESS . "<h3>We could not find this file</h3>";
function getlines($fl) { return count($fl); } $state = htmlentities(strip_tags($_GET['state']), ENT_QUOTES); $file = htmlentities(strip_tags($_GET['file']), ENT_QUOTES); $finish = time() + 50; $count = getlines(getfile($file)); while ($count <= $state) { $now = time(); usleep(10000); if ($now <= $finish) { $count = getlines(getfile($file)); } else { break; } } if ($state == $count) { $log['state'] = $state; $log['t'] = "continue"; } else { $text = array(); $log['state'] = $state + getlines(getfile($file)) - $state; foreach (getfile($file) as $line_num => $line) { if ($line_num >= $state) { $text[] = $line = str_replace("\n", "", $line); } $log['text'] = $text; } } echo json_encode($log);
function GetVideo_HTML5($key, $hdstyle) { //高清格式信息 $hdstr = array(0 => "720P", 1 => "350", 2 => "1080P", 3 => "1000"); $video['Nowhds'] = $hds = $hdstyle >= 0 && $hdstyle < 4 ? $hdstyle : 0; $video['mixhds'] = 4; //许可 $url = 'http://api.letv.com/time?tn=' . microtime(); $content = getfile($url, 'http://www.letv.com'); $content = json_decode($content); if (empty($content->stime)) { return; } $tkey = GenerateKey($content->stime); //GenerateKey(time()) if (!is_numeric($tkey)) { return; } //加载信息..// http://api.letv.com/mms/out/common/geturl/http://api.letv.com/mms/out/video/playJson $info = getfile('http://api.letv.com/mms/out/video/playJson?id=' . $key . '&platid=1&splatid=101&domain=www.letv.com&tkey=' . $tkey, 'http://m.letv.com', null); $json = json_decode($info); $playurl = $json->playurl; //视频路径 $hd = $hdstr[$hds]; //乐视域名 $domain = $playurl->domain[0]; $ur = $json->playurl->dispatch; $dispatch = get_object_vars($ur); //Ultra-clear format if (array_key_exists("1000", $dispatch)) { $vurl = $dispatch["1000"][0]; } elseif (array_key_exists("1080P", $dispatch)) { $vurl = $dispatch["1080P"][0]; } elseif (array_key_exists("720P", $dispatch)) { $vurl = $dispatch["720P"][0]; } else { $vurl = $dispatch["350"][0]; } $url = str_replace("tss=ios", "tss=no", $vurl) . '&format=1&sign=letv&expect=3000&rateid=' . $hd; $dour = $domain . $url; $vid = getfile($dour, 'http://www.letv.com'); $content = json_decode($vid); $video['data'][0]['src'] = $content->location; if (empty($video['data'][0]['src'])) { return false; } return $video; }