<?php
$ftpserver=$_POST[ftpserver];
$ftpport=$_POST[ftpport];
$ftpuser=$_POST[ftpuser];
$ftppassword=$_POST[ftppassword];
$ftp=@ftp_connect($ftpserver,$ftpport);
if(!$ftp){ echo "連接FTP服務器".$ftpserver."的端口".$ftpport."失敗";exit;}
$rs=@ftp_login($ftp,$ftpuser,$ftppassword);
if(!$rs){ echo "用戶名或密碼錯誤,連接FTP服務器失敗";exit;}
$curDir=stripslashes($_POST[curDir]);
$dirname=stripslashes($_POST[name]);
if($dirname)
{
if($curDir=="/")
{
$dirpath=$curDir.$dirname;
}else{
$dirpath=$curDir."/".$dirname;
}
$rs=ftp_mkdir($ftp,$dirpath);
if($rs)
{
echo "<script>alert('創建文件夾成功');history.back();</script>";
exit;
}else{
echo "<script>alert('創建文件夾失敗');history.back();</script>";
exit;
}
}else{
echo "<script>alert('文件夾不能為空');history.back();</script>";
exit;
}
?>