You should try replacing the page with the default version that you can get from the downloads. This should fix any problem with missing code or anything like that.
As for the https code you are using this will only redirect if the cart is empty. If you would like to redirect the user to the https version of the page regardless you can add in a check like this:
<?php if((!(isset($_SERVER['HTTPS']))) || ($_SERVER['HTTPS'] == "") || ($_SERVER['HTTPS'] == "off"))header("Location: https://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']); ?>