TRANSLATE TO PHP?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fef23
Forum Newbie
Posts: 1
Joined: Wed Sep 08, 2004 7:39 am
Location: Brazil

TRANSLATE TO PHP?

Post 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
Black Unicorn
Forum Commoner
Posts: 48
Joined: Mon Jun 16, 2003 9:19 am
Location: United Kingdom

Re: Translate to Php

Post 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
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

windows

Post by phpScott »

diffenetly a windows error but what where you doing when the error came up?

A little more info would be great

phpscott
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post 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.
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

turning it into a ActiveX, than you can use it with some php page
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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 :)
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post 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. :)
Post Reply