Fix HTTPS detection logic in sample.php