WordPress.org

Ready to get started?Download WordPress

Forums

Php database password access (5 posts)

  1. epsir
    Member
    Posted 1 year ago #

    Hey, I've been trying to get a database running for some of my site's data and haven't found the plugins to be...flexible enough. So I'm trying to more directly play with the database through queries in php or such. I know my db username and password and such, my question is how do I securely open my database connection without my password hanging out there. I think I remember there being a good way to put it in a variable. Any ideas?

    specifically using the php call:
    $database=mysql_connect("localhost", db_user_here, db_pw_here);

  2. epsir
    Member
    Posted 1 year ago #

    Anyone have an idea on this? I am to understand that hard coding the password onto the page calling the database is not a particularly secure idea, unless I'm offbase about that.

    Trying to sift through plugin code to see how they call the database, but not much luck so far.

  3. That's not really a WordPress question and there are many articles on the Internet for answering that PHP/mysql question.

  4. epsir
    Member
    Posted 1 year ago #

    Apparently it is a wordpress question. I may be able to get around needing to type information in by using the wpdb class. Which curiously is said to be instantiated as a global variable but says you still need to globalize it. Doesn't say where it's instantiated, will poke around.

  5. epsir
    Member
    Posted 1 year ago #

    Apparently I just put

    global $wpdb;

    right before my code. Doesn't...make entire sense to me but whatever.

    Should be enough for me to go off of now.

Topic Closed

This topic has been closed to new replies.

About this Topic