File size: 4.5Kb
<?
include("../includes/common.php");
$ex_currencies = array();
$res = mysql_query("select ex_currencies.*, currencies.code as c_code from ex_currencies left outer join currencies on ex_currencies.currency_id = currencies.id where ex_currencies.status = 1 order by ex_currencies.position asc");
while($row=mysql_fetch_object($res)){
if(file_exists($_SERVER["DOCUMENT_ROOT"].$COUNTRY_IMG_PATH."/".$row->country_id.".gif")){
$c_img = "<img src=\"".$COUNTRY_IMG_PATH."/".$row->country_id.".gif\">";
}
else{
$c_img = " ";
}
if(file_exists($_SERVER["DOCUMENT_ROOT"].$CURR_IMG_PATH."/".$row->id.".gif")){
$l_img = "<img src=\"".$CURR_IMG_PATH."/".$row->id.".gif\">";
}
else{
$l_img = " ";
}
if($row->type == 'pincode')
{
$collrow = mysql_fetch_assoc(mysql_query("select * from pincode_collections where id=$row->pincode_collection_id"));
$sell_price = $collrow["sell_price"];
$pinrow = mysql_fetch_assoc(mysql_query("select count(*) as pincount from pincodes where collection_id=$row->pincode_collection_id and status='valid'"));
$pincount = $pinrow["pincount"];
$rest = $pincount." шт.";
}
else
{
if($row->metal_id>0){
$rest = (floor($row->amount*GetMetalPrice($row->metal_id)*100)/100)." ".$row->c_code."<br><small>".($row->amount+0 )." гр.</small>";
}
else{
$rest = round($row->amount+0,2)." ".$row->c_code;
}
}
$query = "select * from ex_currencies inner join ex_exchanges on ex_currencies.id = ex_exchanges.ex_currency1_id where ex_exchanges.ex_currency2_id=$row->id and ex_exchanges.status=1 and ex_currencies.status=1";
// echo $query;
$tmp_res = mysql_query($query);
$height = mysql_num_rows($tmp_res)*31+37+15;
$ex_currencies[] = array(
"name" => $row->name,
"c_img" => $c_img,
"l_img" => $l_img,
"id" => $row->id,
"height" => $height,
"rest" => $rest,
"url" => $row->url,
"type" => $row->type,
);
}
$smarty->assign("title", $SETTINGS['site_name']." Универсальная обменная система. Быстрое пополнение WebMoney, ЯндексДенег, E-Gold, E-Port");
$smarty->assign("info", "<a href='http://www.smartexchanger.ru'>SmartExchanger</a> представляет собой мощный скрипт обменника. На этом сайте запущена демо-версия продукта, с помощью которой вы можете получить исчерпывающую информацию по функциональности скрипта обменного пункта.<br><br><strong>Информацию по стоимости и покупке можно найти <a href='http://www.smartexchanger.ru' target='_blank'>здесь</a></strong>.");
$smarty->assign("ex_currencies", $ex_currencies);
$smarty->assign("main_class", "header1");
$smarty->assign("money_cources", get_currency_cources());
$smarty->assign("metal_cources", get_metal_cources());
/** PIN-CODES **/
$ex_currencies = array();
$res = mysql_query("select ex_currencies.*, currencies.code as c_code from ex_currencies left outer join currencies on ex_currencies.currency_id = currencies.id where ex_currencies.status = 1 order by ex_currencies.name asc");
//echo "<!--";
while($row=mysql_fetch_object($res)){
if(file_exists($_SERVER["DOCUMENT_ROOT"].$COUNTRY_IMG_PATH."/".$row->country_id.".gif")){
$c_img = "<img src=\"".$COUNTRY_IMG_PATH."/".$row->country_id.".gif\">";
}
else{
$c_img = " ";
}
if(file_exists($_SERVER["DOCUMENT_ROOT"].$CURR_IMG_PATH."/".$row->id.".gif")){
$l_img = "<img src=\"".$CURR_IMG_PATH."/".$row->id.".gif\">";
}
else{
$l_img = " ";
}
//echo $row->type;
//echo "\n";
if($row->type == 'pincode')
{
$collrow = mysql_fetch_assoc(mysql_query("select * from pincode_collections where id=$row->pincode_collection_id order by name"));
$sell_price = $collrow["sell_price"];
$pinrow = mysql_fetch_assoc(mysql_query("select count(*) as pincount from pincodes where collection_id=$row->pincode_collection_id and status='valid'"));
$pincount = $pinrow["pincount"];
//$pincount = (int)floor($row->amount / $sell_price);
$rest = "rus" == $LANGUAGE ? $pincount." шт." : $pincount;
$ex_currencies[] = array(
"name" => $row->name,
"c_img" => $c_img,
"l_img" => $l_img,
"id" => $row->id,
"height" => $height,
"rest" => $rest,
"url" => $row->url,
"type"=> $row->type,
"sell_price" => $row->type == 'pincode' ? $sell_price : "-",
"c_code" => $row->c_code
);
if($pincount == 0)
{
//continue;
}
}
}
//print_r($ex_currencies);
//echo "-->";
$smarty->assign("ex_currencies_pinc", $ex_currencies);
$smarty->assign("pinc_size", sizeof($ex_currencies));
/** ------------- **/
$smarty->display("smartex_index.tpl");