On May 17, 5:53 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
moua...@yahoo.com wrote:
I'm not sure if this is possible. I would like to have a PHP app on
the Internet connect and write to a local database (Intranet). For
example, users would go to a web sitehttp://www.internet.comto run
the app. The app requires an internet connection and is outside of
the user's network. The app would have the option to either store
data locally or on the Internet. I would like to give users the
option to store data locally because some may have privacy/security
concerns if the data is stored on the Internet or kept/maintained by
another company.
Would the connection string below work from the Internet to connect to
the user's local database? I don't have my web hosting service up yet
so I can't test. Thanks...
<?php
$server='localhost' //or whatever the client db server name is
$c=new mysqli($server,'user','passwd','db');
?>
As Sabine indicated, php runs on the server, so 'localhost' will always
be the server's database.
In addition, you shouldn't plan to store data in the client's database.
Most people don't have MySQL installed. Most of those who do have it
installed on their local machine either have network connections
disabled or have a firewall which prevents external access. And those
who do allow external access are not likely to give out a
userid/password to another website - at least not if they have any sense
at all. And even if they give you their userid and password, you don't
know if they have the appropriate database and tables - or maybe have
that database and table name for an entirely different use.
I don't know what kind of data you're storing, but I don't think this is
a good way to go.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -
- Show quoted text -
I was expecting there would be firewall and security issues. It just
looks so simple thought I'd just give it a shot.
I would let the users know that if they want to store the data locally
they would have to have MySQL installed with a specified database
name, user, and password. Then provide a script to create the table
structure.
I was hoping this would be possible so the user wouldn't need to have
PHP and a web server installed. All they would need is just the
database. Now it looks like the user will need PHP, web server, and
MySQL. The user will download a PHP file and run it on their web
server. The PHP page will have links to include files from my web
site. I think it should work this way, right? No security or
firewall issues? Only issue here with me is that I run the risk of
users modifying my PHP and javascript codes. I want to control the
app from my web site so that if I make changes everyone will get the
update, even the ones who run the app locally.
BTW, I'm developing a financial app so the database will have
financial information about the user. Most people including myself
are protective of financial information.