Create Web site _php tutorial on PHP web

Source: Internet
Author: User
We use PHP to control IIS and to create sites on the web, manage deletions and so on.

We use PHP to control IIS and to create sites on the web, manage deletions and so on.

# PHP Control Site Program
#
# Author: chastised
#
# Email: hanxiangzi@gmail.com
#
# msn:hanxiangzi@gmail.com
#
# qq:220670
#
# Welcome to contact us for discussion
?>











$LocalHostObject = New Com ("Iis://localhost/w3svc");

Delete a site
IF ($Opt = = "Del") {
$LocalHostObject->delete ("IIsWebServer", $ServerID);
echo "";
}

Start and stop a site
IF ($Opt = = "Status") {
$Site 2 = New Com ("iis://localhost/w3svc/". $ServerID);
$Site 2-> $Status;
}


Create a new site
IF ($Submit) {

Create a Directory
mkdir (Stripslashes ($ServerDir));


Add user
$usernameobj = New Com ("Winnt://iim");
$user = $usernameobj->create ("user", $ServerComm);


Set User name
$user->setinfo ();

Set Password
$user->setpassword ($ServerComm);
$user->userflags (' &h0040 ');
$user->setinfo ();

$usernameobj 1 = New Com ("winnt://iim/". $ServerComm);
$user->description = "This user name was created by the IIM online management system.";
$user->setinfo ();

#就差一个把用户加载到目录上的权限问题了 ########################################################################################### #####


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->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";
Add script Map
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.
";
Break
Case "HTML";
echo "HTML";
Break

}

}
$iissite->scriptmaps = $SC;
$iissite->setinfo ();

Set the Site Directory again
$iisdir = $iissite->create ("IIsWebVirtualDir", "ROOT");
$ServerDir 1 = stripslashes ($ServerDir);
$iisdir->path = $ServerDir 1;
$iisdir->appcreate (True);
$iisdir->accessread = True;
$iisdir->enabledirbrowsing = False;

Allows the parent path, which is allowed.
$iisdir->aspenableparentpaths = True;
$iisdir->accessscript = True;
$iisdir->appfriendlyname = "Default Application";
$iisdir->setinfo ();

Start a site
$Site 1->start;

echo "";

}

List all Sites
ForEach ($LocalHostObject as $WebSiteName) {
IF ($WebSiteName->class = = "IIsWebServer") {
$Site = New Com ("iis://localhost/w3svc/". $WebSiteName->name);
Site Status
$SiteStatus 1 = $Site->status;
Switch ($SiteStatus 1) {
Case "2";
$SiteStatus = "name> normal";
Break
Case "6";
$SiteStatus = "name> pause";
Break
Case "4";
$SiteStatus = "name> stop";
Break
}


?>

















}}Unset ($LocalHostObject);Unset ($Site);Unset ($Site 1);Unset ($Site 2);?>
Site name Bind domain Name Site Directory Identifier Site Status Management
ServerComment;?>
Get the bound domain name
$BinDings = $Site->serverbindings;
ForEach ($BinDings as $BinDing) {
List ($ip, $Port, $Domain) = Explode (":", $BinDing);
Echo $Domain. "
";
}

?>


Site Directory

$getRootDir = $Site->getobject ("IIsWebVirtualDir", "ROOT");
Echo $getRootDir->path;
?>

Name;?> name?>> Delete Name;?>> Management



http://www.bkjia.com/PHPjc/445061.html www.bkjia.com true http://www.bkjia.com/PHPjc/445061.html techarticle we use PHP to control IIS and to create websites on the web, manage deletions and so on.? We use PHP to control IIS and to create sites on the web, manage deletions and so on. #PHP控制站...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.