'application/x-kddi-ezmusic', '2' => 'video/3gpp2', '3' => 'audio/3gpp2' ); //disposition $dptypes = array( '1' => 'devcufz', '2' => 'devmpzz', '3' => 'devsmzw' ); //デバッグ用:PCでDLするリンクを表示 $pclink = 1; //デバッグ用ログ生成 //$debuglog = 1; //-----------------------------------------------------------------// //-----------------------------------------------------------------// $password = md5($password_base); $comment = '
◆rN6ij4/mI6 script'; if ($_SERVER['HTTP_HOST'] == 'fa.skr.jp') { $comment .= '
source'; } //land.toは広告挿入(function htmlout()にて) if (ereg("land\.to$",$_SERVER['HTTP_HOST'])) { $landto = True; } //-----------------------------------------------------------------// // 3g2かkmfかでも異なるぽいけどとりあえず初期状態自動設定 // これもCookieにすべきだろか $ua = $_SERVER['HTTP_USER_AGENT']; preg_match("/^KDDI-(\w{4})/",$ua,$uarr); $cel = $uarr[1]; switch ($cel) { case 'SA34': $pre_m = 1; $pre_dp = 1; $pre_lf = True; $pre_cr = True; break; default: $pre_m = 3; $pre_dp = 2; $pre_lf = False; $pre_cr = True; } if (isset($_REQUEST['pre_f'])) { $pre_f = $_REQUEST['pre_f']; } if (isset($_REQUEST['pre_m'])) { $pre_m = $_REQUEST['pre_m']; } if (isset($_REQUEST['pre_dp'])) { $pre_dp = $_REQUEST['pre_dp']; } if (isset($_REQUEST['pre_lf'])) { $pre_lf = $_REQUEST['pre_lf']; } if (isset($_REQUEST['pre_cr'])) { $pre_cr = $_REQUEST['pre_cr']; } //-----------------------------------------------------------------// set_time_limit(0); $filetitle = ''; $filelist = ''; $typelist = ''; $dplist = ''; $lf = ''; $lfchk_str = 'OFF'; $cr = 'no'; $script = $_SERVER['PHP_SELF']; $file = htmlspecialchars($_REQUEST['file']); if (get_magic_quotes_gpc()) { $file = stripslashes($file); } $file = str_replace("/","",$file); $mtypek = htmlspecialchars($_REQUEST['mtype']); $dlflag = htmlspecialchars($_REQUEST['dl']); $dptypek = htmlspecialchars($_REQUEST['dptype']); $lfchk = htmlspecialchars($_REQUEST['lf']); $optchk = htmlspecialchars($_REQUEST['opt']); $crchk = htmlspecialchars($_REQUEST['cr']); $mtype = $mtypes[$mtypek]; $dptype = $dptypes[$dptypek]; if ($lfchk) { $lf = 'movie.ezweb.ne.jp%2F@'; $lfchk_str = 'ON'; } if ($crchk) { $cr = 'yes'; } //パスワードチェック $pass = $_COOKIE['pass']; $password = md5($password); //二重md5 if ($pass != $password) { $pass = $_POST['pass']; if (md5(md5($pass)) != $password) { $html=<< Pass:
${comment} EOT; htmlout($html); exit; } //Cookie発行 setcookie("pass",md5(md5($pass)),time()+3600*24); } //ログ吐き出し if ($logdir) { if (is_writable($logdir)) { $logfile=$logdir.date("Ymd").".log"; if (!file_exists($logfile)) { $make = fopen($logfile,"w"); fclose($make); @chmod($logfile,0666); } $log = fopen($logfile,"a"); fputs($log,join("\t",array(date("His"),$_SERVER['QUERY_STRING'],$_SERVER['HTTP_RANGE'],$_SERVER['REMOTE_ADDR'],$_SERVER['HTTP_USER_AGENT'],$_SERVER['HTTP_X_UP_SUBNO'],"\n"))); fclose($log); if ($debuglog) { $request_header = ''; if (function_exists('getallheaders')) { $request_headers = getallheaders(); foreach ($request_headers as $hk=>$hv) { $request_header .= $hk.': '.$hv."\n"; } } else { foreach ($_SERVER as $hk=>$hv) { if (ereg('^HTTP_(.+)',$hk,$hkar)) { $hk2 = str_replace("_"," ",$hkar[1]); $hk2 = ucwords(strtolower($hk2)); $hk2 = str_replace(" ","-",$hk2); $request_header .= $hk2.': '.$hv."\n"; } } } $logfile2=$logdir.date("Ymd")."_debug.log"; if (!file_exists($logfile2)) { $make = fopen($logfile2,"w"); fclose($make); @chmod($logfile2,0666); } $log2 = fopen($logfile2,"a"); fputs($log2,date("His").' '.$_SERVER['REQUEST_METHOD'].' '.$_SERVER['REQUEST_URI'].' '.$_SERVER['SERVER_PROTOCOL']."\n".$request_header."\n"); fclose($log2); } } } if ($limit) { //未定 } //ファイル一覧を生成 if (!$file) { $filelist_arr = array(); $fh = @opendir($datadir); if (!$fh) { htmlout("データフォルダが見つかりません"); exit; } while (($fn = readdir($fh)) !== false) { if (ereg("(\.|\.php)$",$fn)) { continue; } if (is_dir($datadir.$fn)) { continue; } $timest = filemtime($datadir.$fn); $filelist_arr[$timest] = $fn; } closedir($fh); krsort($filelist_arr,SORT_NUMERIC); foreach ($filelist_arr as $timestamp => $fname) { if ($fname == $pre_f) { $pfs = ' selected'; } else { $pfs = ''; } $filelist .= ""; } foreach ($mtypes as $key=>$val) { if ($key == $pre_m) { $pms = ' selected'; } else { $pms = ''; } $val = str_replace("application/","appli../",$val); $typelist .= ""; } foreach ($dptypes as $key=>$val) { if ($key == $pre_dp) { $pds = ' selected'; } else { $pds = ''; } $dplist .= ""; } if ($pre_cr) { $crc = ' checked'; } if ($pre_lf) { $lfc = ' checked'; } $html=<< file:








