Jump to content

allow_url_fopen


dotkpay

Recommended Posts

Hello,

 

Am writing a script that is supposed to connect to a remote database without having the credentials (host, user & password) written in the code itself.

There are two ideas I picked up from the net and the first is to enable allow_url_fopen in the remote server's php.ini and then have a file with the database credentials that I can fopen with this script and read from it then connect to the database on that same server.

 

But am afraid this might be a security gap since anyone with that file's address will be able to read from it and connect to the database.

Is the allow_url_fopen method really secure?

 

The other means is CURL but I am not sure it will work well with my current structure.

 

Please advise me on the best means to connect to this database.

 

Thanks in advance.

Link to comment
Share on other sites

Because the application will be run as a compiled executable on users' desktops.

 

Decoding the script from an exe format back to the source is next to impossible but a very skilled hacker can decode only a small part of it, most probably the part with the credentials and gain access to the remote database.

 

It would work to store the credentials locally if the application is to be hosted on a web server as well but its potentially hazardous in a desktop environment.

Link to comment
Share on other sites

If you want to have a remote file with the details, it will have to be encrypted and then decrypted by your app after download.  The method you use to download it (curl vs allow_url_fopen) makes no difference, as both are just a simple http request.

 

IMO, your probably better off just embedding it into the source directly.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.