<?php
date_default_timezone_set('America/New York');
include("common.php");
include("classMySQL.php");
$db = new db_mysql($server_name, $userdb, $passdb, $databasename,"");
include("function.php");
require_once('class.phpmailer.php');
include("class.smtp.php");
mysql_connect($server_name, $userdb, $passdb) or die ("Could not connect to database");
mysql_select_db($databasename);


if(get_rate_binance("ETHBTC")){$ethbtc_getrate=get_rate_binance("ETHBTC");}else{$ethbtc_getrate=$ethbtc_rate;}
if(get_rate_binance("BNBBTC")){$bnbbtc_getrate=get_rate_binance("BNBBTC");}else{$bnbbtc_getrate=$bnbbtc_rate;}
if(get_rate_binance("LTCBTC")){$ltcbtc_getrate=get_rate_binance("LTCBTC");}else{$ltcbtc_getrate=$ltcbtc_rate;}
if(get_rate_binance("SNTETH")){$snteth_getrate=get_rate_binance("SNTETH");}else{$snteth_getrate=$snteth_rate;}
if(get_rate_binance("BNTETH")){$bnteth_getrate=get_rate_binance("BNTETH");}else{$bnteth_getrate=$bnteth_rate;}
if(get_rate_binance("BTCUSDT")){$btcusdt_getrate=get_rate_binance("BTCUSDT");}else{$btcusdt_getrate=$btcusdt_rate;}
if(get_rate_binance("ETHUSDT")){$ethusdt_getrate=get_rate_binance("ETHUSDT");}else{$ethusdt_getrate=$ethusdt_rate;}
if(get_rate_binance("DASHBTC")){$dashbtc_getrate=get_rate_binance("DASHBTC");}else{$dashbtc_getrate=$dashbtc_rate;}
if(get_rate_binance("DASHETH")){$dasheth_getrate=get_rate_binance("DASHETH");}else{$dasheth_getrate=$dasheth_rate;}
if(get_rate_binance("XRPBTC")){$xrpbtc_getrate=get_rate_binance("XRPBTC");}else{$xrpbtc_getrate=$xrpbtc_rate;}
if(get_rate_binance("XRPETH")){$xrpeth_getrate=get_rate_binance("XRPETH");}else{$xrpeth_getrate=$xrpeth_rate;}
if(get_rate_binance("BNBUSDT")){$bnbusdt_getrate=get_rate_binance("BNBUSDT");}else{$bnbusdt_getrate=$bnbusdt_rate;}
if(get_rate_binance("BCCETH")){$bcceth_getrate=get_rate_binance("BCCETH");}else{$bcceth_getrate=$bcceth_rate;}
if(get_rate_binance("BCCUSDT")){$bccusdt_getrate=get_rate_binance("BCCUSDT");}else{$bccusdt_getrate=$bccusdt_rate;}
if(get_rate_binance("BCCBNB")){$bccbnb_getrate=get_rate_binance("BCCBNB");}else{$bccbnb_getrate=$bccbnb_rate;}
if(get_rate_binance("LTCUSDT")){$ltcusdt_getrate=get_rate_binance("LTCUSDT");}else{$ltcusdt_getrate=$ltcusdt_rate;}
if(get_rate_binance("LTCBNB")){$ltcbnb_getrate=get_rate_binance("LTCBNB");}else{$ltcbnb_getrate=$ltcbnb_rate;}
if(get_rate_binance("ADABTC")){$adabtc_getrate=get_rate_binance("ADABTC");}else{$adabtc_getrate=$adabtc_rate;}
if(get_rate_binance("ADAETH")){$adaeth_getrate=get_rate_binance("ADAETH");}else{$adaeth_getrate=$adaeth_rate;}
if(get_rate_binance("WAVESBNB")){$wavesbnb_getrate=get_rate_binance("WAVESBNB");}else{$wavesbnb_getrate=$wavesbnb_rate;}
if(get_rate_binance("ATOMBNB")){$atombnb_getrate=get_rate_binance("ATOMBNB");}else{$atombnb_getrate=$atombnb_rate;}
if(get_rate_binance("ATOMBTC")){$atombtc_getrate=get_rate_binance("ATOMBTC");}else{$atombtc_getrate=$atombtc_rate;}
if(get_rate_binance("DOGEBTC")){$dogebtc_getrate=get_rate_binance("DOGEBTC");}else{$dogebtc_getrate=$dogebtc_rate;}
if(get_rate_binance("DOGEUSDT")){$dogeusdt_getrate=get_rate_binance("DOGEUSDT");}else{$dogeusdt_getrate=$dogeusdt_rate;}
if(get_rate_binance("ADAUSDT")){$adausdt_getrate=get_rate_binance("ADAUSDT");}else{$adausdt_getrate=$adausdt_rate;}


