Page 1 of 1
How to encapsulate business logic like com in ASP?
Posted: Wed Jun 21, 2006 3:04 am
by janetsmith
How to encapsulate business logic like com in ASP?
Thanks
Posted: Wed Jun 21, 2006 9:28 am
by feyd
COM has nothing to do with business logic... it's an interface to communicate to other COM components.
Could you explain some more? Why is this a security thread?
Posted: Thu Jun 22, 2006 7:49 pm
by janetsmith
Lets say i create a module/function to connect to database.
I want to hide the connection info like password, so i want to compile it and make it unreadable.
this module only provide interface or method which ppl can call it upon.
Posted: Thu Jun 22, 2006 9:17 pm
by feyd
I think you're in for more hassle than what it's worth, but okay.
The COM library in PHP is given a GUID or COM name, if you know them. Once you have the COM object created, you have that interface. You can do pretty much whatever that interface can perform in C or VB or ASP.NET. PHP will add some necessary overhead because it's an external system that it has to build an interface to dynamically.
To do all this just to hide a database password seems rather silly. The only reason I can see making another layer between the server and the database is if PHP doesn't have an existing interface to it, which is somewhat hard to believe, but okay. Why not set up a separate, more restricted user for PHP to use directly to this database if PHP does in fact support it? Why lock yourself into COM? Last I checked, it was exclusive to Windows. Not that I have much against Windows, I work on them everyday, it's just not the system to use for a server in my experience.
Posted: Fri Jun 23, 2006 2:37 am
by janetsmith
Is there any COM counter part in PHP? I mean, does php has something which is similar to com?
Posted: Fri Jun 23, 2006 10:07 am
by feyd
janetsmith wrote:Is there any COM counter part in PHP? I mean, does php has something which is similar to com?
I'm not quite sure how to answer that. What do you specifically mean? PHP has extension interfaces where you could create a closer knit interaction between PHP and whatever database you're using, but it again, may be more complicated than what you need. Since you haven't really been specific about the database you're using, it's hard to say what the more simple route would be.
Posted: Sat Jun 24, 2006 2:40 am
by timvw
janetsmith wrote:
I want to hide the connection info like password, so i want to compile it and make it unreadable.
It's not unreadable (Otherwise, how would the computer be able to read it?)
With a hexeditor people the connectionstring can still be (easily) looked up...
Posted: Sat Jun 24, 2006 2:44 am
by timvw
janetsmith wrote:Is there any COM counter part in PHP? I mean, does php has something which is similar to com?
PHP can consume COM (and event .Net) components when it's executed on Windows...
http://www.php.net/com
http://www.php.net/dotnet
Now, if you want to 'obfuscate' and deliver binaries you can also write your own extension (but most people don't want to load binary-only stuff, and most webhosts simply don't allow it either...)
http://pecl.php.net
Posted: Sat Jun 24, 2006 6:55 am
by onion2k
You could use an encoded script (using zend encoder or one of it's many rivals).