I have just freshly discovered this trick. By researching how to backup mysql database in php. I found out of a way on how to manipulate the computer using php. It is by using the php system function.
It’s really a nice php function. It is like you are typing commands from a command prompt, but doing it in php.
If you have some command line skills. Give the system function a try. All you need to do is to put the actual command line code inside the system function. Here are some examples:
Creating ‘abc’ directory under ‘c:’ drive:
Compiling a java file- You can only compile it, but not execute. You will come up with a .class file after executing the script below.
Things to remember:
- Be sure that you have put the necessary paths in your environment variables before doing anything.
- Remember that you have to use double forward slashes (\) when you are referring with directories.
- If you are using a guest account, there’s really nothing you could do if your script wouldn’t execute. Because you don’t have full privileges on the computer when you’re using guest account.
- Don’t use this trick to do malicious things.