0 ){ header( "Location: /", 301 ); exit; } include_once( "class.dbengine.php" ); db_use( "fitmax", "sf8_" ); $rec = db_fetch( db_qbe( "~articoli", array( "htmlIT" => $p ) ) ); if( trim( $rec["new_url"] ) != "" ){ Header( "Location: " . $rec["new_url"], 301 ); exit; } $rec1 = db_fetch( db_qbe( "fitmax_magento_articoli", array( "id" => $rec["id"] ) ) ); if( $rec1["magento_id"] ){ $productId = $rec1["magento_id"]; include_once ("app/Mage.php" ); Mage::init(); Header( "Location: /" . Mage::getResourceSingleton('catalog/product')->getAttributeRawValue($productId, 'url_key', Mage::app()->getStore()) . ".html", 301 ); exit; } if( $rec["hit"] != "S" && $rec["id"] != "" ){ $p .= "\nhttp://www.fitmax.it/schede/" . $p . "/index.html"; mail( "matteo.ligabue@gmail.com", "Fitmax url non trovato", $p ); mail( "carretta@mow.it", "Fitmax url non trovato", $p ); db_updaterow( "~articoli", array( "id" => $rec["id"], "hit" => "S" ) ); } header( "Location: /", 301 );