Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function str_url($a, $b) {
- return substr($a, 0, strpos($a, $b));
- }
- function self_url() {
- if(!isset($_SERVER['REQUEST_URI'])) {
- $self = $_SERVER['PHP_SELF'];
- }else{
- $self = $_SERVER['REQUEST_URI'];
- }
- $secure = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s":"";
- $protocol_secure = str_url(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$secure;
- $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
- $_SESSION['previous'] = $protocol_secure."://".$_SERVER['SERVER_NAME'].$port.$self;
- header("Location: " . $_SESSION['previous']);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement