0

I am getting this error:

Notice: Undefined index: REDIRECT_URL in /home/webccans/public_html/index.php

I have Tried taking out the redirect and it still works. I need help try to define the index "REDIRECT_URL" I would appreciate and pointers or advice. The page is display, and the site works fine but this error is on the home page

This is the Code on my index page

<?
include('application.php');
$header = false;

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

if (($request = trim($_SERVER['REDIRECT_URL'])) == '') {
    // Deal with direct requests
    $Page = (isset($_GET['Page'])) ? $_GET['Page'] : 1;
    $Page = $CMS->getPageContent($Page);
} else {
    // Deal with "friendly" URL 404 pages
    $pages = explode('/', $request);
    array_shift($pages);
    $page = array_pop($pages);
    if (($pos = strpos($page, '.')) === false) {
        $ext = '';
    } else {
        $ext = substr($page, strpos($page, '.'));
        if ($pos = strpos($ext, '?')) $ext = substr($ext, 0, $pos);
    }
    if ($page == '') {
        // have a CMS page or the home page
    } else if ($ext == '.htm' || $ext == '.html' || $ext == '.php') {
        $PageURL = substr($page, 0, strlen($ext) * -1);
        if ($PageURL != "index") {
            // Possible have a CMS page
            array_push($pages, $PageURL);
        }
    } else if ($ext == '') {
        // have a CMS page
        array_push($pages, $page);
    } else {
        $CMS->show404Page();
        $header = true;
    }
    if (($numPages = count($pages)) > 0) {
        // Get PageID
        $select = 'SELECT ';
        $from = ' FROM site_content AS page0 LEFT JOIN site_content AS 
   page ON (page0.ParentID = page.PageID) ';
        $where = ' WHERE (page0.ParentID = 0 OR page.Display = 0) ';
        for ($idx = 0; $idx < $numPages; ++$idx) {
            $where .= ' AND ';
            if ($idx > 0) {
                $select .= ', ';
                $from .= ' JOIN site_content AS page' . $idx . ' ON (page' 
 . ($idx - 1) . '.PageID = page' . $idx . '.ParentID)';
            }
            $select .= 'page' . $idx . '.PageID ';
            $where .= 'page' . $idx . '.PageURL = "' . $DB- 
    >escape(strtolower($pages[$idx])) . '"';
            #$select1 = 'page' . $idx . '.PageID ';
        }
        $qid = $DB->query($select . $from . $where);

        if ($row = $DB->fetchRow($qid)) {
            $PageID = $row[$numPages - 1];
            $OpenedPages = $row;
            #print_r ($row);
        }
        else {
            $CMS->show404Page();
            $header = true;
        }

    } else {
        $PageID = 1;
    }
    $Page = $CMS->getPageContent($PageID);

    #echo '<script language="javascript">' . 'alert("' . $PageID . '")' 
 . 
 '</script>';
    #echo '<script language="javascript">' . 'alert("' . $ParentId . '")' 
   . '</script>';
}

$TopPage = $CMS->getTopParent($Page->PageID);
if (!$header) header('HTTP/1.1 200 OK');
?>
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
Jon Toler
  • 1
  • 1
  • have look at the [user comments in the docs](http://php.net/manual/de/reserved.variables.server.php#120979) – Jeff Jun 26 '18 at 22:52
  • 1
    $_SERVER['REDIRECT_URL'] is only populated by Apache on an internal redirect, i would expect it not to exist more often than not. –  Jun 26 '18 at 22:53
  • Possible duplicate of [Reference - What does this error mean in PHP?](https://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) – elixenide Jun 27 '18 at 00:06

0 Answers0