Sorry if anyone has seen anything like this before but: All I want to do is get a script to write a file to the root directory. I get permission problems. Is there any way around this or am I going to go crazy trying. Obviously I can't have users setting the root directory to CHMOD 777, I can't expect users to get system admins to change ownerships on files, so is there a way in PHP script to write to the root after I have executed this script?
The problem comes in the re-name of the script: function generate_page($formid, $pagename) { // Give the function the string to be generated including formid passed from // previous form // Begin string $string = "<?php // include the files from output fns to get functions which design the page include ('output_fns.php'); db_connect(); \$query = \"select * from goldfish_content where PageID='$formid'\"; \$result = mysql_query(\$query) or die(\"Error: Query failure with<BR>\$query<BR>\".mysql_error()); while (\$array = mysql_fetch_array(\$result)) { \$HeadTitle = \"\{\$array[\"HeadTitle\"]}\"; \$PageTitle = \"\{\$array[\"Title\"]}\"; \$BodyText = \"\{\$array[\"BodyText\"]}\"; \$Picture1 = \"\{\$array[\"PictureOne\"]}\"; \$Picture2 = \"\{\$array[\"PictureTwo\"]}\"; \$CatID = \"\{\$array[\"CatID\"]}\"; } // carry the variable head title in the page and do the page header do_html_header(\$HeadTitle); // carry variables into do_html_index() function in output_fns. // Page title = The headline of the page // Body text = The text body, can include html commands. // Picture 1 = picture or graphic that appears above the title if required. // Picture 2 = Picture that appears right hand side on the basic output_fns // CatID = Category which is used for determining which links appear on each page // Section name = Allows you to specify extra functions to output_fns.php to be unique to the page (requires hard coding) do_html_index(\$PageTitle, \$BodyText, \$Picture1, \$Picture2, \$CatID, \$SECTION_NAME); // put the page footer in position do_html_footer(); ?>"; // end of string // Define the filename to write to. $filename = 'test.txt'; // Open the file for overwriting. $fp = fopen($filename, "w"); // Write the string to the file $write = fputs($fp, $string); // Close the file fclose($fp); // ****rename the page as a php file // everything works fine until I try to rename this file as the form $pagename var in the root. I get permission denied. rename ($filename, "../$pagename.php"); // end of function. } // call the function. generate_page($formid, $pagename); ?> The page generates great and everything is hunky dory if the root is chmoded 777 but I have a feeling I'm wasting my time with this route unless someone has a better idea. Steve Jackson Web Development and Marketing Manager Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php