mike12255 Posted September 20, 2009 Share Posted September 20, 2009 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? Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 20, 2009 Share Posted September 20, 2009 first you need to understand folders. install.php/folder1/folder2/folder3 this will make a dir called redarrow in folder2 hopefully. <?php $dir_name="redarrow"; $dir = "/folder1/folder2/"; mkdir("$dir/$dir_name"); ?> Quote Link to comment Share on other sites More sharing options...
mike12255 Posted September 20, 2009 Author Share Posted September 20, 2009 i understand folders i need to go up a directory and create my new folder and files Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 20, 2009 Share Posted September 20, 2009 are you telling me that /admin/the file not adding tot he folder admin.php Quote Link to comment Share on other sites More sharing options...
mike12255 Posted September 20, 2009 Author Share Posted September 20, 2009 here is my website layout the italic admin folder does not exsist from withing the install folder i am trying to create the directory admin sub folders rootfolder admininstall Quote Link to comment Share on other sites More sharing options...
knsito Posted September 21, 2009 Share Posted September 21, 2009 try $path = realpath("../"); $path = $path."/admin" if(!is_dir($path)){ mkdir($path); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.