'; $menu=''; $bottom=''; if (!is_dir($savedir)) mkdir($savedir); if (!file_exists($savetxt)) { $fp = fopen($savetxt,'wb'); fwrite($fp,''); @fclose($fp); } function tips($bodyi,$etype='n') { global $head,$menu,$bottom; if ($etype=='y') { echo $head.$menu.'
提示
'.$bodyi.'
'.$bottom; } else { echo $head.'
提示
'.$bodyi.'
'.$bottom; } } function show($name) { switch ($result=get_cfg_var($name)) { case 0: $result='×'; break; case 1: $result=''; break; default: break; } return $result; } function isfun($funName = '') { if (!$funName || trim($funName) == '' || preg_match('~[^a-z0-9\_]+~i', $funName, $tmp)) return '错误'; return (false !== function_exists($funName)) ? '' : '×'; } if ($_SESSION['login']=='ok') { if ($act=='manage') { //任务管理 $body='
任务管理
'; if (filesize($savetxt)==0) { $body.=''; } else { $url=str_replace("\\",'/',dirname(__FILE__)); $file=file_get_contents($savetxt); $lines=explode("\n",$file); foreach ($lines as $line) { $body.=''; $i=1; $keys=explode(',',$line); foreach ($keys as $key) { if ($i==1) $id=$key; elseif ($i==2) $name=$key; elseif ($i==3) { $filename=$key; $i=0; $body.="'; } } $body.='
名称动作

没有记录,新建一个

$name删除下载"; } $i++; } $body.='
'; $menu=str_replace("
  • 任务管理
  • ","
  • 任务管理
  • ",$menu); $show=TRUE; } elseif ($act=='add') { //新建下载 $body='
    新建下载

    地址:

    名称:

    '; $menu=str_replace("
  • 新建下载
  • ","
  • 新建下载
  • ",$menu); $show=TRUE; } elseif ($act=='del') { //删除 $id=htmlspecialchars(trim($_GET['id'])); $name=htmlspecialchars(trim($_GET['name'])); $filename=htmlspecialchars(trim($_GET['filename'])); $str=$id.','.$name.','.$filename."\n"; $file=file_get_contents($savetxt); $file=str_replace($str,'',$file); $fp=fopen($savetxt,'wb'); fwrite($fp,$file); if ($fp) @fclose($fp); @unlink("$savedir/$filename"); tips('
    删除成功
    ','y'); $show=FALSE; } elseif ($act=='adda') { //下载 $url=htmlspecialchars(trim($_POST['iurl'])); $name=htmlspecialchars(trim($_POST['iname'])); if (empty($url)) { tips('

    没有输入地址,点击这里返回

    '); } elseif (empty($name)) { tips('

    没有输入名称,点击这里返回

    '); } else { $dt='.sy'; do { $tmp_name=substr(str_shuffle('abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'),0,20).$dt; } while (file_exists($savedir.'/'.$tmp_name)); $file=file_get_contents($savetxt); $lines=explode("\n",$file); foreach ($lines as $line) { $body.=''; $i=1; $keys=explode(',',$line); foreach ($keys as $key) { if ($i==1) $id=$key; } $i++; } if (empty($id)) $id=1; else $id=$id++; $file=$file.$id.','.$name.','.$tmp_name."\n"; $fp=fopen($savetxt,'wb'); fwrite($fp,$file); @fclose($fp); $d=fopen($url,'rb'); if ($d) { $b=fopen($savedir.'/'.$tmp_name,'wb'); if ($b) { while (!feof($d)) { fwrite($b, fread($d,1024*8),1024*8); } } } if ($d) @fclose($d); if ($b) @fclose($b); } tips('
    成功添加任务
    ','y'); $show=FALSE; } elseif ($act=='delall') { //删除所有 $file=file_get_contents($savetxt); $lines=explode("\n",$file); foreach ($lines as $line) { $i=1; $keys=explode(',',$line); foreach ($keys as $key) { if ($i==3) { @unlink("$savedir/$filename"); } } } $body.=''; $fp=fopen($savetxt,'wb'); fwrite($fp,''); @fclose($fp); tips('
    删除成功
    ','y'); $show=FALSE; } elseif ($act=='about') { //关于 $body='
    关于

    这个程序完全开源,大家可以免费使用、学习

    但是,禁止在没有经过作者允许下,篡改、去除版权,如果需要基于此程序开发,需要先联系作者

    泷涯离线下载 ver 1.0 查看最新版

    '; $menu=str_replace("
  • 关于
  • ","
  • 关于
  • ",$menu); $show=TRUE; } else { //首页 $body='
    管理首页

    允许URL打开文件:'.show(allow_url_fopen).'

    Curl支持:'.isfun("curl_init").'

    '; $menu=str_replace("
  • 管理首页
  • ","
  • 管理首页
  • ",$menu); $show=TRUE; } if ($show) echo $head.$menu.$body.$bottom; } else { if ($_GET['act']=='logincheck') { $inputpwd=md5(trim($_POST['ipwd'])); $inputuser=md5(trim($_POST['iuser'])); if ($inputpwd==md5($pwd) && $inputuser==md5($user)) { $_SESSION['login']='ok'; header('Location:'.$adminfile); } else { tips('

    啊哦,错了哦

    点击这里返回

    ','0'); } } else { echo '后台管理
    泷涯离线下载
    用户名
    密码
    '; } } ?>