getIP(); $strCURLOPT .= '&Template_Desktop_Form=newsletterTemplate1'; $strCURLOPT .= '&Promotion_Code=WPAC'; $strCURLOPT .= '&Version=ac|1.0.1'; curl_setopt($ch, CURLOPT_URL, $strCURLOPT); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $content = curl_exec($ch); curl_close($ch); return $content; } public function getFormKeyAPI($cUs_email, $cUs_pass){ $cUs_email = preg_replace( '/\s+/', '%20', $cUs_email ); $ch = curl_init(); $strCURLOPT = 'https://api.contactus.com/api2.php'; $strCURLOPT .= '?API_Account=AC00000bb19ec0c1dd1fe715ef23afa9cf'; $strCURLOPT .= '&API_Key=00000bb19ec0c1dd1fe715ef23afa9cf'; $strCURLOPT .= '&API_Action=getFormKey'; $strCURLOPT .= '&Email=' . trim($cUs_email); $strCURLOPT .= '&Password=' . trim($cUs_pass); curl_setopt($ch, CURLOPT_URL, $strCURLOPT); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $content = curl_exec($ch); curl_close($ch); return $content; } public function getIP() { // Get some headers that may contain the IP address $SimpleIP = (isset($REMOTE_ADDR) ? $REMOTE_ADDR :getenv("REMOTE_ADDR")); $TrueIP = (isset($HTTP_CUSTOM_FORWARDED_FOR) ? $HTTP_CUSTOM_FORWARDED_FOR : getenv("HTTP_CUSTOM_FORWARDED_FOR")); if ($TrueIP == "") $TrueIP = (isset($HTTP_X_FORWARDED_FOR) ? $HTTP_X_FORWARDED_FOR : getenv("HTTP_X_FORWARDED_FOR")); if ($TrueIP == "") $TrueIP = (isset($HTTP_X_FORWARDED) ? $HTTP_X_FORWARDED : getenv("HTTP_X_FORWARDED")); if ($TrueIP == "") $TrueIP = (isset($HTTP_FORWARDED_FOR) ? $HTTP_FORWARDED_FOR : getenv("HTTP_FORWARDED_FOR")); if ($TrueIP == "") $TrueIP = (isset($HTTP_FORWARDED) ? $HTTP_FORWARDED : getenv("HTTP_FORWARDED")); $GetProxy = ($TrueIP == "" ? "0" : "1"); if ($GetProxy == "0") { $TrueIP = (isset($HTTP_VIA) ? $HTTP_VIA : getenv("HTTP_VIA")); if ($TrueIP == "") $TrueIP = (isset($HTTP_X_COMING_FROM) ? $HTTP_X_COMING_FROM : getenv("HTTP_X_COMING_FROM")); if ($TrueIP == "") $TrueIP = (isset($HTTP_COMING_FROM) ? $HTTP_COMING_FROM : getenv("HTTP_COMING_FROM")); if ($TrueIP != "") $GetProxy = "2"; }; if ($TrueIP == $SimpleIP) $GetProxy = "0"; // Return the true IP if found, else the proxy IP with a 'p' at the begining switch ($GetProxy) { case '0': // True IP without proxy $IP = $SimpleIP; break; case '1': $b = preg_match("%^([0-9]{1,3}\.){3,3}[0-9]{1,3}%", $TrueIP, $IP_array); if ($b && (count($IP_array) > 0)) { // True IP behind a proxy $IP = $IP_array[0]; } else { // Proxy IP $IP = $SimpleIP; }; break; case '2': // Proxy IP $IP = $SimpleIP; }; return $IP; } public function resetData(){ delete_option( 'cUsAC_settings' ); delete_option( 'cUsAC_FORM_settings' ); delete_option( 'cUsAC_settings_api_key' ); delete_option( 'cUsAC_settings_step1' ); delete_option( 'cUsAC_settings_form_key' ); delete_option( 'cUsAC_settings_inlinepages' ); delete_option( 'cUsAC_settings_tabpages' ); return true; } } ?>