1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

My problem with cpa redirector

Discussion in 'CPA' started by angelas111, Oct 10, 2011.

  1. angelas111

    angelas111 Jr. VIP Jr. VIP Premium Member

    Joined:
    Jan 4, 2009
    Messages:
    1,570
    Likes Received:
    1,016
    Location:
    ohio
    I have been using it faithfully for 3 years. It has never failed me once. One thing that aggravates me though is that when a user clicks your link and decides to hit the back button it doesn't let them back on the original page they came from. This can cause you to have an inflated number of clicks with the network and can piss people off too. I don't want unhappy visitors.


    Does anyone know of a workaround? Or can suggest an alternative?

    PHP:
    <?php
    /*
    Plugin Name: CPA Redirector 2
    Plugin URI: http://www.contentgeneration.org/
    Description: CPA Redirector 2
    Author: Brad
    Version: 2
    Author URI: http://www.contentgeneration.org/
    */ 

    //*******************************settings****************************
    $redirect_delay 3// set the number of seconds to delay the redirect here

    //*****************************settings end**************************



    function prc_plugin_install() {        

        
    delete_option('wp_magicnumber');

        
    add_option('wp_initbh'101);

        
    add_option('wp_magicnumber'0);

    }


    if (isset (
    $_GET['activate']) && $_GET['activate'] == 'true') {    

        if (
    get_option('wp_initbh')!=101)    
             
    add_action('init''prc_plugin_install');
    }



    function 
    cpa_red() {       

        if ( 
    is_home() || is_category() || is_archive()) return false;

        
    //if (strlen(get_post_meta($post->ID, "theurl", true)) < 5) return false;
        
        
    global $post;
        global 
    $redirect_delay;
        
        if (
    $_GET['mn']==get_option('wp_magicnumber')){        
        
    //echo $redirect_delay;
            
    echo '<html><head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"></head><body><form action="' get_permalink($post->ID) . '" method="post" id="form1">

    <input type="hidden"  name="mn" value="' 
    get_option('wp_magicnumber') . '" /></form>

    <script language="JavaScript"> 
        setTimeout(\'document.getElementById(\\\'form1\\\').submit()\', '
    .($redirect_delay 1000).');</script></body></html>';
            return 
    false
            
    //exit();
    }

        if (
    $_POST['mn']==get_option('wp_magicnumber')){

                echo 
    '<html><head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
    </head><body><form action="'
    get_permalink($post->ID) . '" method="post" id="form1">

    <input type="hidden"  name="mn" value="' 
    get_option('wp_magicnumber') . get_option('wp_magicnumber') . '" /></form>

    <script language="JavaScript"> 
        document.getElementById(\'form1\').submit();</script></body></html>'
    ;
            return 
    true
            exit();        
    }

        
    $dom preg_replace"/^www\./"""$_SERVER'HTTP_HOST' ] ) ;
        
    $ref$_SERVER['HTTP_REFERER'];

        if ( ((
    strpos($ref$dom)!=FALSE) || (trim($ref)=="" ) )  && ($_POST['mn']==(get_option('wp_magicnumber').get_option('wp_magicnumber')))){
            
    header'Location: ' get_post_meta($post->ID"theurl"true));
            exit();
        }

        return 
    false;



    function 
    cpa_red_editor() { 

        if (isset (
    $_POST['update'])) {        


            
    update_option('wp_magicnumber'$_POST['magicnumber']);    
            
            for(
    $i 1$i <= $_POST['post_count']; $i++) {
                
    $url 'url_' $i;
                
    $post_id "id_" $i;
            
                
    delete_post_meta($_POST[$post_id], 'theurl');
                
    add_post_meta($_POST[$post_id], 'theurl'$_POST[$url]);
                
            }

        }
        
        global 
    $wpdb
        
    $links='';
        
    $posts_columns = array(
            
    //'ID'      => __('ID'),
            
    'title'      => __('Post Title'),
            
    'post URL'      => __('Post URL'),
            
    'URL'     => __('Affiliate URL')
        );
        
    $posts_columns apply_filters('manage_posts_columns'$posts_columns);

        

        echo 
    '<div class="wrap">';
            echo 
    '<center><h2>CPA Redirector 2</h2></center>';
        echo 
    '<style type="text/css">';
        echo 
    '#thecenter { text-align:center; }';
        echo 
    '</style>';
        echo 
    '<table class="widefat">';

        echo 
    '<form action="options-general.php?page=' $_GET['page'] . '" method="post">';
        echo 
    '<input type="hidden" name="update" value="yes" />';


        echo 
    '<label for="magicnumber">Magic Number: <//label>';

        echo 
    '<input name="magicnumber" type="text"  id="keyword_count" value="' .  get_option('wp_magicnumber')  . '"  size="20" />';

        echo 
    '<br><br>';


        echo 
    '<thead><tr>';

        
        
        foreach(
    $posts_columns as $column_display_name) {
            echo 
    '<th scope="col">';
            echo 
    $column_display_name '</th>';        
        }
        echo 
    '</tr> </thead> <tbody id="the-list">';    
        
            
    $time_difference get_settings('gmt_offset'); 
            
    $now gmdate("Y-m-d H:i:s",time()); 
        
    $request "SELECT ID, post_title, post_excerpt FROM $wpdb->posts WHERE post_status = 'publish' "
            if(
    $hide_pass_post$request .= "AND post_password ='' "
            
    $request .= "AND post_date_gmt < '$now' ORDER BY post_date"
        
    $posts $wpdb->get_results($request); 
            
    $links[] = ''
            
    $i 0;
        
    $bgcolor '';

        if(
    $posts) { 
             foreach (
    $posts as $post) { 
                    
    $post_title stripslashes($post->post_title); 
                    
    $permalink get_permalink($post->ID); 
                    
    $links[$i] = '<a href="' $permalink '" rel="bookmark" title="Permanent Link: ' htmlspecialchars($post_titleENT_COMPAT) . '">' strtolower(htmlspecialchars($post_title)) . '</a>'
                    
    $i++;                        
                    
    $class = ('alternate' == $class) ? '' 'alternate';
                    echo 
    '<input type="hidden" name="id_' $i .'" value="' $post->ID '"/>';
                    echo 
    '<tr class="' $class  '"><th scope="row" style="text-align: left">' $post_title '</th>';
                    echo 
    '<input type="hidden" name="id_' $i .'" value="' $post->ID '"/>';
                    
    //echo '<th scope="row" style="text-align: left">' . $permalink . '</th>';
                    
    echo '<th scope="row" style="text-align: left"><input name="perma" type="text" id="perma" value="' $permalink '"  size="70" />';        
                    echo 
    '<th scope="row" style="text-align: left"><input name="url_' $i '" type="text" id="url_' $i '" value="' get_post_meta($post->ID"theurl"true) . '" size="40" /></th>';
                    echo 
    '</tr>';
                    
             } 
        
            echo 
    '</table>';
            echo 
    '<div style="clear:both;"></div>';
            echo 
    '<input type="hidden" name="post_count" value="' $i '"/>';
            echo 
    '<br>';
            echo 
    '<div id="thecenter">';
            echo 
    '<input type="submit" value="Save Settings" />';
            echo 
    '</form>';
            echo 
    '</div></div>';
         }
        


    function 
    wp_add_red($unused){ 

        echo 
    "<?php if (function_exists('cpa_red()()')) if (cpa_red()()) exit(); ?>"



    function 
    prc_add_options_to_admin() { 
       
    add_options_page('CPA Redirector 2''CPA Redirector 2'8__FILE__'cpa_red_editor'); 


    if (
    function_exists('add_action')) { 
       
    add_action('admin_menu''prc_add_options_to_admin'); 
       
    add_action(�wp_head��wp_add_red�);
       
    add_action('get_header','wp_cpa_red_head');



    function 
    wp_cpa_red_head(){
        
        if (
    cpa_red()) exit();



    ?>
     
    Last edited: Oct 10, 2011
  2. JohnnyRabbit

    JohnnyRabbit Supreme Member

    Joined:
    Sep 29, 2010
    Messages:
    1,228
    Likes Received:
    299
    This could be hard because of exit-popups some offers have on them.
     
  3. angelas111

    angelas111 Jr. VIP Jr. VIP Premium Member

    Joined:
    Jan 4, 2009
    Messages:
    1,570
    Likes Received:
    1,016
    Location:
    ohio
    exit popups make it worse. without them you can normally get back by hitting the back button repeatedly but with exit po's its impossible.
     
  4. J1218

    J1218 Power Member

    Joined:
    Jan 9, 2010
    Messages:
    675
    Likes Received:
    401
    I was about to start using CPA Redirector too so I'm wondering the same thing. It would suck if they can't get back to your main site.

    On another note, do you know where to get the latest version of CPA Redirector Angela? I found the older one but I heard it's been updated a few times since then.
     
  5. darkstar69

    darkstar69 Jr. VIP Jr. VIP

    Joined:
    Nov 15, 2008
    Messages:
    806
    Likes Received:
    880
    Occupation:
    Big Boss
    Location:
    On The Dark Side
     
    • Thanks Thanks x 1