Commit | Line | Data |
---|---|---|
696f20d5 MS |
1 | <? |
2 | function redir($tmp_url, $tmp_force_js = false, $tmp_frame = "", $tmp_execute_js = true) { | |
3 | //If it`s redirect to a frame, only javascript can do this | |
4 | if ($tmp_frame != "") { | |
5 | echo "<script>window.open('" . $tmp_url . "', '" . $tmp_frame . "', '');</script>"; | |
6 | return ""; | |
7 | } | |
8 | ||
9 | //Encode gets | |
10 | $tmp = parse_url($tmp_url); | |
11 | ||
12 | if (array_key_exists("query", $tmp)) { | |
13 | $tmp2 = explode("&", $tmp["query"]); | |
14 | $query = ""; | |
15 | foreach($tmp2 as $v) { | |
16 | if ($query != "") { | |
17 | $query .= "&"; | |
18 | } | |
19 | ||
20 | $tmp3 = explode("=", $v); | |
21 | ||
22 | $query .= $tmp3[0] . "=" . rawurlencode($tmp3[1]); | |
23 | } | |
24 | $tmp_url = str_replace($tmp["query"], $query, $tmp_url); | |
25 | } | |
26 | ||
27 | //Finaly, redirect | |
28 | if ($tmp_force_js) { | |
29 | echo "<script>document.location = '" . $tmp_url . "';</script>"; | |
30 | } else { | |
31 | if (!(@header("location: " . $tmp_url))) { | |
32 | if ($tmp_execute_js) { | |
33 | echo "<script>document.location = '" . $tmp_url . "';</script>"; | |
34 | } | |
35 | } | |
36 | } | |
37 | } | |
38 | ?> |