<?php 
set_time_limit(0);

if(!isset($_POST['city']))
{
	header("Location:/virtual-numbers.html");
} elseif($_POST['city'] == '' || $_POST['city'] == 'Enter dialling code or city name')
{
	header("Location:/virtual-numbers.html");
} else
{
	$fullname = trim($_POST['city']);
	if($fullname == '0207 London Area Code')
		header("Location:/0207-numbers.html");
	else if($fullname == 'UK Local Area Numbers')
		header("Location:/local-area-numbers.html");
	else if($fullname == '0800 Toll free')
		header("Location:/0800-numbers.html");
	else if($fullname == '0844 Numbers')
		header("Location:/0844-numbers.html");
	else if($fullname == '0845 Numbers')
		header("Location:/0845-numbers.html");
	else if($fullname == '0870 Numbers')
		header("Location:/0870-numbers.html");
	else if($fullname == '0871 Numbers')
		header("Location:/0871-numbers.html");
	else if($fullname == '07-D World Office')
		header("Location:/07-d-numbers.html");
	else if($fullname == '07-K World Mobile')
		header("Location:/07-k-numbers.html");
	else if($fullname == '07-PN2 Personal Numbers')
		header("Location:/07-pn2-numbers.html");
	else if($fullname == 'Gold Memorable Numbers')
		header("Location:/gold-numbers.html");
	else
	{
	        $pos = strpos($fullname," ");
	        if($pos == false)
	            header("Location:/virtual-numbers.html");
	        else
	        {
	            $telcode = substr($fullname,1,$pos-1);
	            $fullcity = substr($fullname, $pos+1);
				
				if($telcode && $fullcity)
				{
		            $city = strtolower(str_replace("- ","",str_replace(")","",str_replace("(","",str_replace(" ","-",$fullcity)))));
		            $link = '/geographic-numbers/0'.$telcode.'-numbers-'.$city.'.html';
		            header("Location:".$link);
				} else {
					header("Location:/virtual-numbers.html");
				}
	        }
	}
}

?>