Page 1 of 1

CHMOD - My company's host is Windows. HELP!

Posted: Wed Sep 21, 2005 1:10 pm
by $var
Hello,

I am still pretty new to programming,
so I haven't been exposed to the differences between servers,
and I am beginning to realize that some of the scripts that I've used,
aren't peforming the same.

I have this upload script, but I am having problems with server permissions,
and I can just imagine that I am going to hit more blocks with the rest of the server commands.

Code: Select all

if($_POST["bpress"]=="delete")
	{
		$sql = "DELETE FROM BandDJ WHERE BandDJID=".$ID;
		if(!$result = mysql_query($sql))
		{
			echo mysql_error();
		}
		@ chdir ($path)
			or die ("Cannot set the current working directory to <i>$path</i>.");
		for($x = 0; $x < $numimages; $x++)
      	{
      		@unlink($imagearray[$x]);
      	}
      	@ chdir ($_SERVER['DOCUMENT_ROOT']."/toronto/BandDJ")
      		or die ("Cannot set the current working directory to <i>$path</i>.");
		@rmdir($path) or die('Folder '.$path.' couldn\'t be deleted!');
		header("Location: http://www.20hzmusic.com/");
		exit;
	}

The rmdir and chdir are linux right? Is there a huge difference?
Do I need a different code for a Windows machine?

Posted: Wed Sep 21, 2005 9:05 pm
by ambivalent
rmdir is a Linux command but chdir isn't - that would be "cd". That shouldn't matter though because they are both valid PHP functions and should work the same way on Linux or Windows machines. The problem must be elsewhere. It may sound trivial, but check to see if the target directory exists. What is the error message?