<?php
session_start();
function sub($str){
$b = $a=$str;
$a=strpos(strrev($a),'/');
$c=substr($b,0,-$a);
return $c;
}
if(empty($_SESSION['patten'])) $_SESSION['patten']='';
if(!$_SESSION['linux_path']) $_SESSION['linux_path']='';
if($_POST){
$data_i=$data=array_filter($_POST);
if($data['act']){
switch($data['act']){
case 1:
$host='47.52.158.133';
$user='root';
$pwd='Demo999(';
break;
case 2:
$host='47.52.158.13322';
$user='root';
$pwd='Demo999(';
break;
}
}
if(!empty($data_i['host']) && !empty($data_i['user'])){
$host=$data_i['host'];
$user=$data_i['user'];
$pwd=$data_i['pwd'];
}
$data['content']=trim(trim($data['content'],','));
$res = $data=array_filter(explode(',',$data['content']));
$_SESSION['linux_path'] = $linux_path = $data_i['linux_path']?$data_i['linux_path']:'/home/wwwroot/www.huaerhui.net';
$_SESSION['patten'] = $patten = $data_i['patten']?$data_i['patten']:'D:adminwjypc';
$data2=array();
foreach($data as $k=>$v){
$data2[$k] = trim(sub(str_replace(array($patten,'\'), array($linux_path,'/'),$v)));
}
//echo "<pre>";var_dump($data2);die;
$data3=array_combine($res,$data2);
// echo "<pre>";var_dump($data3);die;
$d4=array();
foreach($data3 as $k=>$v){
$d4[] = "pscp -l ".$user." -pw ".$pwd." ".$k." ".$host.":".$v;
}
// echo "<pre>";var_dump($data3);die;
if($d4){
foreach($d4 as $k=>$v){
echo "$v"."<br>";
}
}
// echo "<pre>";var_dump($d4);die;
// pscp -l root -pw Demo999( D:adminwjypcstaticindexjslkhold2.js 47.52.158.133:/home/wwwroot/www.huaerhui.net/static/index/js/lk/
}
?>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
.main div{
100%;
}
</style>
<body>
<div style=" 980px; margin: 0 auto" class="main">
<form action="" method="post" name="myform">
<textarea name="content" cols="130" rows="4" placeholder="">
</textarea>
D:adminwjypcstaticindexjslkhold2.js,D:adminwjypcstaticindexjslkhold3.js,D:adminwjypcstaticindexjslkhold4.js,
<p></p>
patten:<input type="text" name="patten" value="<?php if($_SESSION['patten']){echo $_SESSION['patten'];}?>" style=" 800px">
<p></p>
linux_path:<input type="text" name="linux_path" value="<?php if($_SESSION['linux_path']){echo $_SESSION['linux_path'];}?>" style=" 800px">
<p></p>
config:<select name="act">
<option value="1" selected>1</option>
<option value="2">2</option>
</select>
<p></p>
host:<input type="text" name="host" value="" style=" 800px">
<p></p>
user:<input type="text" name="user" value="" style=" 800px">
<p></p>
pwd:<input type="text" name="pwd" value="" style=" 800px">
<p></p>
<div style="text-align: center"><input type="submit" value="提交"> <a href="/">返回</a></div>
</form>
</div>
</body>
</html>