dear all
please help me to find a way for open a cmd window using php code.
something like when i press a button new cmd window will be open with a network ping test .
ex. ping 10.101.1.25
dear all
please help me to find a way for open a cmd window using php code.
something like when i press a button new cmd window will be open with a network ping test .
ex. ping 10.101.1.25
Do you want to actually show a working cmd window to the user or do you only need to run a command?
yes i want to show a working cmd window to the user
Ok, for any live interaction in the browser you need to use javascript. There are quite a few PHP terminal emulator projects out there, you could use one of those - or get some inspiration there.
ie:
http://phpterm.sourceforge.net/
I’ll leave this quote from one of those here, please remember to be careful exposing a shell on http
Please don't be stupid. Depending on your server setup this could potentially open you up to some major security issues if not properly locked down. The system uses sessions for authentication but that doesn't mean an extra layer of protection wouldn't be a good idea.
Dear JimL
i just simply need to test a ping availability of desire network address.
simply a php file with a button. when i press the button a cmd window will be open and simply display the ping reply.
ping 10.101.1.25
Pinging 10.101.1.25 with 32 bytes of data:
Reply from 10.101.1.25: bytes=32 time=2ms TTL=128
Reply from 10.101.1.25: bytes=32 time<1ms TTL=128
Reply from 10.101.1.25: bytes=32 time=5ms TTL=128
Reply from 10.101.1.25: bytes=32 time=3ms TTL=128
Ping statistics for 10.101.1.25:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 5ms, Average = 2ms
is this possible?
It helps if you answer the question asked.
And you said,
That is obviously not what you are after. Depending on your level of permission on the server, you can execute commands thru php and print the results.
enter shell exec()
My 2 cents:
If you want the server to ping an address use the shell command. Display the results to the user.
If you want the user to ping from their address, open a command prompt from the browser using JS.
You can do this by creating a text file of the output of the ping, then load a DIV with the results. So, when you
do that, it will appear that your site did the ping for you. Here is a link where they discussed how to do it. Go
down a little on the page and they show a way to handle it
Also, you must remember that a lot of user’s do not know what a PING is…