Advertisement
Incubus

Untitled

Sep 27th, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.84 KB | None | 0 0
  1. <? $this->pageTitle = "Redirecting.."; ?>
  2. <?
  3. //preg_match_all("/&(.*=.*)/i", $url, $matches);
  4. preg_match('/^(.+?)(\?.*?)?(#.*)?$/', $url, $matches);
  5. preg_match('/utm_source=(.*[^&])&utm_medium/', $matches[2], $utm_source);
  6. preg_match('/utm_medium=(.*[^&])&utm_campaign/', $matches[2], $utm_medium);
  7. preg_match('/utm_campaign=(.*[^&])/', $matches[2], $utm_campaign);
  8.  
  9. $forms = array();
  10.  
  11. if(isset($utm_source) and isset($utm_medium) and isset($utm_campaign)){
  12.     $forms = array(
  13.         'utm_source'=>$utm_source[1],
  14.         'utm_medium'=>$utm_medium[1],
  15.         'utm_campaign'=>$utm_campaign[1]
  16.     );
  17. }
  18. ?>
  19. <form action="<?=$url; ?>" method="get" id="myform">
  20.     <?
  21.     foreach($forms as $i=>$form){
  22.         echo '<input type="hidden" name="'.$i.'" value="'.$form.'">';
  23.     }
  24.     ?>
  25. </form>
  26. <script language="JavaScript">document.getElementById('myform').submit();</script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement