How to connect my wordpress plugin to a remote database securely?

Question

First of all I do not have a lot of experience with wordpress plugins, but I am developing a plugin which has to connect and send data to a remote database ( which it is already doing ). But at this point of time my connection is not secure at all because all the database info is shown for the admin of the site.

This is my code at the moment, it works and all but how can I make sure that noone will see the database data that is in this file?

<?php
function webARX_connect_to_db(){
  $servername = "remote_host";
  $username = "username";
  $password = "password";
  $dbname = "database_name";

  // Create connection
  $webARX_connection = new wpdb($username, $password, $dbname, $servername);

  if (empty($webARX_connection->show_errors())){
    return $webARX_connection;
  } else {
    return $webARX_connection->show_errors();
  }
}
?>
0
, Kristen Sepp 5 years 2016-05-13T02:18:28-05:00 0 Answers 65 views 0

Leave an answer

Browse
Browse