connect($DB_HOST,$DB_USER,$DB_PASSWD, $wbc_dbpconnect) || !$db->open($DB_DATABASE)) exitPage($db->lastError()); $session = new wbcsession(); $bNewSession = 1; $bForward = 0; if(!isset($_GET["sid"])){ $sid = $session->gensession(); } elseif( !$session->usesession($_GET["sid"])){ $sid = $session->gensession(); if( !$wbc_sess_loadpage ) $tpl = $wbc_pages[PAGE_NOSESSION]; } else { $sid = $session->sid(); $session->updatesession(); $bNewSession = 0; } if( $bNewSession ){ $session->setdata("gid", $wbc_gid_nologin); $session->setuserdatalist(Array("gid" => $wbc_gid_nologin, "n_b_preise" => 0, "mwst" => 1, "wrg" => $wbc_cu_start, "sprache" => $wbc_lc_start)); } else { $session->setdata("pageadd_title",""); $session->setdata("pageadd_beschreibung",""); $session->setdata("pageadd_keywords",""); } $thisScript = "wbc.php?".(empty($sid)?"":"sid=".$sid."&"); $bOptionSSL = strcmp("https://",$GLOBALS["wbc_www_ssl"]); $lckey = ""; $use_lc = 0; $session->setlc(); if(isset($_GET["cmd"])){ $_GET["cmd"] = preg_replace("/[^a-z0-9]+/","",$_GET["cmd"]); if( file_exists("inc/wbc_".$_GET["cmd"].".php") ){ require_once ("inc/wbc_".$_GET["cmd"].".php"); } } $actPagePara = ""; $agets = array_diff(array_keys($_GET),Array("cmd","tpl","sid")); //array_intersect(array_keys($_GET),Array("rid","cid","pid","id","page","q","recno")); $bPageAdd = 0; foreach ($agets as $key) { switch( $key ){ case "pid": $_GET["pid"] = (int) $_GET["pid"]; if( $use_lc ){ $query = $db->query("SELECT bezeichnung,kurzbez,keywords from ".DB_TPREFIX."locale where typ='ITEM' and lid=".$_GET["pid"]." and country='".$lckey."' LIMIT 1"); } else { $query = $db->query("SELECT bezeichnung,kurzbez,keywords from ".DB_TPREFIX."items where pid=".$_GET["pid"]." limit 1"); } if( $record = $db->record($query)) $bPageAdd = 1; if( !$bForward) $session->setstat(8,$_GET["pid"]); if(!in_array("rid",$agets)){ $query = $db->query("SELECT rid from ".DB_TPREFIX."itemnodes where pid=".$_GET["pid"]." order by main desc limit 1"); if( $catrecord = $db->record($query)) $_GET["rid"] = $catrecord["rid"]; } break; case "q": if( !$bForward) $session->setstat(15, 0, trim(preg_replace("/[^\w \-÷ńŘ▀]/","",$db->strtolower($_GET["q"]))) ); $_GET["q"] = str_replace(Array("{","}"),Array("",""),$_GET["q"]); break; case "rid": $_GET["rid"] = (int) $_GET["rid"]; if( !$bForward) $session->setstat(9, $_GET["rid"]); if( !$bPageAdd ){ if( $use_lc ){ $query = $db->query("SELECT bezeichnung,kurzbez,keywords from ".DB_TPREFIX."locale where typ='CAT' and lid=".$_GET["rid"]." and country='".$lckey."' LIMIT 1"); } else { $query = $db->query("SELECT bezeichnung,kurzbez,keywords from ".DB_TPREFIX."itemcats where rid=".$_GET["rid"]." limit 1"); } if( $record = $db->record($query)) $bPageAdd = 1; } break; case "cid": $_GET["cid"] = (int) $_GET["cid"]; if( !$bPageAdd && array_key_exists("id",$_GET)){ if( $use_lc ){ $query = $db->query("SELECT bezeichnung,kurzbez,keywords from ".DB_TPREFIX."locale where typ='INH' and lid=".$_GET["id"]." and country='".$lckey."' LIMIT 1"); } else { $query = $db->query("SELECT bezeichnung,kurzbez,keywords from ".DB_TPREFIX."content where id=".$_GET["id"]." limit 1"); } if( $record = $db->record($query)) $bPageAdd = 1; } break; case "recno": $_GET["recno"] = (int) $_GET["recno"]; break; case "id": $_GET["id"] = (int) $_GET["id"]; if( array_key_exists("cid",$_GET)){ if( !$bForward) $session->setstat(10, $_GET["id"]); } break; default: $_GET[$key] = str_replace(Array("{","}"),Array("",""),$_GET[$key]); } $actPagePara .= "&".$key."=". urlencode($_GET[$key]); } if( $bPageAdd ){ $session->setdata("pageadd_title",$record["bezeichnung"]?$record["bezeichnung"]." ":""); $session->setdata("pageadd_beschreibung",$record["kurzbez"]?$record["kurzbez"]." ":""); $session->setdata("pageadd_keywords",$record["keywords"]?$record["keywords"]." ":""); } if($wbc_login_required){ if( strcmp($tpl,$wbc_pages[PAGE_NOSESSION]) && strcmp($tpl,$wbc_pages[PAGE_INDEX]) && !$session->getdata("validuser") ) $tpl = $wbc_pages[PAGE_LOGINREQUIRED]; } elseif ($bForward ){ $session->savedata(); header("Location: ".$thisScript."tpl=".$tpl.$actPagePara); exit; } $template = load_template($tpl); echo parseTemplate($template); $lasturlquery = $session->getdata("lasturlquery"); $newurlquery = preg_replace("/sid=[0-9a-zA-Z]+&?/i","",$_SERVER["QUERY_STRING"]); if( sizeof($_POST) == 0) $session->setdata("lasturlquery",$newurlquery); if( $session->getdata("error") ){ if( strcmp($lasturlquery,$newurlquery) ) $session->setdata("error",""); } $session->savedata(); ?>