Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Undefined Index Error?


PupStar

Recommended Posts

Hi Guys,

 

Got an error which I can seem to figure out.

 

Notice: Undefined index: HTTP_REFERER in C:\wamp\www\football\includes\functions\whos_online.php on line 112

 

of which line is:

 

  tep_db_query("insert into " . TABLE_WHOS_ONLINE . " (customer_id, full_name, session_id, ip_address, hostname, time_entry, time_last_click, last_page_url, http_referer, user_agent) values ('" . (int)$wo_customer_id . "', '" . tep_db_input($wo_full_name) . "', '" . tep_db_input($wo_session_id) . "', '" . tep_db_input($wo_ip_address) . "', '" . tep_db_input($wo_hostname) . "', '" . tep_db_input($current_time) . "', '" . tep_db_input($current_time) . "', '" . tep_db_input($wo_last_page_url) . "', '" . tep_db_input($_SERVER['HTTP_REFERER']) . "', '" . tep_db_input($user_agent) . "')");

 

I have added the index to the table in phpmyadmin but still the error remains but only until I refresh the page and then it goes away.

 

Any ideas guys?

 

Thanks

 

Mark

Link to comment
Share on other sites

The $_SERVER superglobal is not guaranteed to contain any particular elements, such as HTTP_REFERER. See http://us.php.net/manual/en/reserved.variables.server.php for details. It's quite possible that your server isn't supplying this element. If this element is definitely used elsewhere in your site, double check your spelling (REFERER, not the proper spelling REFERRER).

Link to comment
Share on other sites

There can be many cases where you are referring to elements that don't exist, the standard method is to test that it exists before referring to it.

 

ie:

 (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '')

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...