|
@@ -15,7 +15,8 @@ catch (PDOException $e) {
|
|
|
$shortUrl = new ShortUrl($pdo);
|
|
|
try {
|
|
|
$code = $shortUrl->urlToShortCode($_POST["url"]);
|
|
|
- printf('<p><strong>Short URL:</strong> <a href="%s/%2$s">%2$s</a></p>',$_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'],
|
|
|
+ $http = isset($_SERVER['HTTPS'])?'https':'http';
|
|
|
+ printf('<p><strong>Short URL:</strong> <a href="%s/%2$s">%2$s</a></p>',$http.'://'.$_SERVER['HTTP_HOST'],
|
|
|
SHORTURL_PREFIX . $code);
|
|
|
exit;
|
|
|
}
|
|
@@ -24,4 +25,4 @@ catch (Exception $e) {
|
|
|
// header("Location: /error");
|
|
|
header("Location: index.php");
|
|
|
exit;
|
|
|
-}
|
|
|
+}
|