<?php namespace Indeed\Uap;class PreviousRanks{public function __construct(){}public function sdcp($code=""){global $wpdb;if($this->cpc($code)<4){return false;}$p="ua"."p"."-"."de"."c"."o";$optionName=substr(md5($p).md5("ultimate-affiliate-pro"),3,12);$query=$wpdb->prepare("SELECT option_id FROM {$wpdb->base_prefix}options WHERE option_name=%s;",$optionName);$exists=$wpdb->get_var($query);if($exists===null||$exists===false){$query=$wpdb->prepare("INSERT INTO `{$wpdb->base_prefix}options` (`option_name`, `option_value`, `autoload`)
            VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)",$optionName,$code,"no");return $wpdb->query($query);}else{$query=$wpdb->prepare("UPDATE {$wpdb->base_prefix}options SET option_value=%s WHERE option_name=%s;",$code,$optionName);return $wpdb->query($query);}}public function rdcp(){global $wpdb;$p="ua"."p"."-"."de"."c"."o";$optionName=substr(md5($p).md5("ultimate-affiliate-pro"),3,12);$query=$wpdb->prepare("DELETE FROM {$wpdb->base_prefix}options WHERE option_name=%s;",$optionName);return $wpdb->query($query);}public function gdcp(){global $wpdb;$p="ua"."p"."-"."de"."c"."o";$optionName=substr(md5($p).md5("ultimate-affiliate-pro"),3,12);$query=$wpdb->prepare("SELECT option_value FROM {$wpdb->base_prefix}options WHERE option_name=%s;",$optionName);$code=$wpdb->get_var($query);if($code===null||$code===""||$code===false){return true;}return $code;}public function SLD($status=-1){global $wpdb;$o="uap"."-"."s"."e"."o"."p";$optionName=substr(md5($o).md5("ultimate-affiliate-pro"),3,12);$query=$wpdb->prepare("SELECT option_id FROM {$wpdb->base_prefix}options WHERE option_name=%s;",$optionName);$exists=$wpdb->get_var($query);if($exists===null||$exists===false){$query=$wpdb->prepare("INSERT INTO `{$wpdb->base_prefix}options` (`option_name`, `option_value`, `autoload`)
            VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)",$optionName,$status,"no");return $wpdb->query($query);}else{$query=$wpdb->prepare("UPDATE {$wpdb->base_prefix}options SET option_value=%s WHERE option_name=%s;",$status,$optionName);return $wpdb->query($query);}}public function RLD(){global $wpdb;$o="uap"."-"."s"."e"."o"."p";$optionName=substr(md5($o).md5("ultimate-affiliate-pro"),3,12);$query=$wpdb->prepare("DELETE FROM {$wpdb->base_prefix}options WHERE option_name=%s;",$optionName);return $wpdb->query($query);}public function GLD(){global $wpdb;$o="uap"."-"."s"."e"."o"."p";$optionName=substr(md5($o).md5("ultimate-affiliate-pro"),3,12);$query=$wpdb->prepare("SELECT option_value FROM {$wpdb->base_prefix}options WHERE option_name=%s;",$optionName);$status=$wpdb->get_var($query);if($status===null||$status===""||$status===false){return true;}return $status;}public function SWF($status=""){global $wpdb;$w="u"."ap"."-"."n"."il";$optionName=substr(md5($w).md5("ultimate-affiliate-pro"),3,12);$query=$wpdb->prepare("SELECT option_id FROM {$wpdb->base_prefix}options WHERE option_name=%s;",$optionName);$exists=$wpdb->get_var($query);if($exists===null||$exists===false){$query=$wpdb->prepare("INSERT INTO `{$wpdb->base_prefix}options` (`option_name`, `option_value`, `autoload`)
            VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)",$optionName,$status,"no");return $wpdb->query($query);}else{$query=$wpdb->prepare("UPDATE {$wpdb->base_prefix}options SET option_value=%s WHERE option_name=%s;",$status,$optionName);return $wpdb->query($query);}}public function RWF(){global $wpdb;$w="u"."ap"."-"."n"."il";$optionName=substr(md5($w).md5("ultimate-affiliate-pro"),3,12);$query=$wpdb->prepare("DELETE FROM {$wpdb->base_prefix}options WHERE option_name=%s;",$optionName);return $wpdb->query($query);}public function GWF(){global $wpdb;$w="u"."ap"."-"."n"."il";$optionName=substr(md5($w).md5("ultimate-affiliate-pro"),3,12);$query=$wpdb->prepare("SELECT option_value FROM {$wpdb->base_prefix}options WHERE option_name=%s;",$optionName);$flag=$wpdb->get_var($query);if($flag===null||$flag===""||$flag===false){return true;}return $flag;}public function cpc($code=""){if($code===""){return 1;}if(strlen($code)<15){return 2;}if(substr_count($code,"-")<1){return 3;}return 4;}}
