0) { $errs[] = "Sorry, current exchange direction is exists"; } if ((isset($from_rate) && $from_rate != "" && !is_numeric($from_rate)) || (isset($to_rate) && $to_rate != "" && !is_numeric($to_rate))) $errs[] = "Please enter correct exchange rate (numbers only)"; if (isset($fee) && $fee != "" && !is_numeric($fee) && !strstr($fee, "%")) $errs[] = "Please enter correct fee value"; if (isset($min_amount) && $min_amount != "" && !is_numeric($min_amount)) $errs[] = "Please enter correct minimum exchange value"; if (isset($max_amount) && $max_amount != "" && !is_numeric($max_amount)) $errs[] = "Please enter correct maximum exchange value"; if (isset($min_amount) && is_numeric($min_amount) && isset($max_amount) && is_numeric($max_amount) && $min_amount>$max_amount) $errs[] = "Max exchange value cant be less than min value"; if ($auto_rate == 1) { //like function //dev $fsym = GetCurrencyCode($from_currency); $tsyms = GetCurrencyCode($to_currency); $url = "https://min-api.cryptocompare.com/data/price?fsym=".$fsym."&tsyms=".$tsyms; //https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD,EUR //https://www.cryptocompare.com/api/#public-api-invocation $json = json_decode(file_get_contents($url), true); if ($json["Response"] != "Error") { //if (strstr($json[$tsyms], 'e')) //{ $from_rate = 1; $to_rate = floatval($json[$tsyms]); //} } else { $errs[] = "Sorry, auto price update not available for these currencies"; } } } if (count($errs) == 0) { $exchange_rate = $to_rate/$from_rate; $insert_sql = "INSERT INTO exchangerix_exdirections SET from_currency='$from_currency', to_currency='$to_currency', from_rate='$from_rate', to_rate='$to_rate', exchange_rate='$exchange_rate', auto_rate='$auto_rate', fee='$fee', min_amount='$min_amount', max_amount='$max_amount', user_instructions='$instructions', description='$description', is_manual='$is_manual', hide_from_visitors='$hide_from_visitors', allow_affiliate='$allow_affiliate', sort_order='$sort_order', status='$status', added=NOW()"; //user_id='0' $result = smart_mysql_query($insert_sql); $new_coupon_id = mysqli_insert_id($conn); header("Location: exdirections.php?msg=added"); exit(); } else { $errormsg = ""; foreach ($errs as $errorname) $errormsg .= $errorname."
"; } } ////////////////////////////////////////////////// // delete //////////////////////////////////////// if (isset($_GET['id']) && is_numeric($_GET['id']) && $_GET['action'] == "delete") { $did = (int)$_GET['id']; //DeleteExDirection($did); smart_mysql_query("DELETE FROM exchangerix_exdirections WHERE exdirection_id='$did'"); header("Location: exdirections.php?msg=deleted"); exit(); } // results per page if (isset($_GET['show']) && is_numeric($_GET['show']) && $_GET['show'] > 0) $results_per_page = (int)$_GET['show']; else $results_per_page = 10; // Update // if (isset($_POST['update']) && $_POST['update'] != "") { $sorts_arr = array(); $sorts_arr = $_POST['from_rate']; $from_rate = array(); $from_rate = $_POST['from_rate']; $to_rate = array(); $to_rate = $_POST['to_rate']; if (count($sorts_arr) > 0) { foreach ($sorts_arr as $k=>$v) { $new_from_rate = (float)$from_rate[$k]; $new_to_rate = (float)$to_rate[$k]; $up_query = ""; if ($new_from_rate > 0) $up_query .= "from_rate='".$new_from_rate."',"; if ($new_to_rate > 0) $up_query .= "to_rate='".$new_to_rate."',"; if ($new_to_rate > 0 && $new_to_rate > 0) { $exchange_rate = $new_to_rate/$new_from_rate; $up_query .= "exchange_rate='$exchange_rate',"; }elseif($new_to_rate == 0) { $up_query .= "status='inactive',"; } smart_mysql_query("UPDATE exchangerix_exdirections SET $up_query sort_order='".(int)$v."' WHERE exdirection_id='".(int)$k."'"); } } header("Location: exdirections.php?msg=updated"); exit(); } // Delete // if (isset($_POST['delete'])) { $ids_arr = array(); $ids_arr = $_POST['id_arr']; if (count($ids_arr) > 0) { foreach ($ids_arr as $v) { $did = (int)$v; smart_mysql_query("DELETE FROM exchangerix_exdirections WHERE exdirection_id='$did'"); //DeleteExDirection($did); } header("Location: exdirections.php?msg=deleted"); exit(); } } $where = "1=1"; ////////////////// filter ////////////////////// if (isset($_GET['column']) && $_GET['column'] != "") { switch ($_GET['column']) { case "title": $rrorder = "title"; break; case "sort_order": $rrorder = "sort_order"; break; case "added": $rrorder = "added"; break; case "last_visit": $rrorder = "last_visit"; break; case "auto_rate": $rrorder = "auto_rate"; break; case "total_exchanges": $rrorder = "total_exchanges"; break; case "today_exchanges": $rrorder = "today_exchanges"; break; case "visists": $rrorder = "visits"; break; case "status": $rrorder = "status"; break; default: $rrorder = "sort_order"; break; } } else { $rrorder = "sort_order"; } if (isset($_GET['order']) && $_GET['order'] != "") { switch ($_GET['order']) { case "asc": $rorder = "asc"; break; case "desc": $rorder = "desc"; break; default: $rorder = "asc"; break; } } else { $rorder = "asc"; } if (isset($_GET['filter']) && $_GET['filter'] != "") { $filter = mysqli_real_escape_string($conn, trim(getGetParameter('filter'))); $where .= " AND (title LIKE '%$filter%' OR code LIKE '%$filter%') "; $totitle = " - Search Results"; } /////////////////////////////////////////////////////// if (isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] > 0) { $page = (int)$_GET['page']; } else { $page = 1; } $from = ($page-1)*$results_per_page; /* if (isset($_GET['store']) && $_GET['store'] != "") { $store = substr(trim(getGetParameter('store')), 0, 10); $store = mysqli_real_escape_string($conn, $store); //dev //$where .= " AND currency_code='$store' "; $title2 = $store; }*/ if (isset($_GET['from_filter']) && is_numeric($_GET['from_filter'])) { $from_filter = (int)$_GET['from_filter']; $where .= " AND from_currency='$from_filter' "; $title2 .= " ".GetCurrencyName($from_filter)." "; } if (isset($_GET['to_filter']) && is_numeric($_GET['to_filter'])) { $to_filter = (int)$_GET['to_filter']; $where .= " AND to_currency='$to_filter' "; $title2 .= " ".GetCurrencyName($to_filter); } $query = "SELECT *, DATE_FORMAT(added, '".DATE_FORMAT."') AS date_added FROM exchangerix_exdirections WHERE $where ORDER BY $rrorder $rorder, added DESC LIMIT $from, $results_per_page"; $result = smart_mysql_query($query); $total_on_page = mysqli_num_rows($result); $query2 = "SELECT * FROM exchangerix_exdirections WHERE ".$where; $result2 = smart_mysql_query($query2); $total = mysqli_num_rows($result2); $cc = 0; //$title = $title2." Exchange Directions"; $title = "Exchange Directions"; require_once ("inc/header.inc.php"); ?>
">

Add Exchange Direction

style="display: none;" style="display: ;">

User Send

* Exchange Direction:
Auto Rate:
* Exchange Rate: =
Fee: " size="5" class="form-control" />
Min Amount:
Max Amount:
Hide from unregistered users:
Allow affiliate commission:
Manual Processing:
style="display: none;" style="display: ;">

User Receive

 
Instructions for user:
Description:
Status:

">
Add Direction

Exchange Directions 0) { ?>

Sort by:
Delete Filter
0) { ?>Showing - of
0) { ?> ">
Exchange Direction Exchange Rate Min
Amount
Max
Amount
Fee Exchanges
all time / today
Status Actions


manual auto hidden
reserve:
reserve:


/> = />
auto rate update
0) ? $row['min_amount']." ".GetCurrencyCode($row['from_currency']) : "---"; ?> 0) ? $row['max_amount']." ".GetCurrencyCode($row['from_currency']) : "---"; ?> --- 0) echo "+"; echo $row['today_exchanges']; ?> ".$row['status'].""; break; case "inactive": echo "".$row['status'].""; break; case "expired": echo "".$row['status'].""; break; default: echo "".$row['status'].""; break; } ?> 0) ? "?" : ""; ?> View Edit Delete
No directions found for your search criteria. See all ›
There are no exchange directions at this time. See all ›