[NEED] Help installing this script.... :(

Discussion in 'PHP' started by domainloco.net, Apr 21, 2008.

  1. #1
    Hi, I have this
    
    &cl<?php
      if($applic_id=='')
      { $COOK_VIS_ID     = $_COOKIE['COOK_VIS_ID'];
        $COOK_VST_ID     = $_COOKIE['COOK_VST_ID'];
        $COOK_LINK_ID    = $_COOKIE['COOK_LINK_ID'];
        $COOK_SPEC_CLICK = $_COOKIE['COOK_SPEC_CLICK'];
        $COOK_CL_APN     = $_COOKIE['COOK_CL_APN'];
      }
    
      $applic_id=2518;
      $subid='';
      $path='http://sites.credit-land.com/239504/';
      $file_name=$path.'content.php';
      $cont=$_GET['cont'];
      if($cont!='') 
        $file_name.='?cont='.$cont.
          '&applic_id='.$applic_id.
          '&COOK_VIS_ID='.$COOK_VIS_ID.
          '&COOK_VST_ID='.$COOK_VST_ID.
          '&COOK_LINK_ID='.$COOK_LINK_ID.
          '&COOK_SPEC_CLICK='.$COOK_SPEC_CLICK.
          '&COOK_CL_APN='.$COOK_CL_APN.
          '&cl='.$subid;
      else 
        $file_name.='?applic_id='.
          $applic_id.'&COOK_VIS_ID='.$COOK_VIS_ID.
          '&COOK_VST_ID='.$COOK_VST_ID.
          '&COOK_LINK_ID='.$COOK_LINK_ID.
          '&COOK_SPEC_CLICK='.$COOK_SPEC_CLICK.
          '&COOK_CL_APN='.$COOK_CL_APN.
          '='.$subid;
    
    function _get_headers($url,$format=0, $user='', $pass='', $referer='') {
        if (!empty($user)) {
    	$authentification = base64_encode($user.':'.$pass);
    	$authline = "Authorization: Basic $authentification\r\n";
        }
    
        if (!empty($referer)) {
    	$refererline = "Referer: $referer\r\n";
        }
    
        $url_info=parse_url($url);
        $port = isset($url_info['port']) ? $url_info['port'] : 80;
        $fp   = fsockopen($url_info['host'], $port, $errno, $errstr, 30);
        if($fp) {
    	$head = "GET ".@$url_info['path']."?".@$url_info['query']." HTTP/1.0\r\n";
    	if (!empty($url_info['port'])) {
    	    $head .= "Host: ".@$url_info['host'].":".$url_info['port']."\r\n";
    	} else {
    	    $head .= "Host: ".@$url_info['host']."\r\n";
    	}
    	$head .= "Connection: Close\r\n";
    	$head .= "Accept: */*\r\n";
    	$head .= $refererline;
    	$head .= $authline;
    	$head .= "\r\n";
    
    	fputs($fp, $head);      
    	while(!feof($fp) or ($eoheader==true)) {
    	    if($header=fgets($fp, 1024)) {
    		if ($header == "\r\n") {
    		    $eoheader = true;
    		    break;
    		} else {
    		    $header = trim($header);
    		}
    
    		if($format == 1) {
                        $key = array_shift(explode(':',$header));
    		    if($key == $header) {
    			$headers[] = $header;
    		    } else {
    			$headers[$key]=substr($header,strlen($key)+2);
    		    }
                        unset($key);
    		} else {
    		    $headers[] = $header;
    		}
    	    }
    	}
    
    	$GLOBALS['http_response_header'] = $headers;
    	return $headers;
    
        } else {
    	return false;
        }
      }
    
    function getPage($url)
    {
        $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
        
        $ch = curl_init();    // initialize curl handle
        curl_setopt($ch, CURLOPT_URL, $url); // set url to post to
        curl_setopt($ch, CURLOPT_FAILONERROR, 1);              // Fail on errors
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);    // allow redirects
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
        curl_setopt($ch, CURLOPT_PORT, 80);            //Set the port number
        curl_setopt($ch, CURLOPT_TIMEOUT, 15); // times out after 15s  
        curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);  
          
        $document = curl_exec($ch);
        
        return $document;
    }
    
    if( ini_get( 'allow_url_fopen' ) ){
        $str=@file_get_contents($file_name);
     }
     else
         if( function_exists( 'curl_init' ) ){	
    	 putenv('http_proxy=');
    	 $str = getPage( $file_name );
    	 $headers = _get_headers( $path );
        }
        else
    	if( !ini_get( 'allow_url_fopen' ) && !function_exists( 'curl_init' ) ){
    	    echo '<p style="font-family:arial;padding-top:10px; text-align:center;">Your server isn\'t able to work with remote files.</p>';
    	    return null;
    	}
    
      if(count($GLOBALS['http_response_header']))
      { foreach ($GLOBALS['http_response_header'] as $cook)
        { 
    	if( !isset( $COOK_VIS_ID ) ){
    		if(strpos($cook, 'COOK_VIS_ID=')>0)     $COOK_VIS_ID     = substr($cook, strpos($cook, 'COOK_VIS_ID=')+12,     strpos($cook, ';') - strpos($cook, 'COOK_VIS_ID=') - 12);
    	}
          if(strpos($cook, 'COOK_VST_ID=')>0)     $COOK_VST_ID     = substr($cook, strpos($cook, 'COOK_VST_ID=')+12,     strpos($cook, ';') - strpos($cook, 'COOK_VST_ID=') - 12);
          if(strpos($cook, 'COOK_LINK_ID=')>0)    $COOK_LINK_ID    = substr($cook, strpos($cook, 'COOK_LINK_ID=')+13,    strpos($cook, ';') - strpos($cook, 'COOK_LINK_ID=') - 13);
          if(strpos($cook, 'COOK_SPEC_CLICK=')>0) $COOK_SPEC_CLICK = substr($cook, strpos($cook, 'COOK_SPEC_CLICK=')+16, strpos($cook, ';') - strpos($cook, 'COOK_SPEC_CLICK=') - 16);
          if(strpos($cook, 'COOK_CL_APN=')>0)     $COOK_CL_APN     = substr($cook, strpos($cook, 'COOK_CL_APN=')+12,     strpos($cook, ';') - strpos($cook, 'COOK_CL_APN=') - 12);
        }
     }
        if ($str)
          {
    	$str = preg_replace (array("/apply.php\?page_no=([0-9]+)&prd_id=([0-9]+)/",
    			      "/apply.php\?page_no=([0-9]+)&bnr_id=([0-9]+)/", 
    			      "/[\.\/]*index.php/",
    			      "/[\.\/]*details\/details_page_([0-9]+)_([0-9]+)_([0-9]+).php\?page_no=([0-9]+)&prd_id=([0-9]+)/",
    			      "/[\.\/]*([a-z_0-9]+)\/([a-z_0-9]+)_page_([0-9]+)_([0-9]+).php/", 
    			      "/[\.\/]*images\/logo.gif/", 
    			      "/[\.\/]*images\/([a-zA-Z_0-9\/_-]+)\.gif/",
    			      "/[\.\/]*images\/([a-zA-Z_0-9\/_-]+)\.jpg/",
    			      "/[\.\/]*images\/([a-zA-Z_0-9\/_-]+)\.pic/", 
    			      "/[\.\/]*default.css/",
    			      "/[\.\/]*images\/common.js/",
    			      "/prd_([0-9]+)_([0-9]+).pic/", 
    			      "/[ ]{2,}/"),
    			
    			array ($path."apply.php?page_no=\\1&prd_id=\\2&applic_id=$applic_id".
    			       ($COOK_VIS_ID != '' ? '&COOK_VIS_ID='.$COOK_VIS_ID : '').
    			       ($COOK_VST_ID != '' ? '&COOK_VST_ID='.$COOK_VST_ID : '').
    			       ($COOK_LINK_ID != '' ? '&COOK_LINK_ID='.$COOK_LINK_ID : '').
    			       ($COOK_SPEC_CLICK != '' ? '&COOK_SPEC_CLICK='.$COOK_SPEC_CLICK : '').
    			       ($COOK_CL_APN != '' ? '&COOK_CL_APN='.$COOK_CL_APN : '').
    			       '&cl='.$subid, 
    
    			       $path."apply.php?page_no=\\1&bnr_id=\\2&applic_id=$applic_id".
    			       ($COOK_VIS_ID != '' ? '&COOK_VIS_ID='.$COOK_VIS_ID : '').
    			       ($COOK_VST_ID != '' ? '&COOK_VST_ID='.$COOK_VST_ID : '').
    			       ($COOK_LINK_ID != '' ? '&COOK_LINK_ID='.$COOK_LINK_ID : '').
    			       ($COOK_SPEC_CLICK != '' ? '&COOK_SPEC_CLICK='.$COOK_SPEC_CLICK : '').
    			       ($COOK_CL_APN != '' ? '&COOK_CL_APN='.$COOK_CL_APN : '').
    			       '&cl='.$subid, 
    			       
    			       "?cont=index.php&applic_id=$applic_id".
    			       ($COOK_VIS_ID != '' ? '&COOK_VIS_ID='.$COOK_VIS_ID : '').
    			       ($COOK_VST_ID != '' ? '&COOK_VST_ID='.$COOK_VST_ID : '').
    			       ($COOK_LINK_ID != '' ? '&COOK_LINK_ID='.$COOK_LINK_ID : '').
    			       ($COOK_SPEC_CLICK != '' ? '&COOK_SPEC_CLICK='.$COOK_SPEC_CLICK : '').
    			       ($COOK_CL_APN != '' ? '&COOK_CL_APN='.$COOK_CL_APN : '').
    			       '&cl='.$subid, 
    
    			       "?cont=details/details_page_\\1_\\2_\\3.php&page_no=\\4&prd_id=\\5&applic_id=$applic_id".
    			       ($COOK_VIS_ID != '' ? '&COOK_VIS_ID='.$COOK_VIS_ID : '').
    			       ($COOK_VST_ID != '' ? '&COOK_VST_ID='.$COOK_VST_ID : '').
    			       ($COOK_LINK_ID != '' ? '&COOK_LINK_ID='.$COOK_LINK_ID : '').
    			       ($COOK_SPEC_CLICK != '' ? '&COOK_SPEC_CLICK='.$COOK_SPEC_CLICK : '').
    			       ($COOK_CL_APN != '' ? '&COOK_CL_APN='.$COOK_CL_APN : '').
    			       '&cl='.$subid,
    			       
    			       "?cont=\\1/\\2_page_\\3_\\4.php&applic_id=$applic_id".
    			       ($COOK_VIS_ID != '' ? '&COOK_VIS_ID='.$COOK_VIS_ID : '').
    			       ($COOK_VST_ID != '' ? '&COOK_VST_ID='.$COOK_VST_ID : '').
    			       ($COOK_LINK_ID != '' ? '&COOK_LINK_ID='.$COOK_LINK_ID : '').
    			       ($COOK_SPEC_CLICK != '' ? '&COOK_SPEC_CLICK='.$COOK_SPEC_CLICK : '').
    			       ($COOK_CL_APN != '' ? '&COOK_CL_APN='.$COOK_CL_APN : '').
    			       '&cl='.$subid,
    
    			       "http://partners.credit-land.com/upload/$applic_id/logo.gif", 
    			       $path."images/\\1.gif", 
    			       $path."images/\\1.jpg", 
    			       $path."images/\\1.pic", 
    			       $path."default.css", 
    			       $path."images/common.js", 
    			       '<img src="'.$path.'images/\\0">', 
    			       ' '), 
    			$str);
    	echo $str;
    
    
      }
        else echo 'Failed to open stream';
    ?>
    <script type="text/javascript" language="JavaScript">
      function FixCookieDate (date)
      { var base = new Date(0);
        var skew = base.getTime(); // dawn of (Unix) time - should be 0
        if (skew > 0)  // Except on the Mac - ahead of its time
          date.setTime (date.getTime() - skew);
      }
      function SetCookie (name,value,expires,path,domain,secure)
      {   document.cookie = name + "=" + escape (value) +
          ((expires) ? "; expires=" + expires.toGMTString() : "") +
          ((path) ? "; path=" + path : "") +
          ((domain) ? "; domain=" + domain : "") +
          ((secure) ? "; secure" : "");
      }
      var expdate = new Date ();
      FixCookieDate (expdate);
      expdate.setTime (expdate.getTime() + (1000 * 60 * 60 * 24 * 30));
    
      SetCookie('COOK_VIS_ID',     '<?=$COOK_VIS_ID?>',     expdate, '/');
      SetCookie('COOK_VST_ID',     '<?=$COOK_VST_ID?>',     expdate, '/');
      SetCookie('COOK_LINK_ID',    '<?=$COOK_LINK_ID?>',    expdate, '/');
      SetCookie('COOK_SPEC_CLICK', '<?=$COOK_SPEC_CLICK?>', expdate, '/');
      SetCookie('COOK_CL_APN',     '<?=$COOK_CL_APN?>',     expdate, '/');
    </script>
    
    PHP:
    How do I install in on my server? Do I need any html to go along with it? I'm so confused... :(

    Thanks for any help
    Dan
     
    domainloco.net, Apr 21, 2008 IP
  2. itcn

    itcn Well-Known Member

    Messages:
    795
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    118
    #2
    Put this code in a text file using Notepad, call it mypage.php, and save it to your server. Then read any errors that may occur and adjust accordingly.
     
    itcn, Apr 21, 2008 IP
    domainloco.net likes this.
  3. machinegun87

    machinegun87 Peon

    Messages:
    580
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I will go with itcn suggestion too :)

    If that don't work then I will find someone to fix it.
     
    machinegun87, Apr 21, 2008 IP
    domainloco.net likes this.
  4. domainloco.net

    domainloco.net Notable Member

    Messages:
    3,085
    Likes Received:
    59
    Best Answers:
    1
    Trophy Points:
    225
    #4
    it worked by putting it under index.php
    awesome guys, thanks

    REP +++
     
    domainloco.net, Apr 21, 2008 IP
  5. itcn

    itcn Well-Known Member

    Messages:
    795
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    118
    #5
    Thanks for the rep!
     
    itcn, Apr 21, 2008 IP