wp-config.php external access

i need a function to get wp-config database, user, and pass from another server.

I find this, but only work in the same cpanel account. Is there any way to fetch this values?

    $f = "/home/".$ac["user"]."/www/wp/wp-config.php";
        if(file_exists($f)) {
            $c = file_get_contents($f);

            preg_match('/define.*DB_NAME.*\'(.*)\'/', $c, $m);
            $dbname = $m[1];

            preg_match('/define.*DB_USER.*\'(.*)\'/', $c, $m);
            $dbuser = $m[1];

            preg_match('/define.*DB_PASSWORD.*\'(.*)\'/', $c, $m);
            $dbpass = $m[1];

            preg_match('/define.*DB_HOST.*\'(.*)\'/', $c, $m);
            $dbhost = $m[1];

Answers


wp-config is written in PHP. PHP is a server side language, meaning you can't get the information out of the script itself, only what it outputs. Not only that, but it would be a major security flaw if you were able to do that to just anyone's Wordpress installation. If your needing that information, the only way would be to get access to the file itself such as via FTP.


Need Your Help

Flexible logger class using standard streams in C++

c++ logging stream

i would like to create a flexible logger class. I want it to be able to output data to a file or to standard output. Also, i want to use streams. The class should look something like:

prevent additional popups with javascript

javascript checkbox popup alert

I have an alert message for the users of my site: