0 //dev
$errs[] = "Please enter correct reserve value";
if (isset($min_reserve) && $min_reserve != "" && !is_numeric($min_reserve)) // > 0 //dev
$errs[] = "Please enter correct minimum reserve value";
if (isset($fee) && $fee != "" && !is_numeric($fee))
$errs[] = "Please enter correct fee value";
if (isset($min_reserve) && $min_reserve > 0 && $min_reserve >= $reserve)
$errs[] = "Min reserve value cant be less than reserve amount";
$check_query = smart_mysql_query("SELECT * FROM exchangerix_currencies WHERE currency_id!='".(int)$currency_id."' AND currency_name='$currency_name' AND currency_code='$currency_code' AND status='active'");
if (mysqli_num_rows($check_query) > 0)
{
$errs[] = "Sorry, currency with same name and code is exists";
}
if ($default_send == 1 && $default_receive == 1)
$errs[] = "Sorry, one currency can't be default for send and receive payments";
if ($default_send == 1)
{
$check_query2 = smart_mysql_query("SELECT * FROM exchangerix_currencies WHERE currency_id!='".(int)$currency_id."' AND default_send='1' AND status='active'");
if (mysqli_num_rows($check_query2) > 0)
{
$errs[] = "Sorry, only one currency can be default for sending";
}
}
if ($default_receive == 1)
{
$check_query3 = smart_mysql_query("SELECT * FROM exchangerix_currencies WHERE currency_id!='".(int)$currency_id."' AND default_receive='1' AND status='active'");
if (mysqli_num_rows($check_query3) > 0)
{
$errs[] = "Sorry, only one currency can be default for receiving";
}
}
if (isset($site_code) && $site_code != "")
{
$check_query4 = smart_mysql_query("SELECT * FROM exchangerix_currencies WHERE currency_id!='".(int)$currency_id."' AND site_code='$site_code'");
if (mysqli_num_rows($check_query4) > 0)
{
$errs[] = "Sorry, currency with same 'Site code' is exists";
}
}
if (isset($xml_code) && $xml_code != "")
{
$check_query5 = smart_mysql_query("SELECT * FROM exchangerix_currencies WHERE currency_id!='".(int)$currency_id."' AND xml_code='$xml_code'");
if (mysqli_num_rows($check_query5) > 0)
{
$errs[] = "Sorry, currency with same 'Xml code' is exists";
}
}
}
if (count($errs) == 0)
{
//if ($reserve == "") $reserve = "999999999999999999";
// check reserve notification // and send email is needed
smart_mysql_query("UPDATE exchangerix_currencies SET currency_name='$cname', currency_code='$currency', gateway_id='$gateway_id', instructions='$instructions', is_crypto='$is_crypto', website='$website', reserve='$reserve', fee='$fee', min_reserve='$min_reserve', site_code='$site_code', xml_code='$xml_code', allow_send='$allow_send', allow_receive='$allow_receive', allow_affiliate='$allow_affiliate', default_send='$default_send', default_receive='$default_receive', sort_order='$sort_order', is_new_currency='$is_new_currency', hide_code='$hide_code', status='$status' WHERE currency_id='$currency_id' LIMIT 1"); //image='$img'
header("Location: currencies.php?msg=updated");
exit();
}
else
{
$errormsg = "";
foreach ($errs as $errorname)
$errormsg .= " ".$errorname."
";
}
}
if (isset($_GET['id']) && is_numeric($_GET['id']))
{
$id = (int)$_GET['id'];
$query = "SELECT * FROM exchangerix_currencies WHERE currency_id='$id' LIMIT 1";
$rs = smart_mysql_query($query);
$total = mysqli_num_rows($rs);
}
$title = "Edit Currency";
require_once ("inc/header.inc.php");
?>