Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Jun 2008
    Location
    Osprey, Florida
    Posts
    151
    Plugin Contributions
    14

    Default Connecting to the database for Ajax Search... Making it safe.

    I'm working on an Ajax Search plugin. As of right now I have search.php file which I'm uploading to the root level of the server. In order for the plugin to work, I need to connect to the database therefore I'm adding the settings for sever, user, database name and database password from configure.php.

    Thus far it works either of the following two ways

    I just add:
    PHP Code:
    include('includes/configure.php'); 
    or add :

    PHP Code:
    define('DB_SERVER''localhost');
    define('DB_SERVER_USERNAME''root');
    define('DB_SERVER_PASSWORD''root');
    define('DB_DATABASE''database'); 
    The ideal would be to use the first example since there would be no need to modify the file but regardless, I'm concerned about exposing any settings that could compromise the safety of the website.

    How can I make this file safe from intrusion other than just setting the permissions to read only?

    Is either of these examples above safer than the other?

    Thanks for any advice.

  2. #2
    Join Date
    Feb 2010
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Connecting to the database for Ajax Search... Making it safe.

    Quote Originally Posted by ultimate_zc View Post
    I'm working on an Ajax Search plugin. As of right now I have search.php file which I'm uploading to the root level of the server. In order for the plugin to work, I need to connect to the database therefore I'm adding the settings for sever, user, database name and database password from configure.php.

    Thus far it works either of the following two ways

    I just add:
    PHP Code:
    include('includes/configure.php'); 
    or add :

    PHP Code:
    define('DB_SERVER''localhost');
    define('DB_SERVER_USERNAME''root');
    define('DB_SERVER_PASSWORD''root');
    define('DB_DATABASE''database'); 
    The ideal would be to use the first example since there would be no need to modify the file but regardless, I'm concerned about exposing any settings that could compromise the safety of the website.

    How can I make this file safe from intrusion other than just setting the permissions to read only?

    Is either of these examples above safer than the other?

    Thanks for any advice.
    I always use

    require('includes/application_top.php');

    // whatever code

    require('includes/application_bottom.php');

  3. #3
    Join Date
    Jun 2008
    Location
    Osprey, Florida
    Posts
    151
    Plugin Contributions
    14

    Default Re: Connecting to the database for Ajax Search... Making it safe.

    That works pretty good too, thanks.

    Is it safe? Should I move that file into a folder along with an index.html? I think that just by setting the file to read only should work but I'm hoping to hear a better suggestion.

  4. #4
    Join Date
    Feb 2010
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Connecting to the database for Ajax Search... Making it safe.

    Quote Originally Posted by ultimate_zc View Post
    That works pretty good too, thanks.

    Is it safe? Should I move that file into a folder along with an index.html? I think that just by setting the file to read only should work but I'm hoping to hear a better suggestion.


    check these out:
    http://www.zen-cart.com/docs/phpdoc-...n_top.php.html

    http://www.zen-cart.com/wiki/index.p...als#InitSystem

  5. #5
    Join Date
    Jun 2008
    Location
    Osprey, Florida
    Posts
    151
    Plugin Contributions
    14

    Default Re: Connecting to the database for Ajax Search... Making it safe.

    Can't thank you enough.

    Happy Holidays!

  6. #6
    Join Date
    Feb 2010
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Connecting to the database for Ajax Search... Making it safe.

    Quote Originally Posted by ultimate_zc View Post
    Can't thank you enough.

    Happy Holidays!
    Happy Holidays to you!

 

 

Similar Threads

  1. v151 Ajax onSubmit call to write an SQL flag in the database for a particular product
    By Chris Stackhouse in forum General Questions
    Replies: 1
    Last Post: 26 Feb 2015, 06:21 PM
  2. Making database small for moving site
    By seanscully in forum Installing on a Windows Server
    Replies: 2
    Last Post: 20 Feb 2011, 01:10 PM
  3. problem Connecting to the database
    By martinbonifaz in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 17 Nov 2008, 06:34 AM
  4. reconnecting to Database after connecting to PhpBB database.
    By rainthebat in forum General Questions
    Replies: 0
    Last Post: 6 Feb 2008, 09:31 PM
  5. Ajax Search for Oscommerce with Extra Fields
    By Warrior in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 17 Oct 2006, 04:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg