Subversion Repositories php_library

Rev

Rev 58 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 58 Rev 60
Line 599... Line 599...
599
   $parameters can be blank but, if they are not, they are a URL encoded string
599
   $parameters can be blank but, if they are not, they are a URL encoded string
600
   $path defaults to current uri if it is not passed in
600
   $path defaults to current uri if it is not passed in
601
   $host defaults to current server name if not passed in
601
   $host defaults to current server name if not passed in
602
*/
602
*/
603
function redirectPage ( $page,$parameters=array(),$path='',$host='', $protocol='') {
603
function redirectPage ( $page,$parameters=array(),$path='',$host='', $protocol='') {
604
   $params = '';
604
   $params = array();
605
   if ( strlen($host) == 0 ) $host = $_SERVER['HTTP_HOST'];
605
   if ( strlen($host) == 0 ) $host = $_SERVER['HTTP_HOST'];
606
   if ( strlen($path) == 0 ) $path = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
606
   if ( strlen($path) == 0 ) $path = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
607
   if ( count($parameters) > 0 ) {
607
   if ( count($parameters) > 0 ) {
608
      foreach ($parameters as $var => $value ) {
608
      foreach ($parameters as $var => $value ) {
609
         $params[] = $var . '=' . rawurlencode($value);
609
         $params[] = $var . '=' . rawurlencode($value);
610
      }
610
      }
611
      $params = '?' . implode( '&', $params );
-
 
612
   }
611
   }
613
   if ( ! $protocol ) {
612
   if ( ! $protocol ) {
614
      $protocol = isset($_SERVER['HTTPS']) ? "https:" : "http:";
613
      $protocol = isset($_SERVER['HTTPS']) ? "https:" : "http:";
615
   }
614
   }
616
   $location = $protocol . '//' . $host . $path . '/' . $page . $params;
615
   $location = $protocol . '//' . $host . $path . '/' . $page . ( sizeof($params) ? ('?' . implode( '&', $params )) : '');
617
   header("Location: $location", true);
616
   header("Location: $location", true);
618
   exit;
617
   exit;
619
}
618
}
620
 
619
 
621
   function FileErrorMessage ( $errorCode ) {
620
   function FileErrorMessage ( $errorCode ) {