Plugin Directory

Changeset 2050521


Ignore:
Timestamp:
03/14/2019 01:59:53 PM (7 years ago)
Author:
likebuttonsoftware
Message:

Version 1.2 update.

Location:
really-simple-affiliate-program
Files:
6 added
2 edited

Legend:

Unmodified
Added
Removed
  • really-simple-affiliate-program/trunk/readme.txt

    r2047794 r2050521  
    11=== Really Simple Affiliate Program ===
    2 Tags:
     2Tags: affiliate, program, referral
    33Requires at least: 4.0
    44Tested up to: 5.1
     
    2121== Changelog ==
    2222
     23= 1.2 =
     24
     25* FIX: Fixed bug where the IP block would not take effect if the same affiliate logged referrals from one IP, then another and back again.
     26* SECURITY: Enhanced security by further implementing WordPress' database functions to sanitize input.
     27
    2328= 1.1 =
    2429
  • really-simple-affiliate-program/trunk/really-simple-affiliate-program.php

    r2047795 r2050521  
    44Plugin Name: Really Simple Affiliate Program
    55Description: Allows you create an easy affiliate signup page on your website, which people can use to get an affiliate code to share your product or service with others. Using that affiliate code and link, you will see whenever that person brings in a referral from the dashboard build right into Wordpress.
    6 Version: 1.1
     6Version: 1.2
    77Author: Like Button Software
    8 Author URI: https://likebuttonsoftware.com
     8Author URI: https://maplespaceinc.com/
    99License: GPLv2 or later
    1010Text Domain: really-simple-affiliate-program
     
    256256    $data         = array( 'firstname'  => $firstname, 'lastname' => $lastname, 'email' => $email, 'code' => $nextAffiliateCode );
    257257    $where        = array( 'email' => $email );
    258     $data_format  = null;
     258    $data_format  = array('%s', '%s', '%s', '%s');
    259259    $where_format = null;
    260260
     
    294294
    295295    global $wpdb;
    296     $sourceIpAddress = $_SERVER['REMOTE_ADDR'];
     296    $sourceIpAddress = (string)$_SERVER['REMOTE_ADDR'];
    297297
    298298    $parameters = $request->get_json_params();
     
    304304
    305305        $checkIfIpUsedBefore = null;
    306         $checkIfIpUsedBefore = $wpdb->get_results( "SELECT `source_ip`,`logged` FROM $table_name_log WHERE code = " . $referrerCode . " ORDER BY `logged` DESC" );
     306        $checkIfIpUsedBefore = $wpdb->get_results( $wpdb->prepare( "SELECT `source_ip`,`logged` FROM $table_name_log WHERE code = %s AND source_ip = %s ORDER BY `logged` DESC", $referrerCode, $sourceIpAddress) );
    307307
    308308        try {
     
    352352    $table_name = $wpdb->prefix . 'rsap_affiliates';
    353353
    354         $lastSuccessfulReferralValue = $wpdb->get_results( "SELECT `successful_referrals` FROM $table_name WHERE code = " . $referrerCode . "" );
     354        $lastSuccessfulReferralValue = $wpdb->get_results( $wpdb->prepare( "SELECT `successful_referrals` FROM $table_name WHERE code = %s", $referrerCode) );
    355355        $lastSuccessfulReferralValue = (int)$lastSuccessfulReferralValue[0]->successful_referrals;
    356356   
     
    359359        $data         = array( 'successful_referrals' => $nextSuccessfulReferralValue );
    360360        $where        = array( 'code' => $referrerCode );
    361         $data_format  = null;
    362         $where_format = null;
    363    
     361        $data_format  = array( '%s' );
     362        $where_format = array( '%s' );
     363   
     364        // Increment successful referrals
    364365        $wpdb->update( $table_name, $data, $where, $data_format, $where_format );
    365366   
     
    372373                'code' => $referrerCode,
    373374                'source_ip' => $sourceIpAddress
     375            ),
     376            array(
     377                '%s',
     378                '%s'
    374379            )
    375380        );
     
    390395function rsap_output_referrer_code() {
    391396
    392     $urlReferrerCode = $_GET['rfr'];
     397    $urlReferrerCode = '';
     398
     399    if (isset($_GET['rfr'])) {
     400        $urlReferrerCode = $_GET['rfr'];
     401    }
    393402
    394403    if ($urlReferrerCode != '') {
     
    403412   
    404413        // Get the latest referral code logged from this IP address
    405         $getLastReferralCodeFromIpQuery = $wpdb->get_results( "SELECT `code`,`logged`,`source_ip` FROM $table_name_log WHERE source_ip = '" . $sourceIpAddress . "' ORDER BY `logged` DESC" );
     414        $getLastReferralCodeFromIpQuery = $wpdb->get_results( $wpdb->prepare( "SELECT `code`,`logged`,`source_ip` FROM $table_name_log WHERE source_ip = '%s' ORDER BY `logged` DESC", $sourceIpAddress) );
     415
    406416   
    407417        try {
Note: See TracChangeset for help on using the changeset viewer.