if($manualrate == 1){
	$ethbtc_getrate=$ethbtc_rate;
	$bnbbtc_getrate=$bnbbtc_rate;
	$ltcbtc_getrate=$ltcbtc_rate;
	$snteth_getrate=$snteth_rate;
	$bnteth_getrate=$bnteth_rate;
	$btcusdt_getrate=$btcusdt_rate;
	$ethusdt_getrate=$ethusdt_rate;
	$dashbtc_getrate=$dashbtc_rate;
	$dasheth_getrate=$dasheth_rate;
	$xrpbtc_getrate=$xrpbtc_rate;
	$xrpeth_getrate=$xrpeth_rate;
	$bnbusdt_getrate=$bnbusdt_rate;
	$bcceth_getrate=$bcceth_rate;
	$bccusdt_getrate=$bccusdt_rate;
	$bccbnb_getrate=$bccbnb_rate;
	$ltcusdt_getrate=$ltcusdt_rate;
	$ltcbnb_getrate=$ltcbnb_rate;
	$adabtc_getrate=$adabtc_rate;
	$adaeth_getrate=$adaeth_rate;
	$wavesbnb_getrate=$wavesbnb_rate;
	$atombnb_getrate=$atombnb_rate;
	$atombtc_getrate=$atombtc_rate;
	$dogebtc_getrate=$dogebtc_rate;
	$dogeusdt_getrate=$dogeusdt_rate;
	$adausdt_getrate=$adausdt_rate;
	
}else{
if(get_rate_binance("ETHBTC")){$ethbtc_getrate=get_rate_binance("ETHBTC");}else{$ethbtc_getrate=$ethbtc_rate;}
if(get_rate_binance("BNBBTC")){$bnbbtc_getrate=get_rate_binance("BNBBTC");}else{$bnbbtc_getrate=$bnbbtc_rate;}
if(get_rate_binance("LTCBTC")){$ltcbtc_getrate=get_rate_binance("LTCBTC");}else{$ltcbtc_getrate=$ltcbtc_rate;}
if(get_rate_binance("SNTETH")){$snteth_getrate=get_rate_binance("SNTETH");}else{$snteth_getrate=$snteth_rate;}
if(get_rate_binance("BNTETH")){$bnteth_getrate=get_rate_binance("BNTETH");}else{$bnteth_getrate=$bnteth_rate;}
if(get_rate_binance("BTCUSDT")){$btcusdt_getrate=get_rate_binance("BTCUSDT");}else{$btcusdt_getrate=$btcusdt_rate;}
if(get_rate_binance("ETHUSDT")){$ethusdt_getrate=get_rate_binance("ETHUSDT");}else{$ethusdt_getrate=$ethusdt_rate;}
if(get_rate_binance("DASHBTC")){$dashbtc_getrate=get_rate_binance("DASHBTC");}else{$dashbtc_getrate=$dashbtc_rate;}
if(get_rate_binance("DASHETH")){$dasheth_getrate=get_rate_binance("DASHETH");}else{$dasheth_getrate=$dasheth_rate;}
if(get_rate_binance("XRPBTC")){$xrpbtc_getrate=get_rate_binance("XRPBTC");}else{$xrpbtc_getrate=$xrpbtc_rate;}
if(get_rate_binance("XRPETH")){$xrpeth_getrate=get_rate_binance("XRPETH");}else{$xrpeth_getrate=$xrpeth_rate;}
if(get_rate_binance("BNBUSDT")){$bnbusdt_getrate=get_rate_binance("BNBUSDT");}else{$bnbusdt_getrate=$bnbusdt_rate;}
if(get_rate_binance("BCCETH")){$bcceth_getrate=get_rate_binance("BCCETH");}else{$bcceth_getrate=$bcceth_rate;}
if(get_rate_binance("BCCUSDT")){$bccusdt_getrate=get_rate_binance("BCCUSDT");}else{$bccusdt_getrate=$bccusdt_rate;}
if(get_rate_binance("BCCBNB")){$bccbnb_getrate=get_rate_binance("BCCBNB");}else{$bccbnb_getrate=$bccbnb_rate;}
if(get_rate_binance("LTCUSDT")){$ltcusdt_getrate=get_rate_binance("LTCUSDT");}else{$ltcusdt_getrate=$ltcusdt_rate;}
if(get_rate_binance("LTCBNB")){$ltcbnb_getrate=get_rate_binance("LTCBNB");}else{$ltcbnb_getrate=$ltcbnb_rate;}
if(get_rate_binance("ADABTC")){$adabtc_getrate=get_rate_binance("ADABTC");}else{$adabtc_getrate=$adabtc_rate;}
if(get_rate_binance("ADAETH")){$adaeth_getrate=get_rate_binance("ADAETH");}else{$adaeth_getrate=$adaeth_rate;}
if(get_rate_binance("WAVESBNB")){$wavesbnb_getrate=get_rate_binance("WAVESBNB");}else{$wavesbnb_getrate=$wavesbnb_rate;}
if(get_rate_binance("ATOMBNB")){$atombnb_getrate=get_rate_binance("ATOMBNB");}else{$atombnb_getrate=$atombnb_rate;}
if(get_rate_binance("ATOMBTC")){$atombtc_getrate=get_rate_binance("ATOMBTC");}else{$atombtc_getrate=$atombtc_rate;}
if(get_rate_binance("DOGEBTC")){$dogebtc_getrate=get_rate_binance("DOGEBTC");}else{$dogebtc_getrate=$dogebtc_rate;}
if(get_rate_binance("DOGEUSDT")){$dogeusdt_getrate=get_rate_binance("DOGEUSDT");}else{$dogeusdt_getrate=$dogeusdt_rate;}
if(get_rate_binance("ADAUSDT")){$adausdt_getrate=get_rate_binance("ADAUSDT");}else{$adausdt_getrate=$adausdt_rate;}
}



