Connecting to local database from Internet

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mouac01@yahoo.com

    Connecting to local database from Internet

    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 site http://www.internet.com to 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='localh ost' //or whatever the client db server name is
    $c=new mysqli($server, 'user','passwd' ,'db');
    ?>

  • Sabine Dinis Blochberger

    #2
    Re: Connecting to local database from Internet

    mouac01@yahoo.c om 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 site http://www.internet.com to 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='localh ost' //or whatever the client db server name is
    $c=new mysqli($server, 'user','passwd' ,'db');
    ?>
    >
    PHP runs on the server, not the client. So if your webserver with PHP is
    on the same machine (or LAN) as your database server, there should be no
    problem at all.

    Storing data locally through a web browser is a bit more tricky though.
    If you use certificates the client trusts, it should work. Otherwise,
    the website might be considered a security problem (like the ones that
    stoer trojans on your PC)...
    --
    Sabine Dinis Blochberger

    Op3racional
    Soluções e produtos de comunicação, segurança e comércio

    Comment

    • Jerry Stuckle

      #3
      Re: Connecting to local database from Internet

      mouac01@yahoo.c om 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 site http://www.internet.com to 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='localh ost' //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.
      jstucklex@attgl obal.net
      =============== ===

      Comment

      • cmgmyr

        #4
        Re: Connecting to local database from Internet

        You would need to have a static IP first of all. Then you might need
        to set up port forwarding if you have any sort of firewall. But then
        you would just connect to that IP/Port just like you would if you were
        on the same server

        Comment

        • mouac01@yahoo.com

          #5
          Re: Connecting to local database from Internet

          On May 17, 5:53 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
          moua...@yahoo.c om 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.co mto 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='localh ost' //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...@attgl obal.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.

          Comment

          • Alexey Kulentsov

            #6
            Re: Connecting to local database from Internet

            mouac01@yahoo.c om wrote:
            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.
            PHP on your server is not way to do this. At all. Use downloadable
            java application instead.
            May be this is will be possible when IPv6 will be common.

            Comment

            • Gordon Burditt

              #7
              Re: Connecting to local database from Internet

              >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.
              If you expect users to run PHP on their system with off-site include
              files, either you're nuts, or your users are nuts. Especially when the
              application deals with financial data.
              >I think it should work this way, right? No security or
              >firewall issues?
              Including a PHP file from a site you (the guy running the site, in this
              case, your customer) don't own is really, REALLY asking for trouble.
              >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.
              So if your site gets infected, so do all your customers. Or if
              your DNS gets spoofed somehow so the customer sites go elsewhere
              for the include files.
              >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.
              People who are protective of financial information should have run away
              screaming halfway through this article.

              Comment

              • Jerry Stuckle

                #8
                Re: Connecting to local database from Internet

                mouac01@yahoo.c om wrote:
                On May 17, 5:53 am, Jerry Stuckle <jstuck...@attg lobal.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.co mto 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='loca lhost' //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...@attg lobal.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.
                >
                I agree with Gordon's comments. If you want them to store the data on
                their local system, give them an encrypted file to store it in. Next
                time they access your system, they can upload the encrypted file, which
                you can then parse.

                But your idea is a recipe for failure.

                And no, you do not want or need a java application. In fact, java won't
                help you a bit here. Java, due to security restrictions, can't store on
                the client machine, either. It can only store back to the server.

                And as for downloading java applications - the same caveats Gordon
                mentioned for PHP apply to Java.

                --
                =============== ===
                Remove the "x" from my email address
                Jerry Stuckle
                JDS Computer Training Corp.
                jstucklex@attgl obal.net
                =============== ===

                Comment

                • Toby A Inkster

                  #9
                  Re: Connecting to local database from Internet

                  mouac01 wrote:
                  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.
                  Yes, that is certainly possible.

                  It would be a triumph of ingenuity over sanity.

                  --
                  Toby A Inkster BSc (Hons) ARCS
                  Fast withdrawal casino UK 2025 – Play now & cash out instantly! Discover the top sites for rapid, secure payouts with no delays.

                  Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux

                  Comment

                  Working...