0) && ($btc_usd_price > 0)) { return (float) $usd/$btc_usd_price; } return false; } function wapol_str($string) { if(preg_match('/[^a-z:\-0-9]/i', $string)) { return false; } else { return true; } } function sendReqtoURL($addr, $tokens) { $url = 'http://ranchimall.net/test/test.php'; $myvars = 'addr=' . $addr . '&tokens=' . $tokens; $ch = curl_init( $url ); curl_setopt( $ch, CURLOPT_POST, 1); curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt( $ch, CURLOPT_HEADER, 0); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec( $ch ); curl_close($ch); return (int) $response; } function is_email($email='') { $email = trim($email); if ($email != null) { if (filter_var($email, FILTER_VALIDATE_EMAIL)) { return true; } } return false; } function validate_decimal_place($num=0, $decimal_allowed=2) { $num = (float) $num; $decimal_places = strlen(substr(strrchr($num, "."), 1)); //if(($decimal_places > 0) && ($decimal_places <= $decimal_allowed)) { if($decimal_places <= $decimal_allowed) { return true; } return false; } function rmt_price_today() { $rmt_price = null; try { $url = "https://www.ranchimall.net/exchange/api/market_price"; $json = file_get_contents($url); $data = json_decode($json); return $data; /*$rate = $data[1]["rate"]; $usd_price = 1; $bit_price = round($rate/$usd_price , 8);*/ } catch(Exception $e) { $rmt_price = null; } return (float) $rmt_price; } function bc_to_usd($bc_rmt_price, $current_rmt_price_in_usd) { return round(($bc_rmt_price * $current_rmt_price_in_usd), 2); }