How to manipulate the computer using php scripts

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:

system(‘mkdir c:\abc’);

 

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.

system(‘javac c:\a.java’);

 

Things to remember:

  1. Be sure that you have put the necessary paths in your environment variables before doing anything.
  2. Remember that you have to use double  forward slashes (\) when you are referring with directories.
  3. 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.
  4. Don’t use this trick to do malicious things.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s