1) { $paginanaam = implode("/",$uri_parts); $paginanaam = ltrim($paginanaam,"/"); // check url, met en zonder slash ( dus 'naam' en '/naam') $sql = "select * from redirects where old_url = '".mysql_real_escape_string($paginanaam)."' OR old_url = '/".mysql_real_escape_string($paginanaam)."'"; $res = mysql_query($sql); if ($redirect = mysql_fetch_assoc($res)) { $redirectfound = true; $new_url = $redirect["new_url"]; } if (!$redirectfound AND preg_match("#(.*)\?#",$paginanaam,$match)) { $paginanaam = $match[1]; $sql = "select * from redirects where old_url = '".mysql_real_escape_string($paginanaam)."'"; $res = mysql_query($sql); if ($redirect = mysql_fetch_assoc($res)) { $redirectfound = true; $new_url = $redirect["new_url"]; } } array_pop($uri_parts); } $paginanaam = array_shift($uri_parts); if ($redirectfound) { header("HTTP/1.1 301 Moved Permanently"); header("Location: http://".$settings["url"]."/".ltrim($new_url,"/")); exit; } if (empty($pagina)) { // tja geen pagina en geen redirect aanwezig. Dus 404 presenteren... // Check redirect status, als redirect (bijvoorbeeld 401.shtml via server config), // dan geen custom 404 headers, maar oude status houden if (!is_numeric($_SERVER["REDIRECT_STATUS"])) { header( "HTTP/1.1 404 Not found" ); } $sql = "SELECT * FROM paginas WHERE url = \"error\""; $res = mysql_query($sql); if($errpage = mysql_fetch_assoc($res)) { $template = $errpage["template"]; $pagina = $errpage["id"]; $titel = $errpage["titel"]; } } IncludeTaal($taal); if ($_REQUEST["action"] == "logout") { uitloggen(); } if (isset($_REQUEST["uitloggen"])) { uitloggen(); } if ($protected) { if (!ingelogd()) { if (isset($_REQUEST["lostpass"])) { $g_sMessage = lostpass(); } if (isset($_REQUEST["changepass"])) { $g_sMessage = changepass(); } if (!inloggen($g_sMessage)) { GetLoginPage($pagina,$title,$metadesc,$metakeywords,$taal,$template,$protected); } } } // speciaal voor users & inloggen if (DEBUG) { print "
debug info:
session:
"; print "
GetPageFromURL
"; print "GetPageFromURL($pagina,$title,$metadesc,$metakeywords,$taal,$template,$protected);
" ; print "
session:
"; print_r($_SESSION); print "
post:
"; print_r($_POST); print "
request:
"; print_r($_REQUEST); print "globals: rubriek: $rubriek, page: $page, id: $id"; print "
"; } if (empty($template)) { $template = $settings["DefaultTemplate"]; } if (!empty($template)) { $templatefile = dirname(__FILE__)."/templates/".$template; if (file_exists($templatefile)) { include($templatefile); } }