mysql_query("UPDATE configurationx SET ethbtc_rate='".$ethbtc_getrate."', bnbbtc_rate='".$bnbbtc_getrate."', ltcbtc_rate='".$ltcbtc_getrate."', snteth_rate='".$snteth_getrate."', bnteth_rate='".$bnteth_getrate."', btcusdt_rate='".$btcusdt_getrate."', ethusdt_rate='".$ethusdt_getrate."', dashbtc_rate='".$dashbtc_getrate."', dasheth_rate='".$dasheth_getrate."', xrpbtc_rate='".$xrpbtc_getrate."', xrpeth_rate='".$xrpeth_getrate."', bnbusdt_rate='".$bnbusdt_getrate."', bcceth_rate='".$bcceth_getrate."', bccusdt_rate='".$bccusdt_getrate."', bccbnb_rate='".$bccbnb_getrate."', ltcusdt_rate='".$ltcusdt_getrate."', ltcbnb_rate='".$ltcbnb_getrate."', adabtc_rate='".$adabtc_getrate."', adaeth_rate='".$adaeth_getrate."', wavesbnb_rate='".$wavesbnb_getrate."', atombnb_rate='".$atombnb_getrate."', atombtc_rate='".$atombtc_getrate."', dogebtc_rate='".$dogebtc_getrate."', dogeusdt_rate='".$dogeusdt_getrate."', adausdt_rate='".$adausdt_getrate."'  WHERE id='1'");	


mysql_close();
?>