Hello i have file in folder assets/includes/config.php
The file contains this data:
$db_host = 'localhost';
$db_name = 'xxxx';
$db_username = 'xxxx';
$db_password = 'xxxxx';
$site_url = 'https://xxxxx.xx/';
How can i echo this data in index.php so it would be visible for everybody ?
Thank you!
Just use echo before all code lines.
For example
echo $db_host = 'localhost';
echo $db_name = 'xxxx';
echo $db_username = 'xxxx';
echo $db_password = 'xxxxx';
echo $site_url = 'https://xxxxx.xx/';
Related
I'm trying to use a wildcard subdomain with my application.
But it's not working properly...
Can you help me out, please?
$WildcardDomain = $_SERVER['HTTP_HOST'];
$WildcardTMP = explode('.', $WildcardDomain);
$WildcardSubdomain = current($WildcardTMP);
$db_host = 'localhost';
$db_user = 'localuser';
$db_password = 'localpass';
$db_name = 'localdb';
define('APP_URL', "http://" + $WildcardSubdomain);
The URL Generated is http://localhost/0/login/
The '0' should not be there...
I trying to backup my database using mysqldump. The file is being generated but the file is empty. How can I fix this?
PHP Code:
$dbuser = 'demo';
$dbpass = 'demo';
$host = 'localhost';
$dbname = 'demo';
$filename = __DIR__ . '/backup/'. $dbname . '_'.$date.'.sql';
exec("mysqldump --user={$dbuser} --password={$dbpass} --host={$host} $dbname > {$filename}");
i am getting this error as i integrate this forum in my website i am new to this error his is my config.php i had made changes according to my database i am new to this i don't know why and what is this error.
<?php
$dbms = 'phpbb\\db\\driver\\mysqli';
$db host = 'localhost';
$dbport = '';
$dbname = 'abc_forum';
$dbuser = 'root',
$dbpasswd = '';
$table_prefix = '';
$phpbb_adm_relative_path ='adm/';
$acm_type = 'phpbb\\cache\\driver\\file';
#define('PHPBB_INSTALLED', true);
change $db host to $dbhost :
<?php
$dbms = 'phpbb\\db\\driver\\mysqli';
$dbhost = 'localhost';
$dbport = '';
$dbname = 'abc_forum';
$dbuser = 'root',
$dbpasswd = '';
$table_prefix = '';
$phpbb_adm_relative_path ='adm/';
$acm_type = 'phpbb\\cache\\driver\\file';
#define('PHPBB_INSTALLED', true);
The username and password are not valid. That is what this means. Ask your hosting provider for the correct credentials.
Keep it simple
$conn = new mysqli("DB_HOST","USERNAME","PASSWORD","DATABASE");
I am using PHP nuke 7.6
In config.php i have changes the some code -
$dbhost = "localhost";
$dbuname = "root";
$dbpass = "";
$dbname = " phpnuke";
$prefix = "nuke";
$user_prefix = "nuke";
$dbtype = "MySQL";
$sitekey = "SdFk*fa28367-dm56w69.3a2fDS+e9";
$gfx_chk = 0;
$subscription_url = "";
$admin_file = "admin";
After complete the configuration i got the following message.
"There seems to be a problem with the MySQL server, sorry for the inconvenience. We should be back shortly."
Please help me to shutout this problem.
Thanks
Maybe the space before phpnuke in $dbname?
$dbname = " phpnuke";
I am stumped. I have a login.php page that contains the SQL login info (hostname, database, username, password) included at the top of my index.php page (using require_once). The login info is within a conditional statement that determines whether I am on the remote server or the local testing server and offers up the correct login info. Now this is where it gets weird, it doesn't work (as in it does not make a connection with the database) when I go directly to the index.php page on the remote server however it does work on the testing server and it works if I visit the login.php site on the remote server first (which doesn't echo anything) and then visit the index.php page on the remote server. I have caches disabled. Why is this happening and how can I fix it? try it yourself by visiting http://distantfuturejosh.com/playground/pendingaxioms first (it won't work), then visiting http://distantfuturejosh.com/playground/pendingaxioms/login.php (a blank page is served) and then returning to http://distantfuturejosh.com/playground/pendingaxioms (it will work and you'll see the images appear).
here is the login.php page:
<?php
$requesturi = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$pos = strpos($requesturi, "www.distantfuturejosh.com");
if ($pos === 0)
{
$db_hostname = "xxxxxxxx";
$db_database = "xxxxxxxx";
$db_username = "xxxxxxxx";
$db_password = "xxxxxxxx";
}
else
{
$db_hostname = "localhost";
$db_database = "xxxxxxxx";
$db_username = "root";
$db_password = "root";
}
?>
Try using
session_start();
at beginning of your file.
try using if ($pos === false) instead of if ($pos === 0) like this
<?php
$requesturi = $_SERVER['HTTP_HOST'];
$pos = strpos($requesturi, "distantfuturejosh");
if ($pos === false)
{ //local
$db_hostname = "localhost";
$db_database = "xxxxxxxx";
$db_username = "root";
$db_password = "root";
}
else
{ //remote
$db_hostname = "xxxxxxxx";
$db_database = "xxxxxxxx";
$db_username = "xxxxxxxx";
$db_password = "xxxxxxxx";
}
?>
I suppose you check user login and include login.php in your other PHP pages with include /subfolder/login.php;