<?php

// index.php
// -----------------------------------------------------------------------------
// Redirect user to a page in the parent directory,
// determined by last directory name in the URL (preserving the query string)
// eg Send /numbers/0800/ => /numbers/0800.php
// eg      /numbers/0800/c_chooser/login/ => /numbers/0800/c_chooser/login.php
//
// Project    > A16-dmABS-1.5-Feb09
// 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;

?>