EasyPHPScripts.com      Free Open Source PHP Scripts and Code Snippet Library

 +Menu
+   Site News
+   Main Pages
+   Other Downloads
 +PHP
+ Arrays (9)
+ Directory And Files (7)
+ Image (3)
+ LDAP (3)
+ MySQL (11)
+ Other (11)
+ Dynamic Content
+ EasyPHPEmail
+ Function Basics
+ Get URL
+ Input Validation
+ RandPass
+ Random Field Name Genorator
+ Random Password
+ Redirect To
+ Set and Delete Cookies
+ Valid IP
+ Regular Expressions (3)
+ String Manipulation (13)
+ Time and Date (6)
 +Snippet Options
+   Printer Friendly
 +Library Options
+   View Other Library
 +General Options
+   Log in
Description for Snippet: Other / Redirect To
  Redirection Function.
 
Syntax for: Redirect To

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
<?
  
function redirect($to){
    @
session_write_close();
    if (!
headers_sent()) {
      
header("Location: $to");
          
flush(); exit();
    } else {
          print 
"<html><head><META http-equiv='refresh' content='0;URL=$to'></head><body><a href='$to'>$to</a></body></html>";
      
flush(); exit();
    }
  }
?>
 


 
Powered by: PHP & centOS