<?
# PHP Site Control Program
#
# Prepared by Han Xiangzi
#
# Mailbox: hanxiangzi@gmail.com
#
# MSN: hanxiangzi@gmail.com
#
# QQ: 220670
#
# Contact us for discussion
?>
<Link href = "image/css.css" rel = "stylesheet" type = "text/css"/>
<Style type = "text/css">
<! --
Body {
Background-color: # D4D0C8;
}
-->
</Style>
<Table width = "980" border = "0" cellpadding = "5" cellspacing = "1" bgcolor = "#000000">
<Tr height = 26>
<Td width = "177" bgcolor = "# E8E6E1"> site name </td>
<Td width = "229" bgcolor = "# E8E6E1"> bind a domain name </td>
<Td width = "210" bgcolor = "# E8E6E1"> website directory </td>
<Td width = "116" bgcolor = "# E8E6E1"> identifier </td>
<Td width = "97" bgcolor = "# E8E6E1"> site status </td>
<Td colspan = "2" bgcolor = "# E8E6E1"> <div align = "center"> Management </div> </td>
</Tr>
<? Php
$ LocalHostObject = New Com ("IIS: // localhost/w3svc ");
// Delete the site
IF ($ Opt = "del "){
$ LocalHostObject-> Delete ("IIsWebServer", $ ServerID );
Echo "<script> window. location = '3. Php'; </script> ";
}
// Start and stop the site
IF ($ Opt = "Status "){
$ Site2 = New Com ("IIS: // LocalHost/w3svc/". $ ServerID );
$ Site2-> $ Status;
}
// Create a new site
IF ($ Submit ){
// Create a directory
// Mkdir (stripslashes ($ ServerDir ));
// Add a user
$ Usernameobj = New Com ("WinNT: // iim ");
$ User = $ usernameobj-> Create ("user", $ ServerComm );
// Set the user name
$ User-> SetInfo ();
// Set the password
$ User-> SetPassword ($ ServerComm );
// $ User-> UserFlags ('& h0040 ');
$ User-> SetInfo ();
$ Usernameobj1 = New Com ("WinNT: // iim/". $ ServerComm );
$ User-> Description = "this user name is created by the iiM online management system .";
$ User-> SetInfo ();
# The difference is the permission to load users to directories ########################## ######################################## ##############################
// Create a site
$ Iissite = $ LocalHostObject-> Create ("IIsWebServer", $ ServerID );
$ Aa = explode (",", $ ServerBin );
//// Set the basic information of the site first
$ Iissite-> ServerBindings = $ aa;
$ Iissite-> ServerComment = $ ServerComm;
$ Iissite-> AnonymousUserName = $ ServerComm;
$ Iissite-> AnonymousUserPass = $ ServerComm;
$ Iissite-> KeyType = "IIsWebServer ";
$ Iissite-> enabledefadoc doc = True;
$ Iissite-> DefaultDoc = "default.htm,default.asp,index.htm,index.html ";
$ Iissite-> LogFileDirectory = "d :\";
$ Iissite-> MaxBandwidth = '000000 ';
$ Iissite-> MaxConnections = '000000 ';
$ Iissite-> LogType = "0 ";
$ Iissite-> AppIsolated = 0;
$ Iissite-> AuthBasic = False;
$ Iissite-> AuthNTLM = True;
$ Iissite-> HttpErrors = "404, *, FILE, C: WINDOWShelpiisHelpcommon404b.htm ";
// Add script ing
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 <br> ";
Break;
Case "aspnet ";
Echo "asp.net <br> ";
Break;
Case "html ";
Echo "html ";
Break;
}
}
$ Iissite-> ScriptMaps = $ SC;
$ Iissite-> SetInfo ();
// Set the site directory again
$ Iisdir = $ iissite-> Create ("IIsWebVirtualDir", "ROOT ");
$ ServerDir1 = stripslashes ($ ServerDir );
$ Iisdir-> Path = $ ServerDir1;
$ Iisdir-> AppCreate (True );
$ Iisdir-> AccessRead = True;
$ Iisdir-> EnableDirBrowsing = False;
// Allow the parent path, that is, allow.
$ Iisdir-> AspEnableParentPaths = True;
$ Iisdir-> AccessScript = True;
$ Iisdir-> AppFriendlyName = "default application ";
$ Iisdir-> SetInfo ();
// Start the site
$ Site1-> Start;
Echo "<script> window. location = '3. Php'; </script> ";
}
// List all websites
ForEach ($ LocalHostObject as $ WebSiteName ){
IF ($ WebSiteName-> Class = "IIsWebServer "){
$ Site = New Com ("IIS: // localhost/w3svc/". $ WebSiteName-> Name );
// Site status
$ SiteStatus1 = $ Site-> Status;
Switch ($ SiteStatus1 ){
Case "2 ";
$ SiteStatus = "<a href =? Opt = Status & Status = stop & ServerID = $ Site-> Name> normal </a> ";
Break;
Case "6 ";
$ SiteStatus = "<a href =? Opt = Status & Status = start & ServerID = $ Site-> Name> <font color = red> suspend </font> </a> ";
Break;
Case "4 ";
$ SiteStatus = "<a href =? Opt = Status & Status = start & ServerID = $ Site-> Name> <font color = red> stop </font> </a> ";
Break;
}
?>
<Tr height = 26>
<Td bgcolor = "# F4F3F2"> <? Php Echo $ Site-> ServerComment;?> </Td>
<Td bgcolor = "# F4F3F2">
<? Php
// Obtain the bound domain name
$ BinDings = $ Site-> ServerBinDings;
ForEach ($ BinDings as $ BinDing ){
List ($ ip, $ Port, $ Domain) = Explode (":", $ BinDing );
Echo $ Domain. "<br> ";
}
?> </Td>
<Td bgcolor = "# F4F3F2">
<?
// Website Directory
$ GetRootDir = $ Site-> GetObject ("IIsWebVirtualDir", "ROOT ");
Echo $ getRootDir-> Path;
?> </Td>
<Td bgcolor = "# F4F3F2"> <? Php Echo $ Site-> Name;?> </Td>
<Td bgcolor = "# F4F3F2"> <? Php Echo $ SiteStatus;?> </Td>
<Td width = "40" bgcolor = "# F4F3F2"> <div align = "center"> <a href =? Opt = del & ServerID = <? Php Echo $ Site-> Name?> Delete </a> </div> </td>
<Td width = "33" bgcolor = "# F4F3F2"> <div align = "center"> <a href = 33.php? ServerID = <? Php Echo $ Site-> Name;?> Management </a> </div> </td>
</Tr>
<? Php
}
}
Unset ($ LocalHostObject );
Unset ($ Site );
Unset ($ Site1 );
Unset ($ Site2 );
?>
</Table>
<Form id = "form1" name = "form1" method = "post" action = "">
<Table width = "100%" border = "0" cellspacing = "0" cellpadding = "3">
<Tr>
<Td width = "8%"> site name </td>
<Td width = "92%"> <input type = "text" name = "ServerComm"/> </td>
</Tr>
<Tr>
<Td> site directory </td>
<Td> <input type = "text" name = "ServerDir" value = "F: user"/> </td>
</Tr>
<Tr>
<Td> ID of the site </td>
<Td> <input type = "text" name = "ServerID"/> </td>
</Tr>
<Tr>
<Td> Serverbin </td>
<Td> <textarea name = "ServerBin" cols = "80" rows = "5"> </textarea> </td>
</Tr>
<Tr>
<Td> script ing </td>
<Td> <input name = "scriptmapsubmit []" type = "checkbox" id = "scriptmapsubmit" value = "asp"/>
ASP
<Input name = "scriptmapsubmit []" type = "checkbox" id = "scriptmapsubmit" value = "php"/>
PHP
<Input name = "scriptmapsubmit []" type = "checkbox" id = "scriptmapsubmit" value = "cgi"/>
CGI
<Input name = "scriptmapsubmit []" type = "checkbox" id = "scriptmapsubmit" value = "aspnet"/>
ASP. NET
<Input name = "scriptmapsubmit []" type = "checkbox" id = "scriptmapsubmit" value = "html" checked = "checked"/>
HTML </td>
</Tr>
<Tr>
<Td> <input type = "submit" name = "Submit" value = "Submit"/> </td>
<Td> & nbsp; </td>
</Tr>
</Table>
</Form>