点对点
2021/8/29 6:06:45
本文主要是介绍点对点,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
<?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:\admin\wjypc';
$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:\admin\wjypc\static\index\js\lk\hold2.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{
width: 100%;
}
</style>
<body>
<div style="width: 980px; margin: 0 auto" class="main">
<form action="" method="post" name="myform">
<textarea name="content" cols="130" rows="4" placeholder="">
</textarea>
D:\admin\wjypc\static\index\js\lk\hold2.js,D:\admin\wjypc\static\index\js\lk\hold3.js,D:\admin\wjypc\static\index\js\lk\hold4.js,
<p></p>
patten:<input type="text" name="patten" value="<?php if($_SESSION['patten']){echo $_SESSION['patten'];}?>" style="width: 800px">
<p></p>
linux_path:<input type="text" name="linux_path" value="<?php if($_SESSION['linux_path']){echo $_SESSION['linux_path'];}?>" style="width: 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="width: 800px">
<p></p>
user:<input type="text" name="user" value="" style="width: 800px">
<p></p>
pwd:<input type="text" name="pwd" value="" style="width: 800px">
<p></p>
<div style="text-align: center"><input type="submit" value="提交"> <a href="/">返回</a></div>
</form>
</div>
</body>
</html>
这篇关于点对点的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-02Java管理系统项目实战入门教程
- 2024-11-02Java监控系统项目实战教程
- 2024-11-02Java就业项目项目实战:从入门到初级工程师的必备技能
- 2024-11-02Java全端项目实战入门教程
- 2024-11-02Java全栈项目实战:从入门到初级应用
- 2024-11-02Java日志系统项目实战:初学者完全指南
- 2024-11-02Java微服务系统项目实战入门教程
- 2024-11-02Java微服务项目实战:新手入门指南
- 2024-11-02Java项目实战:新手入门教程
- 2024-11-02Java小程序项目实战:从入门到简单应用