codice:
function redirect($url,$timeout=0) 
{
	echo "\n<script language=\"javascript\">\n";
	if($timeout == 0) 
	{
		echo "  window.location=\"$url\";\n";
	}
	else 
	{
		echo "string=\"\", timeout = ".($timeout*10).";\n";
		echo "function dorefresh() {\n";
		echo "  window.status=\"Loading\"+string;"; 
		echo "  string = string + \" .\";";
		echo "  timerID = setTimeout(\"dorefresh();\", 100);\n";
		echo "  if (timeout > 0) {";
		echo "    timeout -= 1;\n";
		echo "  } else {\n";
		echo "    clearTimeout(timerID);\n";
		echo "    window.status=\"\";\n";
		echo "    window.location=\"$url\";\n";
		echo "  }\n";
		echo "}\n";
		echo "dorefresh();";
	}
	echo "\n</script>\n";
}
ciao..