Редирект на PHP

January 17, 2008

<?
function parse_se($seoref)
{
   $out = array();
   $seo_info = parse_url($seoref);
   $se = @$seo_info[’host’];
   $query = @$seo_info[’query’];
   if(strstr($se, ‘google’) !== false)
   {
      $out[’se’] = ‘google’;
      parse_str($query, $out[’q']);
      $out[’q'] = urldecode(@$out[’q'][’q']);
   }
   if(strstr($se, ‘msn’) !== false)
   {
      $out[’se’] = ‘msn’;
      parse_str($query, $out[’q']);
      $out[’q'] = urldecode(@$out[’q'][’q']);
   }
   if(strstr($se, ‘yahoo’) !== false)
   {
      $out[’se’] = ‘yahoo’;
      parse_str($query, $out[’q']);
      $out[’q'] = urldecode(@$out[’q'][’p']);
   }
   return $out;
}
$ref = @$_SERVER[’HTTP_REFERER’];
//traff with referer
if($ref != ‘’)
{
   $se_out = parse_se($ref);
   switch ($se_out[’se’])
   {
      case ‘google’:
         $url = ‘for google’;
         break;
      case ‘yahoo’:
         $url = ‘for yahoo’;
         break;
      case’msn’:
         $url = ‘for msn’;
         break;
      default:
         $url = ‘for other se’;
         break;
   }
}
//no ref traff
else
{
   $url = ‘http://google.com’;//иди и ищи :)
}
header("Location: $url");
?>

Comments »

The URI to TrackBack this entry is: http://intrex.blogsome.com/2008/01/17/p58/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.