here. * Author: MaxBlogPress * Author URI: http://www.maxblogpress.com * * License: GNU General Public License * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * Copyright (C) 2007 www.maxblogpress.com * */ $mbpait_path = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', __FILE__); $mbpait_path = str_replace('\\','/',$mbpait_path); $mbpait_dir = substr($mban_path,0,strrpos($mbpait_path,'/')); $mbpait_siteurl = get_bloginfo('wpurl'); $mbpait_siteurl = (strpos($mbpait_siteurl,'http://') === false) ? get_bloginfo('siteurl') : $mbpait_siteurl; $mbpait_fullpath = $mbpait_siteurl.'/wp-content/plugins/'.$mbpait_dir.''; $mbpait_fullpath = $mbpait_fullpath.'affiliate-image-tracker/'; $mbpait_abspath = str_replace("\\","/",ABSPATH); define('MBP_AIT_ABSPATH', $mbpait_abspath); define('MBP_AIT_LIBPATH', $mbpait_fullpath); define('MBP_AIT_NAME', 'Affiliate Image Tracker'); define('MBP_AIT_VERSION', '3.0'); define('MBP_AIT_SITEURL', $mbpait_siteurl); global $table_prefix; $rdmimg_tbl = $table_prefix.'mbp_affiliate_image_tracker'; define('MBP_AFF_IMAGETRACKER_TBL', $rdmimg_tbl); // Hook for adding admin menus add_action('admin_menu', 'mbp_aff_image_menu'); add_filter('the_content', 'affimage_post'); add_action('activate_'.$mbpait_path, 'MBP_AffImg_active' ); function MBP_AffImg_active(){ $db_check = mysql_query('SHOW TABLES LIKE '.MBP_AFF_IMAGETRACKER_TBL.''); $exists = mysql_fetch_row($db_check); if ( !$exists ) { $sql = "CREATE TABLE ".MBP_AFF_IMAGETRACKER_TBL." ( `image_id` int(11) NOT NULL auto_increment, `img_name` varchar(200) collate latin1_general_ci NOT NULL, `image_url` varchar(100) collate latin1_general_ci NOT NULL, `link_url` varchar(255) collate latin1_general_ci NOT NULL, `image_title` varchar(255) collate latin1_general_ci NOT NULL, `target_window` int(1) NOT NULL, `aff_hits` int(8) NOT NULL, `flag` enum('0','1') collate latin1_general_ci NOT NULL default '1', PRIMARY KEY (`image_id`) )"; mysql_query($sql); } } // action function for above hook function mbp_aff_image_menu() { // Add a new submenu under Options: add_options_page('Affiliate Image Tracker', 'Affiliate Image Tracker', 8, 'affiliate-image-tracker', 'mbp_affimage_option_page'); } /** * Creates a directory to upload banners */ function __affImageMakeDir() { $mbpimg_upload_path = MBP_AIT_ABSPATH.'wp-content/affiliate-images'; if ( is_admin() && !is_dir($mbpimg_upload_path) ) { @mkdir($mbpimg_upload_path); } return $mbpimg_upload_path; } function mbp_affimage_option_page() { $mbp_alt_activate = get_option('mbp_alt_activate'); $reg_msg = ''; $mbp_alt_msg = ''; $form_1 = 'mbp_alt_reg_form_1'; $form_2 = 'mbp_alt_reg_form_2'; // Activate the plugin if email already on list if ( trim($_GET['mbp_onlist']) == 1 ) { $mbp_alt_activate = 2; update_option('mbp_alt_activate', $mbp_alt_activate); $reg_msg = 'Thank you for registering the plugin. It has been activated'; } // If registration form is successfully submitted if ( ((trim($_GET['submit']) != '' && trim($_GET['from']) != '') || trim($_GET['submit_again']) != '') && $mbp_alt_activate != 2 ) { update_option('mbp_alt_name', $_GET['name']); update_option('mbp_alt_email', $_GET['from']); $mbp_alt_activate = 1; update_option('mbp_alt_activate', $mbp_alt_activate); } if ( intval($mbp_alt_activate) == 0 ) { // First step of plugin registration global $userdata; mbp_altRegisterStep1($form_1,$userdata); } else if ( intval($mbp_alt_activate) == 1 ) { // Second step of plugin registration $name = get_option('mbp_alt_name'); $email = get_option('mbp_alt_email'); mbp_altRegisterStep2($form_2,$name,$email); } else if ( intval($mbp_alt_activate) == 2 ) { // Options page if ( trim($reg_msg) != '' ) { echo '

