2

I installed jobberbase and everything went smoothly but I keep getting the error

Undefined index: HTTPS in /XXXXXX/page_job.php on line 71 at the top of job post.

The code at line 71 are as follows;

        $current_url = (($_SERVER["HTTPS"] == "on") ? "https" : "http").'://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];

I just started learning php, so any help will be highly appreciated.

Jaime Caffarel
  • 2,401
  • 4
  • 30
  • 42
Abiel
  • 23
  • 3
  • Possible duplicate of [PHP: "Notice: Undefined variable" and "Notice: Undefined index"](http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index) – cteski Dec 11 '16 at 08:16

1 Answers1

1

You're getting this error, because you don't have HTTPS support, thus the PHP does not have such variable inside the $_SERVER system array.

To get rid of that error, just check if the $_SERVER actually has an HTTPS key/index item by using isset($_SERVER["HTTPS"]). Change that line to be like this and check for the existence of the HTTPS key:

$current_url = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? "https" : "http").'://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
Christos Lytras
  • 36,310
  • 4
  • 80
  • 113