Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Mine
Monday, June 11th, 2007 at 3:44:53pm MDT 

  1. /**
  2. * Utility function redirect the browser location to another url
  3. *
  4. * Can optionally provide a message.
  5. * @param string The file system path
  6. * @param string A filter for the names
  7. */
  8. function mosRedirect( $url, $msg='' ) {
  9.  
  10.    global $mainframe;
  11.    
  12.    $flog = fopen("logfile2","a");
  13.         fwrite($flog, "$url ");
  14.  
  15.     // specific filters
  16.         $iFilter = new InputFilter();
  17.         $url = $iFilter->process( $url );
  18.         fwrite($flog, "$url ");
  19.         if (!empty($msg)) {
  20.                 $msg = $iFilter->process( $msg );
  21.         }
  22.         fwrite($flog, "$url ");
  23.  
  24.         if ($iFilter->badAttributeValue( array( 'href', $url ))) {
  25.                 $url = $GLOBALS['mosConfig_live_site'];
  26.         }
  27.         fwrite($flog, "$url ");
  28.  
  29.         if (trim( $msg )) {
  30.                 if (strpos( $url, '?' )) {
  31.                         $url .= '&mosmsg=' . urlencode( $msg );
  32.                 } else {
  33.                         $url .= '?mosmsg=' . urlencode( $msg );
  34.                 }
  35.         }
  36.         fwrite($flog, "$url ");
  37.  
  38.         if (headers_sent()) {
  39.                 echo "<script>document.location.href='$url';</script>\n";
  40.         } else {
  41.                 @ob_end_clean(); // clear output buffer
  42.                 header( 'HTTP/1.1 301 Moved Permanently' );
  43.                 header( "Location: ". $url );
  44.         }
  45.         exit();
  46. }

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.