Home  >  Article  >  Backend Development  >  用php修改ftp密码_PHP

用php修改ftp密码_PHP

WBOY
WBOYOriginal
2016-06-01 12:34:521133browse

PHP:
if(!($fp=@ftp_connect($_GET['host'])))exit('无法连接服务器');
if(!@ftp_login($fp,$_GET['user'],$_GET['pass']))exit('指定的密码无法登陆');
echo (@ftp_site($fp,'pswd '.$_GET['pass'].' '.$_GET['newpass']))?"密码修改成功":"密码修改失败";
?>

把上面的代码保存到一个php文件如chang.php中就可以了,改密码的时候用
http://www.aaa.com/chang.php?host=主机&user=用户&pass=密码&newpass=新密码

来访问就可以修改了,例如:
http://www.aaa.com/chang.php?host=ftp.aaa.com&user=test&pass=test&newpass=123456

就可以登陆到ftp.aaa.com(以test
用户和test的密码登陆),把test密码改为123456了
你们要做的只是做一个表单。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn