AmIStupidOrWhat;11013727 wrote:But it not as easy as :
exec("\"C:\WINDOWS\system32\notepad.exe C:\WINDOWS\system32\test.txt\""); in php?
No, because that syntax is incorrect. You'll be exec()'ing the string:
"C:\WINDOWS\system32\notepad.exe C:\WINDOWS\system32\test.txt"
You either need to a) remove the quotes, or b) use the quotes properly (e.g. the program to be executed and the first parameter to pass to that program should each be in their own separate pair of quotes).
AmIStupidOrWhat;11013727 wrote:And this only on localhost I want to do this on a remote pc.
Not possible, and the reason why should be obvious. Otherwise, you're suggesting that you should be able to execute really_nasty_trojan.exe on my PC remotely.
Note that it is technically possible to achieve this if: a) you have administrator credentials on the remote PC, and b) the remote PC is on the same LAN as where you're executing the command (or there's at least some tunnel/path from the two PCs that doesn't block the required communication protocols), and c) any other requirements specified by the 3rd party application/tool you use to do this. As an example for that last bit, the (previously) SysInternals tool PsExec can be used to do this assuming the requirements mentioned in this article (last paragraph under heading "The PsTools Suite") are met.
AmIStupidOrWhat;11013727 wrote:How come .pdf files opened then across the internet?
Because they follow the same process as any HTML document, image, etc. The browser and/or PDF reader on your PC makes an HTTP request to your webserver for the PDF document, your webserver sends the raw binary data back as a response, and your browser and/or PDF reader renders that binary data as a PDF document.