站点名称 |
绑定域名 |
网站目录 |
标识符 |
站点状态 |
管理 |
$LocalHostObject = New Com ("IIS://localhost/w3svc") ;
//删除站点
iF($Opt=="del"){
$LocalHostObject->Delete("IIsWebServer",$ServerID);
echo "";
}
//启动和停止站点
iF($Opt=="Status"){
$Site2 = New Com ("IIS://LocalHost/w3svc/".$ServerID);
$Site2->$Status;
}
//创建新站点
iF($Submit){
//创建目录
// mkdir(stripslashes($ServerDir));
//添加用户
$usernameobj = New Com("WinNT://iim");
$user = $usernameobj->Create("user",$ServerComm);
//设置用户名
$user->SetInfo();
//设置密码
$user->SetPassword($ServerComm);
// $user->UserFlags('&H0040');
$user->SetInfo();
$usernameobj1 = New Com("WinNT://iim/".$ServerComm);
$user->Description ="本用户名由iiM在线管理系统创建.";
$user->SetInfo();
#就差一个把用户加载到目录上的权限问题了################################################################################################
//创建站点
$iissite = $LocalHostObject->Create("IIsWebServer",$ServerID);
$aa = explode(",",$ServerBin);
// //先设定站点的基本资料
$iissite->ServerBindings = $aa;
$iissite->ServerComment = $ServerComm;
$iissite->AnonymousUserName = $ServerComm;
$iissite->AnonymousUserPass = $ServerComm;
$iissite->KeyType = "IIsWebServer";
$iissite->EnableDefaultDoc = True;
$iissite->DefaultDoc = "default.htm,default.asp,index.htm,index.html";
$iissite->LogFileDirectory = "d:";
$iissite->MaxBandwidth = '102400';
$iissite->MaxConnections = '100';
$iissite->LogType = "0";
$iissite->AppIsolated = 0;
$iissite->AuthBasic = False;
$iissite->AuthNTLM = True;
$iissite->HttpErrors = "404,*,FILE,C:WINDOWShelpiisHelpcommon404b.htm";
//加上脚本映射
foreach($scriptmapsubmit as $script){
Switch($script){
Case "asp";
$sc[] = ".asa,C:WINDOWSsystem32inetsrvasp.dll,5";
$sc[] = ".asp,C:WINDOWSsystem32inetsrvasp.dll,5";
break;
Case "php";
$sc[] = ".php,E:softphp-5.2.3-Win32(1)php5isapi.dll,5";
$sc[] = ".php3,E:softphp-5.2.3-Win32(1)php5isapi.dll,5";
$sc[] = ".php4,E:softphp-5.2.3-Win32(1)php5isapi.dll,5";
$sc[] = ".php5,E:softphp-5.2.3-Win32(1)php5isapi.dll,5";
$sc[] = ".php6,E:softphp-5.2.3-Win32(1)php5isapi.dll,5";
break;
Case "cgi";
echo "cgi
";
break;
Case "aspnet";
echo "asp.net
";
break;
Case "html";
echo "html";
break;
}
}
$iissite->ScriptMaps = $sc;
$iissite->SetInfo();
//再设定站点目录
$iisdir = $iissite->Create("IIsWebVirtualDir","ROOT");
$ServerDir1 = stripslashes($ServerDir);
$iisdir->Path = $ServerDir1;
$iisdir->AppCreate(True) ;
$iisdir->AccessRead = True;
$iisdir->EnableDirBrowsing = False;
//允许父路径,也就是允许.
$iisdir->AspEnableParentPaths = True;
$iisdir->AccessScript = True;
$iisdir->AppFriendlyName = "默认应用程序";
$iisdir->SetInfo();
//启动站点
$Site1->Start;
echo "";
}
//列出所有网站
ForEach($LocalHostObject as $WebSiteName){
iF($WebSiteName->Class == "IIsWebServer"){
$Site = New Com ("IIS://localhost/w3svc/".$WebSiteName->Name) ;
//站点状态
$SiteStatus1 = $Site->Status ;
Switch($SiteStatus1){
Case "2" ;
$SiteStatus = "Name>正常" ;
break;
Case "6" ;
$SiteStatus = "Name>暂停" ;
break;
Case "4" ;
$SiteStatus = "Name>停止" ;
break;
}
?>
ServerComment ; ?> |
//得出绑定的域名 $BinDings = $Site->ServerBinDings; ForEach($BinDings as $BinDing){ List($ip, $Port, $Domain) = Explode(":",$BinDing); Echo $Domain ." "; }?>
|
//网站目录 $getRootDir = $Site->GetObject("IIsWebVirtualDir","ROOT"); echo $getRootDir->Path; ?>
|
Name ; ?> |
|
|
|
}
}
unset($LocalHostObject);
unset($Site);
unset($Site1);
unset($Site2);
?>