我们用php来控制iis并且,在WEB上创建网站,管理删除等功能哦。 我们用php来控制iis并且,在WEB上创建网站,管理删除等功能哦。# PHP控制站点程序 # # 编写人:韩湘子 # # 邮箱:hanxiangzi@gmail.com # # MSN:hanxiangzi@gmail.com # # QQ:220670 # # 欢迎大家互相联系讨论?> <br><!--<br />body {<br /> background-color: #D4D0C8;<br />}<br />--><br> 站点名称 绑定域名 网站目录 标识符 站点状态 管理 $LocalHostObject = New Com ("IIS://localhost/w3svc") ; //Delete site iF($Opt=="del"){ $LocalHostObject->Delete("IIsWebServer",$ServerID); echo "";<br> }</p> <p> //Start and stop the site<br> iF($Opt=="Status"){<br> $Site2 = New Com ("IIS://LocalHost/w3svc/".$ServerID);<br> $Site2->$Status;<br> }</p> <p><br> //Create new Site<br> iF($Submit){</p> <p> //Create directory<br>// mkdir(stripslashes($ServerDir));</p> <p><br> //Add user<br> $usernameobj = New Com("WinNT://iim");<br> $user = $usernameobj->Create("user",$ServerComm);</p> <p><br> //Set username <br> $user->SetInfo();</p> <p> //Set password<br> $user->SetPassword($ServerComm);<br> // $user->UserFlags('&H0040 ');<br> $user->SetInfo();</p> <p> $usernameobj1 = New Com("WinNT://iim/".$ServerComm);<br> $user->Description = "This username was created by iiM online management system.";<br> $user->SetInfo();</p> <p> #The only problem is the permissions to load the user into the directory##### ################################################ #######################################</p> <p> </p> <p><br> //Create site</p> <p><br> $iissite = $LocalHostObject->Create("IIsWebServer",$ServerID);</p> <p> $aa = explode(", ",$ServerBin);</p> <p>// //Set the basic information of the site first<br> $iissite->ServerBindings = $aa;<br> $iissite->ServerComment = $ServerComment;<br> $iissite->AnonymousUserName = $ServerComm;<br> $iissite->AnonymousUserPass = $ServerComm;<br> $iissite->KeyType = "IIsWebServer";<br> $iissite->EnableDefaultDoc = True ;<br> $iissite->DefaultDoc = "default.htm,default.asp,index.htm,index.html";<br> $iissite->LogFileDirectory = "d:";<br> $iissite- >MaxBandwidth = '102400';<br> $iissite->MaxConnections = '100';<br> $iissite->LogType = "0";<br> $iissite->AppIsolated = 0;<br> $iissite->AuthBasic = False;<br> $iissite->AuthNTLM = True;<br> $iissite->HttpErrors = "404,*,FILE,C:WINDOWShelpiisHelpcommon404b.htm";<br> / /Add script mapping<br> foreach($scriptmapsubmit as $script){<br> Switch($script){<br> Case "asp";<br> $sc[] = ".asa,C:WINDOWSsystem32inetsrvasp. dll,5";<br> $sc[] = ".asp,C:WINDOWSsystem32inetsrvasp.dll,5";<br> break;<br> Case "php";<br> $sc[] = ".php ,E:softphp-5.2.3-Win32(1)php5isapi.dll,5";<br> $sc[] = ".php3,E:softphp-5.2.3-Win32(1)php5isapi.dll,5" ;<br> $sc[] = ".php4,E:softphp-5.2.3-Win32(1)php5isapi.dll,5";<br> $sc[] = ".php5,E:softphp-5.2. 3-Win32(1)php5isapi.dll,5";<br> $sc[] = ".php6,E:softphp-5.2.3-Win32(1)php5isapi.dll,5";<br> break;<br> Case "cgi";<br> echo "cgi<br>";<br> break;<br> Case "aspnet";<br> echo "asp.net<br>";<br> break;<br> Case “html”;<br> echo “html”;<br> break;</p> <p> }<br> <br> }<br> $iissite->ScriptMaps = $sc; $iissite->SetInfo();<br></p> <p> //再设定站点目录<br> $iisdir = $iissite->Create("IIsWebVirtualDir","ROOT");<br> $ServerDir1 = stripslashes($ServerDir);<br> $iisdir->Path = $ServerDir1;<br> $iisdir->AppCreate(True) ;<br> $iisdir->AccessRead = True;<br> $iisdir->EnableDirBrowsing = False;</p> <p> //允许父路径,也就是允许.<br> $iisdir->AspEnableParentPaths = True;<br> $iisdir->AccessScript = True;<br> $iisdir->AppFriendlyName = "默认应用程序";<br> $iisdir->SetInfo();<br> <br> //启动站点<br> $Site1->Start;</p> <p> echo "<script>window.location='3.php';"; } //列出所有网站 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 ; ?> Name?>>删除 Name ; ?>>管理 } } unset($LocalHostObject); unset($Site); unset($Site1); unset($Site2);?> 站点名称 站点目录 站点ID号 Serverbin 脚本映射 ASP PHPCGIASP.NETHTML http://www.bkjia.com/PHPjc/445061.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/445061.htmlTechArticle我们用php来控制iis并且,在WEB上创建网站,管理删除等功能哦。 ? 我们用php来控制iis并且,在WEB上创建网站,管理删除等功能哦。 #PHP控制站...