Jump to content

cant create file were i want


mike12255

Recommended Posts

so i want to have to places on my site an admin folder and the main site so im creating the admin folder with mkdir however it keeps creating the folder in the install folder i have tried ../ and ././ methods. Also i dont know were this is going but i have it creating a config.php file that is suposed to go in the main site and admin folder however its not appearing at all. The install folder is a folder of the main site. so its not a folder inside a folder or anything.

 

here is my code:

<?php
$config = "<?php 

// database connection config
\$dbHost =  '$db';
\$dbUser = '$dbuser';
\$dbPass = '$dbpass';
\$dbName = '$dbname';
\$bid = '$bid';


\$dbConn = mysql_connect (\$dbHost, \$dbUser, \$dbPass) or die ('MySQL connect failed. ' . mysql_error());
mysql_select_db(\$dbName) or die('Cannot select database. ' . mysql_error());




?>";
   //create and open and create the config file
$fn = "././config.php";
$fn2 = "././admin/config.php";

$fh = fopen($fn ,'w') or die("can't open file");
//write in into the config file
$fh = fwrite($fh,$config);
//close it to open the admin config file
//fclose($fh);
//open the admin config file
$fh2 = fopen($fn2 ,'w') or die("can't open file");
//write into the admin config file
fwrite($fh2, $config);
//close the admin config file
//fclose($fn);

?>

 

 

can anyone help me with this issue?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.