copyright
movie.ez(ry
memo
EOT; htmlout($html); } elseif (file_exists($datadir.$file)) { $filedesc = pathinfo($datadir.$file); $filetitle = str_replace('.'.$filedesc['extension'],"",$filedesc['basename']); if ($optchk) { $filetitle .= "_${mtypek}_${dptypek}"; } $filesize = filesize($datadir.$file); $filesize_f = number_format($filesize); $filemtime = filemtime($datadir.$file); //ダウンロード if ($dlflag) { $range = $_SERVER["HTTP_RANGE"]; if (preg_match("/^bytes=(\d*)\-(\d*)$/", $range, $arr)) { $offset = $arr[1]; $end = $arr[2]; if (!$end) { $end = $filesize; } $len = $end - $offset + 1; } else { $len = $filesize; } $response_headers = array(); if ($range) { header($response_headers[]="HTTP/1.1 206 Partial Content"); } header($response_headers[]='Etag: "'.md5(gmdate("D, d M Y H:i:s",$filemtime) . " GMT").'"'); header($response_headers[]="Content-Disposition: attachment; filename=${file}"); if (!$pclink) { header($response_headers[]="Last-Modified: " . gmdate("D, d M Y H:i:s",$filemtime) . " GMT"); } header($response_headers[]="Accept-Ranges: bytes"); if ($range) { header($response_headers[]="Content-Range: bytes ".$offset."-".$end."/".$filesize); } header($response_headers[]="Content-Length: ".$len); header($response_headers[]="Connection: close"); header($response_headers[]="Content-Type: ${mtype}"); if ($range) { $fp = fopen($datadir.$file,"rb"); fseek($fp,$offset); $buf = fread ($fp, $len); fclose($fp); echo $buf; } else { readfile($datadir.$file); } //ログ吐き出し if ($logdir) { if (is_writable($logdir)) { if ($debuglog) { $response_header = ''; if (function_exists('apache_response_headers')) { $response_headers_sys = apache_response_headers(); foreach ($response_headers_sys as $hk=>$hv) { $response_header .= $hk.': '.$hv."\n"; } } else { $response_header = join("\n",$response_headers); } $log3 = fopen($logfile2,"a"); fputs($log3,$response_header."\n.\n\n"); fclose($log3); } } } exit; } //objectタグ生成 $location = 'http://'.$lf.$_SERVER['HTTP_HOST'].$script.'?dl=1&mtype='.urlencode($mtypek).'&file='.urlencode($file).'&'; if ($pclink) { $location_pc = '

Download for PC'; } $html=<< Title: ${filetitle}
Filesize: ${filesize_f}
Type: ${mtype}
Disposition: ${dptype}
Copyright: ${cr}
fake server: ${lfchk_str}
${location_pc} EOT; htmlout($html); } //ファイルが存在しない場合エラー else { htmlout("ファイルが存在しません"); } exit; //HTMLひな形 function htmlout ($content) { global $title,$landto; print<< ${title} EOT; if ($landto) { @include '/ad/bn.p'; } print $content; print<< EOT; } php?>