/ Published in: PHP
Parses the given path and creates a http redirect to that page.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// func: redirect($to,$code=307) // spec: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html function redirect($to,$code=301) {//{{{ $location = null; $sn = $_SERVER['SCRIPT_NAME']; else { $schema = $_SERVER['SERVER_PORT']=='443'?'https':'http'; { $location = "$schema://$host"; $location.= $np; } } if ($hs==false) { } elseif (($hs==true) || ($code==302) || ($code==303)) { // todo: draw some javascript to redirect $cover_div_style = 'background-color: #ccc; height: 100%; left: 0px; position: absolute; top: 0px; width: 100%;'; echo "<div style='$cover_div_style'>\n"; $link_div_style = 'background-color: #fff; border: 2px solid #f00; left: 0px; margin: 5px; padding: 3px; '; $link_div_style.= 'position: absolute; text-align: center; top: 0px; width: 95%; z-index: 99;'; echo "<div style='$link_div_style'>\n"; echo "</div>\n</div>\n"; } }//}}}