i have a VBScript file. When its on the computer it works fine. I want to put it on a php site for it to be executed by a button click. but i have not been successful.i have a VBScript file. When its on the computer it works fine. I want to put it on a php site for it to be executed by a button click. but i have not been successful.
Here is the code :
Const ForReading = 1
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("C:\AppServ\www\abcd\testFile.txt", ForReading)
TheFile = f.ReadAll
myArray = Split(theFile,vbcrlf)
for i = 0 to Ubound(MyArray)
Next
txt=Space(1)
Set myShell = CreateObject("WScript.Shell")
myShell.run "cmd"
WScript.Sleep 100
myShell.SendKeys"telnet 192.168.1.1"
myShell.SendKeys("{Enter}")
WScript.Sleep 1500
myShell.SendKeys"myname"
myShell.SendKeys("{Enter}")
WScript.Sleep 1500
myShell.SendKeys"mypassword"
myShell.SendKeys("{Enter}")
WScript.Sleep 1500
myShell.SendKeys"sudo -i"
myShell.SendKeys("{Enter}")
WScript.Sleep 1000
myShell.SendKeys"su - zimbra"
myShell.SendKeys("{Enter}")
WScript.Sleep 1000
myShell.SendKeys"zmprov ma " & myArray(0) & " zimbraAccountStatus locked"
myShell.SendKeys("{Enter}")
WScript.Sleep 1000
Thanks in advance.
PHP cant execute vbscript. If you want php to execute any other language, you have to write some kind of parser/interpreter which do this for you...
But in your case, it should be easier to translate the script simply to php. A telnet client isn't that hard to implement. A simple example is found here: telnet connection using PHP