<?php

include("settings.php");

function redirect($base, $get, $force_unfancy = false){
	$result = "/" . $base;

	if(!$GLOBALS['fancy_urls'] or $force_unfancy){
		$result .= ".php";
	}
	elseif(isset($get["q"])){
		$result .= "/" . $get["q"];
		unset($get["q"]);
	}


	if($get){
		$i = 0;
		foreach($get as $key => $value){
			if($i == 0)	$result .= "?";
			else		$result .= "&";

			$result .= $key . "=" . $value;
			$i++;
		}
	}

	return($result);
}

?>
