Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. define('ENV_STR', 'MYSQLCONNSTR_localdb');
  2. $return = array('result' => false);
  3. if (isset($_SERVER[ENV_STR])) {
  4.     $connectStr = $_SERVER[ENV_STR];
  5.     $return['connection'] = array(
  6.         'host' => preg_replace("/^.*Data Source=(.+?);.*$/", "\\1", $connectStr),
  7.         'database' => preg_replace("/^.*Database=(.+?);.*$/", "\\1", $connectStr),
  8.         'user' => preg_replace("/^.*User Id=(.+?);.*$/", "\\1", $connectStr),
  9.         'password' => preg_replace("/^.*Password=(.+?)$/", "\\1", $connectStr)
  10.     );
  11.     $return['result'] = true;
  12. }
  13. header('Content-Type: application/json; charset=utf-8');
  14. echo json_encode($return);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement