Changeset 2050521
- Timestamp:
- 03/14/2019 01:59:53 PM (7 years ago)
- Location:
- really-simple-affiliate-program
- Files:
-
- 6 added
- 2 edited
-
tags/1.2 (added)
-
tags/1.2/affiliateCodeEmailTemplate.php (added)
-
tags/1.2/js (added)
-
tags/1.2/js/rsap_main.js (added)
-
tags/1.2/readme.txt (added)
-
tags/1.2/really-simple-affiliate-program.php (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/really-simple-affiliate-program.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
really-simple-affiliate-program/trunk/readme.txt
r2047794 r2050521 1 1 === Really Simple Affiliate Program === 2 Tags: 2 Tags: affiliate, program, referral 3 3 Requires at least: 4.0 4 4 Tested up to: 5.1 … … 21 21 == Changelog == 22 22 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 23 28 = 1.1 = 24 29 -
really-simple-affiliate-program/trunk/really-simple-affiliate-program.php
r2047795 r2050521 4 4 Plugin Name: Really Simple Affiliate Program 5 5 Description: 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. 16 Version: 1.2 7 7 Author: Like Button Software 8 Author URI: https:// likebuttonsoftware.com8 Author URI: https://maplespaceinc.com/ 9 9 License: GPLv2 or later 10 10 Text Domain: really-simple-affiliate-program … … 256 256 $data = array( 'firstname' => $firstname, 'lastname' => $lastname, 'email' => $email, 'code' => $nextAffiliateCode ); 257 257 $where = array( 'email' => $email ); 258 $data_format = null;258 $data_format = array('%s', '%s', '%s', '%s'); 259 259 $where_format = null; 260 260 … … 294 294 295 295 global $wpdb; 296 $sourceIpAddress = $_SERVER['REMOTE_ADDR'];296 $sourceIpAddress = (string)$_SERVER['REMOTE_ADDR']; 297 297 298 298 $parameters = $request->get_json_params(); … … 304 304 305 305 $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) ); 307 307 308 308 try { … … 352 352 $table_name = $wpdb->prefix . 'rsap_affiliates'; 353 353 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) ); 355 355 $lastSuccessfulReferralValue = (int)$lastSuccessfulReferralValue[0]->successful_referrals; 356 356 … … 359 359 $data = array( 'successful_referrals' => $nextSuccessfulReferralValue ); 360 360 $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 364 365 $wpdb->update( $table_name, $data, $where, $data_format, $where_format ); 365 366 … … 372 373 'code' => $referrerCode, 373 374 'source_ip' => $sourceIpAddress 375 ), 376 array( 377 '%s', 378 '%s' 374 379 ) 375 380 ); … … 390 395 function rsap_output_referrer_code() { 391 396 392 $urlReferrerCode = $_GET['rfr']; 397 $urlReferrerCode = ''; 398 399 if (isset($_GET['rfr'])) { 400 $urlReferrerCode = $_GET['rfr']; 401 } 393 402 394 403 if ($urlReferrerCode != '') { … … 403 412 404 413 // 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 406 416 407 417 try {
Note: See TracChangeset
for help on using the changeset viewer.