RE: Need Help With Redirecting
Faking a Referrer?Use the cpa redirector from wpblackhat.com
Code:
<?php
/*
Plugin Name: CPA Redirector
Plugin URI: http://www.contentgeneration.org/
Description: CPA Redirector
Author: Brad
Version: 1.2
Author URI: http://www.contentgeneration.org/
*/
function prc_plugin_install() {
delete_option('wp_redmeth');
delete_option('wp_magicnumber');
delete_option('wp_formmethod');
add_option('wp_redmeth', 0);
add_option('wp_formmethod', 0);
add_option('wp_magicnumber', 0);
}
if (isset ($_GET['activate']) and& $_GET['activate'] == 'true') {
add_action('init', 'prc_plugin_install');
}
function prc_red() {
if ( is_home() || is_category() || is_archive()) return false;
global $post;
if ($_GET['mn']==get_option('wp_magicnumber')){
echo '<html><head></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">
document.getElementById(\'form1\').submit();</script></body></html>';
return true;
exit();
}
global $post;
if (strlen(get_post_meta($post->ID, "theurl", true)) < 5) return false;
if ($_POST['mn']==get_option('wp_magicnumber')){
if(get_option('wp_redmeth')==0) {
if(get_option('wp_formmethod')==0)
$formmethod = "POST";
else
$formmethod = "GET";
echo '<html><head></head><body><form action="' . get_post_meta($post->ID, "theurl", true) . '" method="' . $formmethod . '" id="form1"></form>
<script language="JavaScript">
document.getElementById(\'form1\').submit();
</script></body></html>';
}
else if(get_option('wp_redmeth')==1)
echo '<HEAD>
<SCRIPT language="JavaScript">
<!--
window.location="' . get_post_meta($post->ID, "theurl", true) . '";
//-->
</SCRIPT>
</HEAD>';
else if(get_option('wp_redmeth')==2)
echo '<meta http-equiv="refresh" content=0;url=' . get_post_meta($post->ID, "theurl", true) . '>';
else
echo "";
}
else return false;
return true;
}
function cpa_red_editor() {
if (isset ($_POST['update'])) {
update_option('wp_redmeth', $_POST['redmeth']);
update_option('wp_magicnumber', $_POST['magicnumber']);
update_option('wp_formmethod', $_POST['formmethod']);
update_option('wp_redrate', $_POST['redrate']);
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>';
echo '<center><h2>CPA Redirector</h2></center>';
echo '<style type="text/css">';
echo '#thecenter { text-align:center; }';
echo '</style>';
echo '<table>';
echo '<form action="options-general.php?page=' . $_GET['page'] . '" method="post">';
echo '<input type="hidden" name="update" value="yes" />';
echo 'Redirection Method: ';
echo '<select name="redmeth">';
echo '<option value="0"' . ((get_option('wp_redmeth') == 0)?' selected':'') . ' />Java Script Form';
echo '<option value="1"' . ((get_option('wp_redmeth') == 1)?' selected':'') . ' />Java Script';
echo '<option value="2"' . ((get_option('wp_redmeth') == 2)?' selected':'') . ' />Meta Refresh';
echo '</select><br><br>';
echo 'Form Method: ';
echo '<select name="formmethod">';
echo '<option value="0"' . ((get_option('wp_formmethod') == 0)?' selected':'') . ' />POST';
echo '<option value="1"' . ((get_option('wp_formmethod') == 1)?' selected':'') . ' />GET';
echo '</select><br><br>';
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_title, ENT_COMPAT) . '">' . strtolower(htmlspecialchars($post_title)) . '</a>';
$i++;
$class = ('alternate' == $class) ? '' : 'alternate';
echo '<input type="hidden" name="id_' . $i .'" value="' . $post->ID . '"/>';
echo '<tr><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 prc_add_options_to_admin() {
add_options_page('CPA Redirector', 'CPA Redirector', 8, __FILE__, 'cpa_red_editor');
}
if (function_exists('add_action')) {
add_action('admin_menu', 'prc_add_options_to_admin');
}
?>
Quote:Now, you MUST edit the header file (header.php) of your blog’s theme (in the theme folder – /public_html/wp-content/themes) and add the following line of code to the first line of header.php:
<?php if (prc_red()) exit(); ?> It must be on the first line of header.php! If you don’t do this, the plugin will not work! Your header.php should look something like this: Now, set the blog permalinks to something like: /%postname%/ (don’t forget to add the .htaccess code). Finally, let’s learn how to use it – the user interface is below. Option 1: This is the redirection method. There are two options here: Java Script and Meta Refresh. You should always use the Java Script option as it’s the most reliable way to pass the referrer on. Option 2: Magic Number. This is any number, but choose 4 digits or more. Option 3: These are URLs of posts on your blog. You use these with magic number to redirect traffic. Option 4: These are your affiliate links. One affiliate link per page. IMPORTANT: include the ‘HTTP://’ prefix with affiliate links, otherwise they wont work properly! Let’s get going. Add some articles (use free articles from goarticles.com, ezinearticles.com, etc) to a blog you want to use for redirection. Put some relevant banners on the blog, so it’s optimized for the offer(s) you are promoting. Go to CPA redirector in WP Admin and add your affiliate links to the pages, including your magic number and save the settings. To redirect traffic to your CPA offer(s), simply use the post URL combined with the magic number you have chosen. So, with the above example, I’d use: http://myadultblog.com/adult-video-dating/?mn=32453245 The post URL is ‘http://myadultblog.com/adult-video-dating/’ and ‘?mn=’ is the way to pass your magic number to the blog. All traffic sent to http://myadultblog.com/adult-video-dating/?mn=32453245 will be automatically redirected to the proper CPA offer. The traffic will not see the blog. If a CPA network check the referrer URL they will see: http://myadultblog.com/adult-video-dating/ and if they visit that blog post, they will see it’s promoting their particular offer
Credit goes to Brad
Hope this one help.
|