| Index
» Projekty
» phpMyEdit
» Fórum
» fopen |
 |
clickbr
Založený: 30.03.2011
Príspevky: 4
Zaslal: 2011-04-12 20:17
Návrat hore
Odpovedať s citátom
|
how to save the config.php file with fopen?
@fopen('/home/user/public_html/config.php', 'w+');
===
| marrxx Napísal: |
| clindsey Napísal: |
I am trying to use a php include to include the mysql connection information in another file for security reasons. I can't seem to get this to work, though. I've created a file, config.php, that looks like this:
| Kód: |
// MySQL host name, user name, password, database, and table
$opts['hn'] = 'url.com';
$opts['un'] = 'user';
$opts['pw'] = 'password';
$opts['db'] = 'dbname';
$opts['tb'] = 'table';
|
Then I put this code into the phpmyedit file:
| Kód: |
| include("config.php"); |
I'm sure I'm missing something small, so I tried adding a forward slash to the link, and later adding php open and close markers in the include code. But still no luck.
Can anyone spot what I'm doing wrong? Thanks a bunch.
Chris |
// MySQL host name, user name, password, database, and table
try this:
mainfile
:
include("config.php");
$opts['hn'] = $host;
$opts['un'] = $user;
$opts['pw'] = $password;
$opts['db'] = $dbname;
$opts['tb'] = $table;
and in the config.php
<?
$host="XXXXX";
$user="XXXXX";
$password="XXXXX";
$dbname="XXXXX";
$table="XXXXX";
?> |
|
clickbr
Založený: 30.03.2011
Príspevky: 4
Zaslal: 2011-04-13 16:43
Návrat hore
Odpovedať s citátom
|
done solved with ob_start ();
Tks!
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|