'.$reg_msg.'

'; } // Start Execute if( $_GET['action'] == 1 ){ $imgname = mysql_query("select image_url from ".MBP_AFF_IMAGETRACKER_TBL." where image_id='".$_GET['id']."'"); $delete_imgname = mysql_fetch_array($imgname); @unlink(MBP_AIT_ABSPATH.'wp-content/affiliate-images/'.$delete_imgname['image_url'].''); $db_sql = "delete from ".MBP_AFF_IMAGETRACKER_TBL." where image_id='".$_GET['id']."'"; mysql_query($db_sql); $msg = 'Image removed from system'; } if( $_GET['action'] == "pub" || $_GET['action'] == "unpub" ){ if( $_GET['action'] == "pub" ) $flag='0'; elseif( $_GET['action'] == "unpub" ) $flag='1'; $imgname = mysql_query("Update ".MBP_AFF_IMAGETRACKER_TBL." set flag='".$flag."' where image_id='".$_GET['id']."'"); } if($_POST['submit'] == "Submit"){ $grouprec = array(''.$_POST['img_option'].'',''.$_POST['width'].'',''.$_POST['height'].''); update_option('mbp_affimagetracker_advance_option', $grouprec); $advmsg = "Advance Image Option Updated"; } if($_POST['submit'] == "Remove"){ $pwdby = array(''.$_POST['pwdby'].''); update_option('mbp_affimagetracker_pwdby_option', $pwdby); } if($_POST['upload'] == "Upload"){ if(!$_POST['alt'] || !$_POST['link'] || !$_POST['title'] ) $msg = 'Empty Fields'; if($_POST['link'] && !preg_match('|^http(s)?://[a-z0-9-]+(\.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $_POST['link']) ) $msg = 'Not valid URL'; if( $_GET['action'] == 'add' ){ if($_FILES['url_local']['name'] == '' ) $msg = 'No image selected'; } if(!$msg){ if( $_GET['action'] == 'edit' ){ $sql = "update ".MBP_AFF_IMAGETRACKER_TBL." set img_name = '".$_POST['alt']."', link_url = '".$_POST['link']."', image_title = '".$_POST['title']."', target_window = '".$_POST['in_new_win']."' where image_id ='".$_GET['id']."'"; mysql_query($sql); echo ''; }else{ //Upload from local computer $mbp_valid_file = array("image/pjpeg", "image/png", "image/jpeg", "image/gif", "image/bmp"); $mbpimg_upload_path = __affImageMakeDir(); $upload_name = $_FILES['url_local']['name']; $upload_type = $_FILES['url_local']['type']; $upload_size = $_FILES['url_local']['size']; $upload_tmp_name = $_FILES['url_local']['tmp_name']; $file_ext_pos = strrpos($upload_name,'.'); $filename = substr($upload_name,0,$file_ext_pos); $extension = substr($upload_name,$file_ext_pos+1); $upload_name = $filename.'_'.date('YmdHis').'.'.$extension; $banner_path = $mbpimg_upload_path.'/'.$upload_name; $banner_url = MBP_AIT_SITEURL.'/wp-content/mbp-random-image/'.$upload_name; $url = $banner_url; if ( in_array($upload_type,$mbp_valid_file) ) { if ( move_uploaded_file($upload_tmp_name, $banner_path) ) { list($banner_width, $banner_height) = @getimagesize($banner_path); $sql = "insert into ".MBP_AFF_IMAGETRACKER_TBL."(img_name,image_url,link_url,image_title,target_window,flag ) values('".$_POST['alt']."','".$upload_name."','".$_POST['link']."','".$_POST['title']."','".$_POST['in_new_win']."','1')"; mysql_query($sql); $msg = "Image uploaded from local computer.\n"; chmod($banner_path, 0644); echo ''; } else { $upload_err = 1; $msg = "Image couldn't be uploaded from local computer."; } } else { $upload_err = 1; $msg = "Image couldn't be uploaded from local computer. Invalid file type."; } } } }//Eof Upload $img_data = get_option('mbp_affimagetracker_advance_option'); $pwdby = get_option('mbp_affimagetracker_pwdby_option'); if( $img_data[0] == 'orig' ) $orig = 'checked'; elseif( $img_data[0] == 'high' ) $high = 'checked'; elseif( $img_data[0] == 'wide' ) $wide = 'checked'; elseif( $img_data[0] == 'spec' ) $spec = 'checked'; if( $pwdby[0] == 'pwdby' ) $pwdby = 'checked'; $msg_ri_txt = "We request you to have the powered by link as this would be visible to your blog visitors and they would be benefited by this plugin as well.

