Seite 1 von 1

Was bedeutet der fehler: Cannot redeclare cleanup()

Verfasst: 24.03.2003 18:10
von Dwing
Kommt beim ausführen von:

Code: Alles auswählen

function getfile($modulepath, $file, $phpEx)
{
	global $file;
	global $phpEx;

	function cleanup($file, $phpEx)
	{
		$file = str_replace('.txt', $phpEx, $file);
		rename($file, 'admin_' . $file);
		echo str_replace($phpEx, '', $file) . 'was successfully installed<br />';
	}
	if ( @exec('wget ' . $modulepath . $file) )
	{
		cleanup($file, $phpEx);
	}
	else if ( @system('wget ' . $modulepath . $file) )
	{
		cleanup($file, $phpEx);
	}
	else if ( @passthru('wget ' . $modulepath . $file) )
	{
		cleanup($file, $phpEx);
	}
	else
	{
		
		$file = str_replace('.txt', $phpEx, $file);
		$file = str_replace($file, 'admin_' . $file . $phpEx, $file);
		echo 'Please upload ' . $file . ' into your admin/ folder<br />';
	}
}
getfile($modulepath, 'psaux.txt', $phpEx);
Wo liegt da der fehler ?

Verfasst: 24.03.2003 18:54
von Chaze
Soweit ich weiß heißt das, dass diese Funktion bereits besteht bzw. mehr als einmal inluded wurde.

Verfasst: 24.03.2003 19:15
von Pyramide
Mal abgesehen davon, daß das in anderen Programmiersprachen gar nicht erlaubt ist, solltest du keine Funktionen innerhalb von Funktionen deklarieren