/* -- NEW CODE -- */
$wssID=$_REQUEST['semillas'];
$domain="http://weedseedshop.com";
$serverIP="10.123.18.34";
$serverName="SQL01-PROD";
$user="wuser";
$password="Pass123";
$database="SeedWebGo";
$dsn="SeedWebGo";
$connection = mssql_connect($serverIP, $user, $password);
if (!$connection):
print "CONNECTION FAIL
";
endif;
/* select the database */
$dbSelect = mssql_select_db($database, $connection);
if (!$dbSelect):
print "DATABASE SELECT FAIL
";
endif;
$sql = "
SELECT top 1
ItemCode,
strTitle,
strURL
FROM [vwWSS-OSCommereIds-to-URL]
WHERE intLanguage='2'
AND [WSS ID]=".$wssID."
ORDER BY ItemCode
";
$result = mssql_query($sql, $connection) or die("SQL FAIL: ".mssql_get_last_message());
if ($result):
$row = mssql_fetch_assoc($result);
$location = $domain."/".$row["strURL"]."";
/* print $location; */
else:
$location = $domain."/semillas-de-cannabis";
endif;
header ('HTTP/1.1 301 Moved Permanently');
header ('Location: '.$location);
?>