0

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.

Mel
  • 21
  • 1
  • 1
  • 5

1 Answers1

0

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

Community
  • 1
  • 1
Philipp
  • 15,377
  • 4
  • 35
  • 52
  • it's still not working.. how about run cmd.exe with argument "C:\a.vbs" if i run it manually, it's worked but if i run it programatically using exec function in php, there is no response but when i open task manager.. there is a process cmd.exe running.. what should i do? – Mel Jan 19 '14 at 06:29