$enddate || $ThisDate < $startdate) { $ThisDate = $startdate; } if(!($ThisPortID > 0) || ($ThisPortID > 5000)) { Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: http://ports.cruisett.com" ); } else { $query = "Select Country,PortName,ID from PortNamesDisplay Where ID = " . $ThisPortID; $con = mysql_connect("mysql1.hosting.digiweb.ie","jhegart_newtt","QcwgscTT"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("jhegart_cruise", $con); $result = mysql_query($query,$con); $newurl = "http://ports.cruisett.com"; if($result) { while($row = mysql_fetch_array($result)) { $PortLink = str_replace(" ", "_", "/schedule/" . $row[0] . "/" . $row[2] . "-" . $row[1] . "/" . date('F Y', strtotime($dateref[$ThisDate]))); $PortLink = preg_replace("/[^a-zA-Z0-9_\-()\/\s]/", "", $PortLink); } } Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: " . $newurl . $PortLink ); } ?>