Jump to content

using rename to move to an uncreated directory


cooldude832

Recommended Posts

I'm trying to expand my CMS for ppl who don't want to .htaccess mod it.  Meaning that I need physical files in locations instead of using .htaccess and the request URL to use a single php processor.

 

In my admin section I can "move" the physical file via

<?php
if(!is_file(ROOT.$url)){
		$q = "Select Url from `".PAGES_TABLE."` Where PageID = '".$id."'";
		$r = mysql_query($q) or die(mysql_error()."<br /><br />".$q);
		$row = mysql_fetch_assoc($r);
		if(rename(ROOT.$row['Url'],ROOT.$url)){
			$_SESSION['No_Errors'][] = "The file was moved.";
		}
		else{
			$_SESSION['Errors'][] = "Error moving the file.";
		}
	}
?>

My only issue is when the directory isn't there I get the error on the rename function.  Anyone got a crafty idea to integrate viral directory growth on this?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.