$proto = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
$host = $_SERVER['HTTP_HOST'];
$file = dirname($_SERVER['PHP_SELF']) . '/img/' . $img . '.gif';
$url = $proto . $host . $file;
$proto = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
$host = $_SERVER['HTTP_HOST'];
$file = dirname($_SERVER['PHP_SELF']) . '/img/' . $img . '.gif';
$url = $proto . $host . $file;