<?php

// index.php
// -----------------------------------------------------------------------------
// Redirect user to page in parent directory,
// determined by last directory name in URL, preserving the query string
// eg Send /numbers/0800/ to /numbers/0800.php
//
// Project    > abs_AdaptiveSalesSite_dec05:S01_C06
// Copyright  > (C) Digital Mail Limited (2005 - 2009)
// Author     > RAK for DML
// -----------------------------------------------------------------------------

include(DOCROOT . '/dmx/dmx_options.php');
// Set site root (if not already set) with NO trailing slash
if (!isset($abs_root)) $abs_root = '';
include_once($abs_root . '/common/abs_lib.php');
$abs_path = abs_analyse_path($_SERVER['PHP_SELF']);
$pagepath = implode('/', array_slice($abs_path['full'], 0, count($abs_path['full'])-2));
$pagename = $abs_path['full'][count($abs_path['full'])-2] . '.php'; // Generate pagename from final directory in URL
$query = $_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : '';
header('LOCATION: ' . $abs_root . '/' . $pagepath . '/' . $pagename . $query_string); // Forward user to page
exit;

?>