If you want to remove the powered by link, we will appreciate a review post for this plugin in your blog. This will help lots of other people know about the plugin and get benefited by it. By the way, if for any reason you do not want to write a review post then its ok as well. No obligation. We will be much happy if you find out some other ways to spread the word for this plugin "; ?>


How to use it    Community

BACK >> Home Page

Image >>
Image Name: *
Image URL: *
Link: *     /> Open in new window
Note: If no Affiliate link provide your own http host link
Your http host link is : http://
Image title: *

0 ){ $i = 1; while( $affrecords = mysql_fetch_array($affimg_sql) ){ ?>
S.no
Image Link URL Image Title
Hits
Action
Publish"; }else{ echo "Unpublish"; } ?> | Edit | Delete
No Affiliate Image Yet

Advance Image Option:

Instructions:

Powered Option:

by MaxBlogPress

This plugin is the result of MaxBlogPress Revived project.

'; $search = "()"; ///echo stristr($post_content,$post_tag); if ( stristr($post_content,$post_tag) ) { if (preg_match_all($search, $post_content, $matches)) { if ( is_array( $matches )) { foreach ( $matches as $key => $val ) { $randomImage = __MBPR_Affiliate_Image_Tag(); $post_content = preg_replace($search, $randomImage, $post_content, 1); } } } } return $post_content; } /********** MAIN SYSTEM HANDLER **********/ function __MBPR_Affiliate_Image_Tag(){ $db_sql = "select * from ".MBP_AFF_IMAGETRACKER_TBL." where flag='1'"; $process_result = mysql_query($db_sql); $noofrows = mysql_num_rows($process_result); if( $noofrows > 0 ){ $bannerPath = MBP_AIT_ABSPATH.'wp-content/affiliate-images/'; $bannerUrl = MBP_AIT_SITEURL.'/wp-content/affiliate-images'; $get_randomImagearray = get_option('mbp_affimagetracker_advance_option'); $pwdbyoption = get_option('mbp_affimagetracker_pwdby_option'); $scaleOption = $get_randomImagearray[0]; $scaleHeight = $get_randomImagearray[2]; $scaleWidth = $get_randomImagearray[1]; $pwdby = $pwdbyoption[0]; $image_types = array('jpg','png','gif'); // Array of valid image types while( $randomImg = mysql_fetch_array($process_result) ){ $image_array[] = $randomImg['image_id']; sort($image_array); reset ($image_array); } $ramdomimgID=$image_array[rand(1,count($image_array))-1]; $sql = "select * from ".MBP_AFF_IMAGETRACKER_TBL." where image_id=".$ramdomimgID." and flag='1'"; $affvalue = mysql_query($sql); $affdata = mysql_fetch_array($affvalue); $image_filename = $affdata['image_url']; $target = $affdata['target_window']; if($target == 1){ $openin = '_blank'; } $filename=$bannerUrl.'/'.$image_filename; $imageInfo = getimagesize($bannerPath.'/'.$image_filename); $physHeight = $imageInfo[1]; $physWidth = $imageInfo[0]; switch($scaleOption) { case 'high': $ratio = $physHeight / $scaleHeight; $physWidth = $physWidth / $ratio; $physHeight = $scaleHeight; break; case 'wide': $ratio = $physWidth / $scaleWidth; $physHeight = $physHeight / $ratio; $physWidth = $scaleWidth; break; case 'spec': $physHeight = $scaleHeight; $physWidth = $scaleWidth; break; default: break; } if( $pwdby == '' ){ $pwdby = '
Powered by Affiliate Image Tracker
'; }else{ $pwdby = ''; } return ''.$affdata['img_name'].''.$pwdby; } } /*************** WIDGET ****************/ if( $wp_version < 2.8 ) { add_action('plugins_loaded', 'MBP_affimage_widget'); } function MBP_affimage_widget(){ if ( !function_exists('register_sidebar_widget') || !function_exists('register_widget_control') ) { return; } function AffiliateImageWidgetController() { if ( isset($_POST["aff_image_submit"]) == 1 ) { $randomimg_sidebar_title = $_POST['aff_random_image']; update_option('mbp_affiliate_image_widget_title', $randomimg_sidebar_title); } $random_imgtitle = get_option('mbp_affiliate_image_widget_title'); ?>
Title:
".$title.""; echo $randomImg = __MBPR_Affiliate_Image_Tag(); echo $after_widget; } if ( function_exists('wp_register_sidebar_widget') ) { // fix for wordpress 2.2 wp_register_sidebar_widget(sanitize_title('Affiliate Image Tracker'), 'Affiliate Image Tracker', 'AffiliateImageWidgetSidebar'); } else { register_sidebar_widget('Affiliate Image Tracker', 'AffiliateImageWidgetSidebar'); } register_widget_control('Affiliate Image Tracker', 'AffiliateImageWidgetController', '', '210px'); } /* WP greater then 2.8 */ if( $wp_version >= 2.8 ) { add_action('widgets_init', create_function('', 'return register_widget("mbp_alt_widget");')); class mbp_alt_widget extends WP_Widget { function mbp_alt_widget() { parent::WP_Widget(false, $name = 'Affiliate Image Tracker'); } function widget($args, $instance) { global $wp_version; extract( $args ); echo $before_widget . $before_title . $instance['title'] . $after_title . __MBPR_Affiliate_Image_Tag() . $after_widget; } function update($new_instance, $old_instance) { return $new_instance; } function form($instance) { $title = esc_attr($instance['title']); ?>

onsubmit="return mbp_altValidateForm_0()">
Name:
Email:
 

'.$msg.'

'; } ?>

Almost Done....

Step 1:

A confirmation email has been sent to your email "". You must click on the link inside the email to activate the plugin.
The confirmation email will look like:
 

Step 2:

Click on the button below to Verify and Activate the plugin.

Troubleshooting

The confirmation email is not there in my inbox!
Dont panic! CHECK THE JUNK, spam or bulk folder of your email.
 
It's not there in the junk folder either.
Sometimes the confirmation email takes time to arrive. Please be patient. WAIT FOR 6 HOURS AT MOST. The confirmation email should be there by then.
 
6 hours and yet no sign of a confirmation email!
Please register again from below:
Help! Still no confirmation email and I have already registered twice
Okay, please register again from the form above using a DIFFERENT EMAIL ADDRESS this time.
 
Why am I receiving an error similar to the one shown below?

You get that kind of error when you click on "Verify and Activate" button or try to register again.

This error means that you have already subscribed but have not yet clicked on the link inside confirmation email. In order to avoid any spam complain we don't send repeated confirmation emails. If you have not recieved the confirmation email then you need to wait for 12 hours at least before requesting another confirmation email.
 
But I've still got problems.
Stay calm. Contact us about it and we will get to you ASAP.

by MaxBlogPress

first_name.' '.$userdata->last_name); $email = trim($userdata->user_email); ?>

Please register the plugin to activate it. (Registration is free)

In addition you'll receive complimentary subscription to MaxBlogPress Newsletter which will give you many tips and tricks to attract lots of visitors to your blog.
Fill the form below to register the plugin:
[ Your contact information will be handled with the strictest confidence
and will never be sold or shared with third parties ]

by MaxBlogPress