Page 1 of 1

TRANSLATE TO PHP?

Posted: Wed Sep 08, 2004 7:45 am
by fef23
TRANSLATE TO PHP?

On Error Resume Next

const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"

oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys
WScript.Echo subkey
Next

Re: Translate to Php

Posted: Wed Sep 08, 2004 8:17 am
by Black Unicorn
As far as I know, PHP is run as a module under Apache, and can't directly change Windows Registry settings.

I wouldn't even know how to start solving a problem of this nature, but I could be wrong ... how about shell commands? PhP can do those, and if you make a little .NET or compiled VB thing you might be able to shell it using PhP so the desired effect is accomplished by proxy.

Other than that, I think I'll revisit this thread later again as it seems rather interesting.

Best of luck,
H

windows

Posted: Wed Sep 08, 2004 8:20 am
by phpScott
diffenetly a windows error but what where you doing when the error came up?

A little more info would be great

phpscott

Posted: Wed Sep 08, 2004 8:23 am
by CoderGoblin
PHP is a server language and as such can not change things on the client machine. Any shell commands take place on the server, not the client. To do otherwise would be a severe security problem.

Posted: Wed Sep 08, 2004 9:57 am
by ol4pr0
turning it into a ActiveX, than you can use it with some php page

Posted: Wed Sep 08, 2004 1:13 pm
by m3mn0n
PHP's Windows API extension: [php_man]w32api[/php_man]

It can do anything the API let's you do. But it will only act upon the same machine the server is on. It won't have any impact on the machine of someone who remotely accesses it (which is a security risk too).

See my note on that manual page for a link to Microsoft's site for the documentation about the API.

As for converting that code, what language is it in? And adding some comments might help too.

Posted: Wed Sep 08, 2004 1:16 pm
by feyd
course.. the w32api will only work on the server. Although every time I've tried to play with it, it hasn't worked.. :? I built my own extension :)

Posted: Wed Sep 08, 2004 1:22 pm
by m3mn0n
Well I did figure out how to play around with it a bit, but I just decided to use Perl (command line apps) or VB for doing something on my server. I leave PHP to support client-side apps, instead of server-side apps. :)