Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2014
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. function str_url($a, $b) {
  2. return substr($a, 0, strpos($a, $b));
  3. }
  4.  
  5. function self_url() {
  6. if(!isset($_SERVER['REQUEST_URI'])) {
  7. $self = $_SERVER['PHP_SELF'];
  8. }else{
  9. $self = $_SERVER['REQUEST_URI'];
  10. }
  11. $secure = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s":"";
  12. $protocol_secure = str_url(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$secure;
  13. $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
  14. $_SESSION['previous'] = $protocol_secure."://".$_SERVER['SERVER_NAME'].$port.$self;
  15.  
  16. header("Location: " . $_SESSION['previous']);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement