panique / huge

Simple user-authentication solution, embedded into a small framework.
2.14k stars 789 forks source link

Redirect problem with https if force close #865

Closed ikwijaya closed 5 years ago

ikwijaya commented 7 years ago

Sir,

Wow, thanks for great framework. I used that with https, but if i force close my webpage, the redirect always use http:// protocol so i change code a bit. Path : application/core/redirect. here my code.

before : public static function toPreviousViewedPageAfterLogin($path) { header('location: http://' . $_SERVER['HTTP_HOST'] . '/' . $path); }

here my edit : public static function toPreviousViewedPageAfterLogin($path) { if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') { $protocol = "https"; } else { $protocol = "http"; } header('location: '. $protocol . '://' . $_SERVER['HTTP_HOST'] . '/' . $path); }

what about that?

regards ikwijaya

ikwijaya commented 5 years ago

thank for merge.

elbenjaz commented 5 years ago

Wow, This feature is not in master branch. I solved it with a similar fix (After reading this post, it is practically a clone):

public static function toPreviousViewedPageAfterLogin($path) { $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? "https://" : "http://"; header('location: '.$protocol . $_SERVER['HTTP_HOST'] . '/' .$path); }

Thanks