Home >Backend Development >PHP Tutorial >PHP implements shutting down the remote computer_PHP tutorial

PHP implements shutting down the remote computer_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:40:041074browse

There are many ways to implement a remote computer. Here is an excerpt of the shutdown command description if you shut down the remote WINDOWS computer

The syntax format of the Shutdown command is: shutdown [-i |-l|-s |-r |-a] [-f] [-m [ComputerName]] [-t xx] [-c "message"] [-d[p]:xx:yy].

"-i" displays the dialog box of the graphical interface.

“-l” logs out the current user, which is the default setting.

"-s" shuts down the computer.

"-r" restart after shutdown.

"-a" aborts shutdown.

"-f" forces the application to be closed to run.

“-m [ComputerName] specifies the computer to shut down.

"-t xx" sets the timer for system shutdown to xx seconds, the default is 20 seconds.

"-c "message"" specifies the message that will be displayed in the "Message" area of ​​the "System Shutdown" window. You can use up to 127 characters. The message must be enclosed in quotes.

"-d [p]:xx:yy" lists the reason codes for system shutdown.

Ignored by the system except "-l" and "ComputerName" other parameters. During the timeout, only "-a" can be used.

For example, to shut down the remote computer enter "shutdown -s -m work1 -t 60 " means shutting down the machine named work after 60 seconds. The machine must also be equipped with the Windows XP operating system. And enter "shutdown - s -t 30" means to automatically shut down after 30 seconds. "shutdown -l" means to log out the local user, which is not applicable to remote computers. Use "shutdown -r" to restart the local computer. "Shutdown -a" can cancel the shutdown command that has been issued. When you want to shut down the local computer, you can use "shutdown -s".

System and exec in PHP can execute shutdown commands. If the software and hardware configuration of the remote computer meets the following conditions, it can be executed: Give the Guest user the permission to shut down remotely. remote user Connect to local Windows In the XP system, you are connected as Guest, and remote shutdown requires administrator rights, so you must first give the Guest user the permission to remotely shut down. Start the computer that needs to be shut down remotely. In the "Run" dialog Enter "gpedit.msc" in the box to open the "Group Policy Editor". Expand "Computer Configuration" → "Windows Settings" → "Security Settings" → "Local Policy" → "User Rights Assignment", find the "Force Shutdown from Remote System" option in the right window. Double-click the item and click the "Add" button in the pop-up dialog box , then Then enter the user name "guest" in the new dialog box, and finally click "OK". Now the "guest" user is added to the properties of "Force shutdown from the remote system". Click the "OK" button to exit.


Code:

system(shutdown -s -m work1 -t 60);
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486240.htmlTechArticleThere are many ways to implement remote computers. Here is an excerpt of the shutdown command to explain Shutdown if you shut down the remote WINDOWS computer. The command syntax format is: shutdown [-i |-l|-...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn