View file includes/content_funcs.php

File size: 16.63Kb
<?
function MainTop($title="", $info ,$meta=""){
	
	if(eregi("currency.php",$_SERVER["PHP_SELF"])){
		$onLoad = "Init()";
	}
	else{
		$onLoad = "";
	}

	global $SITE_URL;
	global $_SESSION;
	global $DEF_CURRENCY;
	global $MAIN_CLASS;

	if($MAIN_CLASS==""){
		$main_class = "main";
	}
	else{
		$main_class = $MAIN_CLASS;
	}
	
	
	$result = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>'.$title.'</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
'.$meta.'
<link href="/style.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="'.$onLoad.'">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td height="113" align="center" valign="top"> 
      <table width="780" height="88" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="242"><a href="'.$SITE_URL.'"><img src="/images/logo.gif" width="242" height="88" alt="'.$SETTINGS['site_name'].'" border=0></a></td>
          <td width="1" bgcolor="#FFFFFF"><img src="/images/dot.gif" width="1" height="1"></td>
          <td background="/images/bghead.gif">&nbsp;</td>
          <td width="186"><img src="/images/head2.gif" width="186" height="88"></td>
        </tr>
      </table>
      <table width="780" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td height="1" bgcolor="#FFFFFF"><img src="/images/dot.gif" width="1" height="1"></td>
        </tr>
        <tr> 
          <td height="10" background="/images/bgyel.gif"><img src="/images/dot.gif" width="1" height="1"></td>
        </tr>
        <tr> 
          <td height="1" bgcolor="#FFFFFF"><img src="/images/dot.gif" width="1" height="1"></td>
        </tr>
        <tr> 
          <td height="20" bgcolor="#999999">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="16">&nbsp;</td>
                <td><a href="/"><img src="/images/buthome.gif" width="20" height="20" border=0 alt="На главную"></a><a href="/support.php"><img src="/images/butmail.gif" width="20" height="20" border=0 alt="Контактная информация"></a></td>
                <td width="30"><a href="/faq.php"><img src="/images/butfaq.gif" width="30" height="20" border=0 alt="Часто задаваемые вопросы"></a></td>
                <td width="80"><a href="/support.php"><img src="/images/butsupport.gif" width="80" height="20" border=0 alt="Служба поддержки"></a></td>
              </tr>
            </table></td>
        </tr>
        <tr>
          <td height="2" bgcolor="#FFFFFF"><img src="/images/dot.gif" width="1" height="1"></td>
        </tr>
      </table></td>
  </tr>
  <tr> 
    <td align="center" valign="top"><table width="780" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="242" align="center" valign="top">
			<table width="780" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="242" align="center" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td valign="top"> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table1">
                    <tr> 
                      <td valign="top" class="inform"><span class="infoheader">Информация</span><br>
                    '.$info.'    
					</td>
                    </tr>
                  </table></td>
              </tr>
              <tr> 
                <td height="2"><img src="/images/dot.gif" width="1" height="1"></td>
              </tr>
              <tr> 
                <td valign="top"> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table2">
                    <tr> 
                      <td bgcolor="#999999" class="kursheader">Курсы мировых валют</td>
                    </tr>
                    <tr> 
                      <td height="1" bgcolor="#CCCCCC"><img src="/images/dot.gif" width="1" height="1"></td>
                    </tr>
                    <tr> 
                      <td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr> 
                            <td width="75">&nbsp;</td>
                            <td width="55" align="center" class="kurs">прямой</td>
                            <td width="55" align="center" class="kurs">обратный</td>
                            <td width="57" align="center" class="kurs">измен.</td>
                          </tr>';
	$val_row = mysql_fetch_object(mysql_query("select * from currencies where code='$DEF_CURRENCY'"));
	$res = mysql_query("select * from currencies where code<>'$DEF_CURRENCY' order by id");
	while($row = mysql_fetch_object($res)){
		$query = "select * from courses where val1_id = $row->id and val2_id = $val_row->id order by courses.date desc";
		$tmp_res = mysql_query($query);
		$tmp_row1 = mysql_fetch_object($tmp_res);
		
		$query = "select * from courses where val1_id = $row->id and val2_id = $val_row->id and date <=".($tmp_row1->date-24*3600)." order by courses.date desc";
		$tmp_res = mysql_query($query);
		
		if($tmp_row2 = @mysql_fetch_object($tmp_res)){
			$change = round($tmp_row1->course - $tmp_row2->course,4)+0;
			$class = $change >=0?"kursup":"kursdown";
		}
		else{
			$change = "-";
		}
		
		$val_str = "<table class=kurs1name wdth=10 cellspacing=0><tr><td>".($tmp_row1->val1_number>1?$tmp_row1->val1_number:"")."</td><td>$row->code</td> <td>/</td> <td></td><td>$DEF_CURRENCY</td></tr></table>";
		
		$result.= "<tr><td class=\"kurs1name\">$val_str</td><td align=\"center\" class=\"kurs1\">".($tmp_row1->course+0)."</td><td align=\"center\" class=\"kurs1\">".($tmp_row1->back_course+0)."</td><td align=\"center\" class=\"$class\">$change</td></tr>";
	}
	$result .= '                          
                        </table></td>
                    </tr>
                  </table></td>
              </tr>
              <tr> 
                <td height="2" valign="top"><img src="/images/dot.gif" width="1" height="1"></td>
              </tr>
              <tr> 
                <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="table2">
                    <tr> 
                      <td bgcolor="#999999" class="kursheader">Стоимость металлов 
                      </td>
                    </tr>
                    <tr> 
                      <td height="1" bgcolor="#CCCCCC"><img src="/images/dot.gif" width="1" height="1"></td>
                    </tr>
                    <tr> 
                      <td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr> 
                            <td width="92" align="left" class="kurs1name">название</td>
                            <td width="75" align="center" class="kurs">цена за 
                              1г. (USD)</td>
                            <td width="75" align="center" class="kurs">измен.</td>
                          </tr>';
	$res = mysql_query("select * from metals order by id");
	while($row = mysql_fetch_object($res)){
		$query = "select * from metal_prices where metal_id = $row->id order by date desc";
		$tmp_res = mysql_query($query);
		$tmp_row1 = mysql_fetch_object($tmp_res);

		$query = "select * from metal_prices where metal_id = $row->id and date<=".($tmp_row1->date-24*3600)." order by date desc";
		$tmp_res = mysql_query($query);

		if($tmp_row2 = @mysql_fetch_object($tmp_res)){
			$change = round($tmp_row1->price - $tmp_row2->price +0,4);
		}
		else{
			$change = "-";
		}
		$class = $change >=0?"kursup":"kursdown";
		
		$result.= "<tr><td class=\"kurs1name\">$row->name</td><td align=\"center\" class=\"kurs1\">".round($tmp_row1->price,4)."</td><td align=\"center\" class=\"$class\">$change</td></tr>";
	}
	$result.='</table></td>
                    </tr>
                  </table></td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td class="text1"><!-- raznoe --></td>
              </tr>
            </table>		
			</td>
          <td width="538" align="left" valign="top" class="'.$main_class.'">';
	
	return $result;
}

function MainBottom(){
	
	$result ='</td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td height="143" align="center" valign="top"> 
      <table width="780" height="40" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td width="242" valign="top" class="copyr"> 
            <hr size="1" noshade>
            ExChanger.ru &copy; 2004<br>
            Все права защищены.<br>
            Разработка сайта: BusinessMedia<br>
            Дизайн: дизайн-бутик SETI</td>
          <td width="5" valign="top">&nbsp;</td>
          <td align="left" valign="top"> 
            <hr size="1" noshade>
        
			
		</td>
          
		<td width="250" align="right" valign="top"> 
            <hr size="1" noshade>
            <A href="http://certsrv.webmoney.ru/certview.asp?wmid=221293262004" target=_blank><IMG
style="BORDER-LEFT-COLOR: black; BORDER-BOTTOM-COLOR: black; BORDER-TOP-COLOR: black; BORDER-RIGHT-COLOR: black"
height=75 alt="Посмотреть сертификат WM 221293262004"
src="/images/WMTrustID.gif" width=73 border=0></A><img src="/images/dot.gif" width="20" height="1"><img src="/images/stamprussian.gif" width="134" height="85"></td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>';
	
	return $result;
}

function adminTop($menuItem="0",$meta="")
{
	global $SITE_URL;

	$mainItems = array('<a href="'.$SITE_URL.'/admin/index.php" class="mainmenu">Главная</a>',
					   '<a href="'.$SITE_URL.'/admin/orders/index.php" class="mainmenu">Обмен</a>',
					   '<a href="'.$SITE_URL.'/admin/excurr/index.php" class="mainmenu">FM валюты</a>',
					   '<a href="'.$SITE_URL.'/admin/exchange/index.php" class="mainmenu">Направления обмена</a>',
					   '<a href="'.$SITE_URL.'/admin/currs/index.php" class="mainmenu">Курсы валют</a>',
					   '<a href="'.$SITE_URL.'/admin/metals/index.php" class="mainmenu">Стоимость металлов</a>',
					   '<a href="'.$SITE_URL.'/admin/ban/index.php" class="mainmenu">Бан</a>',
						 '<a href="'.$SITE_URL.'/admin/ad/index.php" class="mainmenu">Рекламные материалы</a>',
					   '<a href="'.$SITE_URL.'/admin/partners/index.php" class="mainmenu">Партнеры</a>',
					//   '<a href="'.$SITE_URL.'/admin/langs/index.php" class="mainmenu">Языки</a>',
					   '<a href="'.$SITE_URL.'/admin/countries/index.php" class="mainmenu">Страны</a>',
					   '<a href="'.$SITE_URL.'/admin/faq/index.php" class="mainmenu">FAQ</a>',
						 '<a href="'.$SITE_URL.'/admin/pages/index.php" class="mainmenu">HTML страницы</a>'
						 );
	$mainCurItems = array('<b class="mainmenu">Главная</b>',
					   '<b>Обмен</b>',
					   '<b>FM валюты</b>',
					   '<b>Направления обмена</b>',
					   '<b>Курсы валют</b>',
					   '<b>Стоимость металлов</b>',
					   '<b>Бан</b>',
						 '<b>Рекламные материалы</b>',
					   '<b>Партнеры</b>',
					 //  '<b>Языки</b>',
					   '<b>Страны</b>',
					   '<b>FAQ</b>',
						 '<b>HTML страницы</b>'
						 );
	
	/* menus of sections */
	if ($menuItem==1) /* lottos menu*/
	{
		$sectionMenuHTML ='<ul class="mainmenu">
													<li><nobr><a href="./index.php" class="mainmenu">Список операций</a></nobr>
													</ul>';
	}
	elseif ($menuItem==2) /* email lists menu*/
	{
		$sectionMenuHTML ='<ul class="mainmenu">
													<li><nobr><a href="./index.php" class="mainmenu">Список FM валют</a></nobr>
													<li><nobr><a href="./comissions.php" class="mainmenu">Комиссии</a></nobr>
													<li><nobr><a href="./balance_hist.php" class="mainmenu">История по балансам</a></nobr>
													<li><nobr><a href="./add.php?action=add" class="mainmenu">Добавить валюту</a></nobr>
													<li><nobr><a href="./com_add.php?action=add" class="mainmenu">Добавить комиссию</a></nobr>
													</ul>';
	}
	elseif ($menuItem==3) /* email lists menu*/
	{
		$sectionMenuHTML ='<ul class="mainmenu">
													<li><nobr><a href="./index.php" class="mainmenu">Направления</a></nobr>
													<li><nobr><a href="./add.php?action=add" class="mainmenu">Добавить</a></nobr>
													</ul>';
	}
	elseif ($menuItem==4) /* ban menu*/{
		$sectionMenuHTML ='<ul class="mainmenu">
													<li><nobr><a href="./index.php" class="mainmenu">Курсы валют</a></nobr>
													<li><nobr><a href="./currencies.php" class="mainmenu">Валюты</a></nobr>
													<li><nobr><a href="./addc.php?action=add" class="mainmenu">Добавить курс</a></nobr>
													<li><nobr><a href="./add.php?action=add" class="mainmenu">Добавить валюту</a></nobr>
													</ul>';
	}
	elseif ($menuItem==5) /* ban menu*/{
		$sectionMenuHTML ='<ul class="mainmenu">
													<li><nobr><a href="./index.php" class="mainmenu">Стоимость металлов</a></nobr>
													<li><nobr><a href="./metals.php" class="mainmenu">Металлы</a></nobr>
													<li><nobr><a href="./addm.php?action=add" class="mainmenu">Добавить стоимость</a></nobr>
													<li><nobr><a href="./add.php?action=add" class="mainmenu">Добавить металл</a></nobr>
													</ul>';
	}
	elseif ($menuItem==7) /* ad matherials*/{
		$sectionMenuHTML ='<ul class="mainmenu">
													<li><nobr><a href="./index.php" class="mainmenu">Реклама обменника</a></nobr>
													<li><nobr><a href="./add.php?action=add" class="mainmenu">Добавить рекламу обменника</a></nobr>
													<li><nobr><a href="./p_index.php" class="mainmenu">Реклама партнерской системы</a></nobr>
													<li><nobr><a href="./p_add.php?action=add" class="mainmenu">Добавить рекламу партнерской системы</a></nobr>
													<li><nobr><a href="./c_index.php" class="mainmenu">Выносной javascript код</a></nobr>
													<li><nobr><a href="./c_add.php?action=add" class="mainmenu">Добавить выносной javascript код</a></nobr>
													
													</ul>';
	}
	elseif ($menuItem==8) /* partners menu*/{
		$sectionMenuHTML ='<ul class="mainmenu">
													<li><nobr><a href="./index.php" class="mainmenu">Список партнеров</a></nobr>
													<li><nobr><a href="./add.php?action=add" class="mainmenu">Добавить</a></nobr>
													<li><nobr><a href="./payout_index.php" class="mainmenu">Выплаты</a></nobr>
													</ul>';
	}
	elseif ($menuItem==9) /*  menu*/{
		$sectionMenuHTML ='<ul class="mainmenu">
													<li><nobr><a href="./index.php" class="mainmenu">Список стран</a></nobr>
													<li><nobr><a href="./add.php?action=add" class="mainmenu">Добавить</a></nobr>
													</ul>';
	}
	elseif ($menuItem==10) /*  menu*/{
		$sectionMenuHTML ='<ul class="mainmenu">
													<li><nobr><a href="./index.php" class="mainmenu">Список вопросов</a></nobr>
													<li><nobr><a href="./add.php?action=add" class="mainmenu">Добавить</a></nobr>
													</ul>';
	}
	elseif ($menuItem==11) /* payouts menu*/{
		$sectionMenuHTML ='<ul class="mainmenu">
													<li><nobr><a href="./index.php" class="mainmenu">Список HTML страниц</a></nobr>
													<li><nobr><a href="./add.php?action=add" class="mainmenu">Добавить</a></nobr>
													</ul>';
	}
		
	$res ='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Администрирование Обменника</title>
'.$meta.'
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">


<link href="'.$SITE_URL.'/admin/admin.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0" rightmargin="0" >
<table cellpadding="0" cellspacing="0" width="100%" border="0" align="center" bgcolor="#A5ACB1" height=30>
<tr>
<td align="center" class="text" valign="middle">Административный раздел</td></tr></table>
<!-- menu start -->
<center>
<table border="0" cellspacing="3" cellpadding="0">
<tr align="center" class="mainmenu">';
	$i=0;
	while (list(, $value) = each ($mainItems)) {
		if($menuItem==$i){
			$res.="<td>".$mainCurItems[$i]."</td>";
		}
		else{
			$res.="<td>".$mainItems[$i]."</td>";
		}
		if($i!=(sizeof($mainItems)-1)){
			$res.="<td>|</td>";
		}
		$i++;	
	}


	$res.='</tr>
</table>   
</center>
<!-- menu end -->
<br>
<table border="0" cellspacing="2" cellpadding="2" width="100%">
  <tr>
    <td valign="top" width="10%">
	<!-- section menu start  -->'.$sectionMenuHTML.'<!-- section menu end  -->
	</td><td width=20>&nbsp;</td>
    <td valign="top" class="text">
';
	
	return $res;
}

function adminBottom()
{
	$res ='	</td>
  </tr>
</table>
</body>
</html>
';
	
	return $res;
}
?>