php - How to fix this "undefined index" if statement -
this question has answer here:
my code below
$base = if((!empty(($_server['https'] ? 'https' : 'http') . '://' . $_server['http_host'] . '/'));
i'm checking whether $_server['https']
not empty notice:
notice: undefined index: https in d:\xampp\htdocs\flower-shop\flowers.php on line 24
the following code should work. if notice, in php shorthand don't include if
word.
<?php $base = (isset($_server['https']) ? 'https' : 'http').'://'.$_server['http_host'].'/'; ?>
i not rely on $_server['http_host']
since can modified client , can cause huge issues.
Comments
Post a Comment