Jump to content

Undefined index / variable


Guest Rakesh

Recommended Posts

Guest Rakesh

Hello everbody once again ;

I have enable display_errors = on on php.ini and click on Admin --> File Manager --> Upload Images : Then I got following error ::

___________

Notice: Undefined index: host in /var/www/html/store/classes/db.inc.php on line 43

Notice: Undefined variable: HTTP_SERVER_VARS in /var/www/html/store/includes/sslSwitch.inc.php on line 31

Notice: Undefined index: HTTPS in /var/www/html/store/includes/functions.inc.php on line 50

Notice: Undefined index: HTTPS in /var/www/html/store/includes/functions.inc.php on line 54

__________

I also found under amdin --> misc --> Server Info

--

Notice: Undefined index: rootRel in /var/www/html/store/admin/misc/info.php on line 2

Notice: Undefined index: rootRel in /var/www/html/store/admin/misc/info.php on line 2

Notice: Undefined variable: glob in /var/www/html/store/admin/misc/info.php on line 4

Notice: Undefined variable: glob in /var/www/html/store/admin/misc/info.php on line 7

--

Please help me to solve this

Link to comment
Share on other sites

Guest leftjustified

I switched on full error reporting in the store (modify error_reporting() call in includes/ini.inc.php) and got the same suprise you did. :D

The notices that get thrown seem on the most part tiny moments of coding laziness that take some shine off an otherwise good product :errm:

> Notice: Undefined index: host in /var/www/html/store/classes/db.inc.php on line 43

Change line 43:

this comment in the php manual for some options. >Notice: Undefined index: HTTPS in /var/www/html/store/includes/functions.inc.php on line 50 >Notice: Undefined index: HTTPS in /var/www/html/store/includes/functions.inc.php on line 54

  old: if($_GET['host']=="localhost" && isset($glob['dbhost'])){

new:

  if(@$_GET['host']=="localhost" && isset($glob['dbhost'])){


-- this is not a fix, it just supresses the error



>

>Notice: Undefined variable: HTTP_SERVER_VARS in /var/www/html/store/includes/sslSwitch.inc.php on line 31


old:

if (ereg(".inc.php",$HTTP_SERVER_VARS['PHP_SELF'])) {

new:

if (ereg(".inc.php", $_SERVER['PHP_SELF'])) {


That line of code is in just about every .inc.php file in cubecart. Ouch.

If that doesn't work, it may be that you host is running php as CGI or has some other virtual server setup that isn't set to provide the correct value for $_SERVER['PHP_SELF']. If this is the case, see 
old: 

function detectSSL(){

	if($_SERVER["HTTPS"] == "on"){



new:

function detectSSL(){

	if(!isset($_SERVER["HTTPS"])) return false;

	if($_SERVER["HTTPS"] == "on"){






Notice: Undefined index: rootRel in /var/www/html/store/admin/misc/info.php on line 2 Notice: Undefined index: rootRel in /var/www/html/store/admin/misc/info.php on line 2 Notice: Undefined variable: glob in /var/www/html/store/admin/misc/info.php on line 4 Notice: Undefined variable: glob in /var/www/html/store/admin/misc/info.php on line 7
This one was a bit of a mess... I replaced the contents of the file with:

At some point the admin authorization was moved to auth.inc.php and this file seems to have been left behind. This should probably be submitted as a bug if it hasn't been already. That said, it's only php_info() :angry:

Hope that helped some of your problems. :)

<?php

include("../../includes/global.inc.php");

require_once("../../classes/db.inc.php");

$db = new db();

include_once("../../includes/functions.inc.php");

$config = fetchDbConfig("config");

include("../includes/auth.inc.php");



if(isset($_SESSION['ccAdmin'])){

	echo phpinfo();

}

?>
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...