PHP web website_php tutorial

Source: Internet
Author: User
Create a website on phpWEB. We use php to control iis and create websites on the WEB, manage and delete functions .? We use php to control iis and create websites, manage and delete functions on the WEB. # For the PHP control site, we use php to control iis and create websites, manage deletions, and other functions on the WEB.

We use php to control iis and create websites, manage and delete functions on the WEB.

# PHP Site Control Program
#
# Prepared by Han Xiangzi
#
# Mailbox: hanxiangzi@gmail.com
#
# MSN: hanxiangzi@gmail.com
#
# QQ: 220670
#
# Contact us for discussion
?>











$ 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
";
Break;
Case "aspnet ";
Echo "asp.net
";
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 = "Name> Normal ";
Break;
Case "6 ";
$ SiteStatus = "Name> suspend ";
Break;
Case "4 ";
$ SiteStatus = "Name> stop ";
Break;
}


?>

















}}Unset ($ LocalHostObject );Unset ($ Site );Unset ($ Site1 );Unset ($ Site2 );?>
Site Name Bind Domain name Website Directory Identifier Site status

Management

ServerComment;?>
// Obtain the bound domain name
$ BinDings = $ Site-> ServerBinDings;
ForEach ($ BinDings as $ BinDing ){
List ($ ip, $ Port, $ Domain) = Explode (":", $ BinDing );
Echo $ Domain ."
";
}

?>


// Website Directory

$ GetRootDir = $ Site-> GetObject ("IIsWebVirtualDir", "ROOT ");
Echo $ getRootDir-> Path;
?>

Name;?>

Name?> Delete

Name ;?>> Management




Bytes. ? We use php to control iis and create websites, manage and delete functions on the WEB. # PHP control station...

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.