I’m trying to include a file with all my db connection info (hostname password username).
this is what i have so far:
include ('http://site.com/config35sdf322e54353452d/wp2154654315634652132513546541564.php');
mysql_connect($hostname,$username,$password);
@mysql_select_db($dbname) or die( "Unable to select database");
include ('../refference.php');
$select = mysql_query("SELECT my_field FROM $usertable WHERE ".
"GDI_Username = '$sponsor_GDI_id' AND Unique_id = '$sponsor_refference'");
while($check = mysql_fetch_array($select)) {
$sponsor_email = $check["email"];
$sponsor = $check["GDI_Username"];
$sponsor_first_nme = $check["First_Name"];
$sponsor_second_nme = $check["Last_name"];
$sponsor_domain = $check["GDI_Domain"];
$unq_id = $check["Unique_id"];
}
$sponsor_name = "$sponsor_first_nme $sponsor_second_nme";
echo "$sponsor $hostname" ?>
I get an error saying it cant select db (“unable to select database”)
after some investigating (with the echo statement at the end of the code), it seems to be having issues including the .php file on a different server error code:include ('http://site.com/config35sdf322e54353452d/wp2154654315634652132513546541564.php');
Any clues?
Thanks
You can include PHP files from a remote server by enabling the
allow_url_includefunction in the php.ini file.Or you can enable it at runtime by adding this to the top of your script
ini_set('allow_url_include', 1);However, this can cause security issues (for instance, it allows an attacker to include a remote file, such a shell)