Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7687635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:44:50+00:00 2026-05-31T19:44:50+00:00

In the past I have stored database credentials (username, password) in another file (outside

  • 0

In the past I have stored database credentials (username, password) in another file (outside of the web directory) and included this in a PHP page to make connections with the database. Since I have started doing a lot of database interaction via AJAX, I have to change how I do this, since the AJAX script cannot include a script outside the web directory.

In order to deal with AJAX database connections, I need a good secure way to get the username and password data to the AJAX script. What is the best (secure and handy) way to do this? If i simply put my database credentials file in the web directory, what permissions to give it? Is this a good/bad idea?

Thanks a lot!

** EDIT **

Apparently there is not problem including files outside of web root directory, I was mistaken. Thanks very much, this probably changes things for me… :-/

** EDIT 2 **

Indeed that changed everything for me, I was able to include the database config file which i was using in all the pages (which resided outside the web root), so this is great!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T19:44:51+00:00Added an answer on May 31, 2026 at 7:44 pm

    if you are not opposed to changing things up a little bit, I think you should use your backend to interface with the database, and just use your ajax to hit those interfaces to the DB. that way you dont have to ever “Store db creds” client side

    OR if you absolutely must save client side, you should figure out a way to reduce your access to a hashed / salted key that you save in a session cookie or something

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function (stored procedure) defined in a database that I would like
I'll try and keep this simple, I have worked on projects in the past
I'm using this php to fetch data from my mysql database: $wpdb->get_var(select count(*) from
I'm using mysql with django 1.3 and I have posts stored in a database.
If I have a collection of database tables (in an Access file, for example)
I have a set of information stored in an external database, similar to the
Several of my ajax applications in the past have used GET request but now
In the past I have used MAPISendMail to launch Outlook (or whatever the desired
In the past I have used Managed Direct X and DirectShow.Net to play a
In the past I have worked with the microchip PIC family, but I would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.