"; //echo "SERVER_NAME:".$_SERVER['SCRIPT_NAME']."
"; //echo "QUERY_STRING:".$_SERVER['QUERY_STRING']."
"; //die(); $bLogging = true; $aQueries = array(); $tempQueries = explode('&',$_SERVER['QUERY_STRING']); foreach($tempQueries as $q) { list($key,$value) = explode("=",$q); $aQueries[$key] = $value; } // Sprache aus Parameter holen if(isset($aQueries['l'])) { $strLanguage = $aQueries['l']; } else { header("Location: http://www.jcrelations.net/"); header("HTTP/1.1 404 Not Found"); exit; } //print_r($aQueries); // Sicherung gegen direktes Aufrufen des Scripts // Der pass Parameter wird in der htaccess gesetzt if($aQueries['pass'] != 'jcr') { header("Location: http://www.jcrelations.net/"); header("HTTP/1.1 404 Not Found"); exit; } require_once("typo3conf/localconf.php"); $db = mysql_connect($typo_db_host, $typo_db_username, $typo_db_password); if (!$db) { //echo "Keine Verbindung zur DB: " . mysql_error(); header("Location: http://www.jcrelations.net/"); header("HTTP/1.1 404 Not Found"); exit; } if (!mysql_select_db($typo_db)) { //echo "Kann DB nicht auswählen: " . mysql_error(); header("Location: http://www.jcrelations.net/"); header("HTTP/1.1 404 Not Found"); exit; } // Logging if($bLogging) { $unixTime = time(); $log_sql = "INSERT INTO jcr2_mapping_log (`strIP`,`strTime`,`unixTime`,`strDomain`,`strLanguage`,`strItem`,`strArea`,`strCategory`) VALUES ('".$_SERVER['REMOTE_ADDR']."','".date("d-m-Y H:i:s",$unixTime)."',".$unixTime.",'".$_SERVER['HTTP_HOST']."','".$strLanguage."','".addslashes(urldecode( $aQueries['item'] ))."','".addslashes(urldecode( $aQueries['area'] ))."','".addslashes(urldecode( $aQueries['category'] ))."')"; $log_res = mysql_query($log_sql); } $bParamOK = false; if(isset($aQueries['item'])) { //echo "ItemID set
"; $nImportID = intval($aQueries['item']); if( $nImportID != 0 ) { $sql = "SELECT strTitelLT as strPageName, nPublishPageID, nLanguageID FROM dk3_medien WHERE ((nMedientypID=250) OR (nMedientypID=195)) AND strStatus = 'published' AND strImportID = '". $nImportID. "'"; $bParamOK = true; } } elseif(isset($aQueries['id'])) { //echo "ItemID set
"; $nImportID = intval($aQueries['id']); if( $nImportID != 0 ) { $sql = "SELECT strTitelLT as strPageName, nPublishPageID, nLanguageID FROM dk3_medien WHERE ((nMedientypID=250) OR (nMedientypID=195)) AND strStatus = 'published' AND strImportID = '". $nImportID. "'"; $bParamOK = true; } } elseif((isset($aQueries['area'])) && (isset($aQueries['category']))) { //echo "Area and Category set
"; $strArea = urldecode( $aQueries['area'] ); $strCategory = urldecode( $aQueries['category'] ); //mit Spracheinschraenkung // $sql = "SELECT strCategory as strPageName, nPublishPageID, nMappedLanguageID as nLanguageID FROM jcr2_category_mapping WHERE strArea = '". $strArea ."' AND strCategory = '". $strCategory ."' AND strLanguageID = '". $strLanguage ."'"; //ohne Spracheinschraenkung zum debuggen $sql = "SELECT strCategory as strPageName, nPublishPageID, nMappedLanguageID as nLanguageID FROM jcr2_category_mapping WHERE strArea = '". $strArea ."' AND strCategory = '". $strCategory ."'"; $bParamOK = true; } elseif(isset($aQueries['area'])) { //echo "Area set
"; $strArea = urldecode( $aQueries['area'] ); //mit Spracheinschraenkung // $sql = "SELECT strArea as strPageName, nPublishPageID, nMappedLanguageID as nLanguageID FROM jcr2_category_mapping WHERE strArea = '". $strArea . "' AND strCategory = '' AND strLanguageID = '". $strLanguage ."'"; //ohne Spracheinschraenkung zum debuggen $sql = "SELECT strArea as strPageName, nPublishPageID, nMappedLanguageID as nLanguageID FROM jcr2_category_mapping WHERE strArea = '". $strArea . "' AND strCategory = ''"; $bParamOK = true; } else { $bParamOK = false; } if ($bParamOK) { //echo $sql; $res = mysql_query($sql); if (!$res) { //echo "Anfrage ($sql) konnte nicht ausgeführt werden : " . mysql_error(); $bParamOK = false; } else { if (mysql_num_rows($res) == 0) { //echo "Keine Zeilen gefunden, nichts auszugeben, daher Abbruch"; $bParamOK = false; } else { $row = mysql_fetch_assoc($res); header('HTTP/1.1 301 Moved Permanently'); if($aQueries['l'] == 'ru') { $strNewTarget = 'Location: http://www.jcrelations.net/Сторона.'.$row['nPublishPageID'].'.0.html?L='.$row['nLanguageID']; } else { $strNewTarget = 'Location: http://www.jcrelations.net/'.urlencode($row['strPageName']).'.'.$row['nPublishPageID'].'.0.html?L='.$row['nLanguageID']; } } } } if (! $bParamOK) { $strNewTarget = 'Location: http://www.jcrelations.net/'; header("HTTP/1.1 404 Not Found"); } header($strNewTarget); //echo $strNewTarget; ?>