<?php 
function relien($exclus='',$ajouts='')
{
	$exclus = trim($exclus);
	$ajouts = trim($ajouts);
	if(!empty($exclus))
	{
		$exclus = explode(',',$exclus);
	}
	else $exclus = array();
	if(!empty($ajouts))
	{
		$ajouts = explode(',',$ajouts);
	}
	else $ajouts = array();
	$newlink = array();
	foreach($_GET as $k=>$v)
	{
		if(!in_array($k,$exclus))
		{
			$newlink []= "$k=$v";
		}
	}
	foreach($ajouts as $V)
	{
		$newlink []= $V;
	}
	return implode('&',$newlink);
}

function haveUrl($path)
{
	$url =  $_SERVER['REQUEST_URI'];
	$nouveau = array();
	$actuel = explode('/',$url);
	$relatif = explode('/',$path);
	$pos = 1;
	foreach($relatif as $elt)
	{
		if($elt=='..') $pos++;
	}
	$reste = array_slice($relatif,$pos-1);
	$count = count($actuel);
	$actuel = array_slice($actuel,0,$count-$pos);
	//traitement
	$nouveau = array_merge($actuel,$reste);
	//fin traitement
	$proto = 'http';
	if(!empty($_SERVER['HTTPS'])) $proto = 'https'; 
	$url = $proto.'://'.$_SERVER['HTTP_HOST'].implode('/',$nouveau);
	return $url;
	return false;
}
function var_navigation($vars)

{

	$vars = explode(',',$vars);
	$newlink = array();
	foreach($vars as $var)

	{
		if(!empty($_REQUEST[$var])) $newlink []= "$var=".$_REQUEST[$var];
	}

	return implode('&',$newlink);

}
function revars($exclus='',$ajouts='')

{
	$_LINK = array_merge($_POST,$_GET);
	$exclus = trim($exclus);

	$ajouts = trim($ajouts);

	

	if(!empty($exclus))

	{

		$exclus = explode(',',$exclus);

	}

	else $exclus = array();

	

	if(!empty($ajouts))

	{

		$ajouts = explode(',',$ajouts);

	}

	else $ajouts = array();

	

	$newlink = array();
	

	foreach($_LINK as $k=>$v)

	{

		if(!in_array($k,$exclus))

		{

			if(!empty($v)) $newlink []= "$k=$v";

		}

	}

	foreach($ajouts as $V)

	{

		$newlink []= $V;

	}
	return implode('&',$newlink);

}
function retour()
{
	echo '<script type="text/javascript">self.location="'.$_SERVER['HTTP_REFERER'].'";</script>';
}
?>