Файл: billing/tarifs.php
Строк: 118
<?
session_set_cookie_params(86400);
session_start();
$full_home_path = dirname(__FILE__);
require_once($full_home_path."/_rootload.php");
mconnect();
validateUser();
if (!EnableLanguages()) { error("Can not load languages."); mclose(); exit; }
if (!GetCurrentCurrency()) { print $_lang[ErrorGetCurrentCurrency]; mclose(); exit; }
head('utf-8',$_lang[TarifsTitle]);
$tpl = GetTpl("tpl_tarifsphp", $_SESSION["userLang"]);
if ($tpl[template]) {
print $tpl[template];
} else {
if (!$vid) {$vid = "hosting";}
$rowsCnt = $TARIFS_ROWS_CNT; if (!$rowsCnt) {$rowsCnt=5;}
$tarifsgroups = GetTarifsGroups();
$isBegin = true;
while ($isBegin or $tarifsgroup = @mysql_fetch_object($tarifsgroups)) {
if ($isBegin) {
$tarifs = @mysql_query("select * from tarifs where vid='$vid' and active='1' and tarifsgroup='0' order by cost") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>Function: ".__FUNCTION__."<BR>MySQL Error: ".mysql_error());
} else {
$tarifs = @mysql_query("select * from tarifs where vid='$vid' and active='1' and tarifsgroup='$tarifsgroup->id' order by cost") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>Function: ".__FUNCTION__."<BR>MySQL Error: ".mysql_error());
}
if (mysql_num_rows($tarifs) > 0) {
if ($isBegin) {
print "<H1 class=pagetitle>".$_lang[TarifsTitle]."</H1><hr class=hr>";
} else {
print "<H1 class=pagetitle>".$tarifsgroup->name."</H1><hr class=hr>";
}
if ($tarifsgroup->description and !$isBegin) {
$tarifsgroup->description = htmlDecode($tarifsgroup->description);
$tarifsgroup->description = preg_replace("/n/ui","<br>",$tarifsgroup->description);
print $tarifsgroup->description; print "<BR><BR>";
}
$cnt = 0;
print "<table class='rpTableBlank'>";
while ($tarif = @mysql_fetch_object($tarifs)) {
$cnt++;
if ($cnt == 1) { print "<tr><td class=tarifBlock valign=top>"; }
else { print "<td class=tarifBlock valign=top>"; }
print "<center><B>".$tarif->name."</B></center><BR>";
if ($tarif->description) {
$tarif->description = htmlDecode($tarif->description);
$tarif->description = preg_replace("/n/ui","<br>",$tarif->description);
print $tarif->description; print "<BR><BR>";
}
############################################################################################################
if ($_SESSION['userId']) {
$tarifSpecCost = GetSpecialCost($_SESSION['userId'],"tarif",$tarif->id);
if ($tarifSpecCost) {
$tarif->cost_setup = $tarifSpecCost["cost1"];
$tarif->cost = $tarifSpecCost["cost2"];
}
}
$maxDiscount=@mysql_query("select MAX(discount) as maxDiscount from tarifs_sroki where tarif_id='$tarif->id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (@mysql_num_rows($maxDiscount) > 0) {
$maxDiscount = mysql_fetch_object($maxDiscount);
$maxDiscount = $maxDiscount->maxDiscount;
} else {
$maxDiscount = 0;
}
if ($tarif->cost_setup) {
$tarifCostSetup = $tarif->cost_setup;
$tarifCostSetup = round($tarifCostSetup*CURK,2)." ".CURS;
} else {
$tarifCostSetup="";
}
if ($maxDiscount > 0) {
$tarifCost = $tarif->cost - $tarif->cost/100*$maxDiscount;
$tarifCost = $_lang[OrderFrom]." ".round($tarifCost*CURK,2)." ".CURS."/".$_lang[OrderSokraschenieMonth];
} else {
$tarifCost = round($tarif->cost*CURK,2)." ".CURS."/".$_lang[OrderSokraschenieMonth];
}
############################################################################################################
print "<B>".$_lang[TarifsCost].":</b> ".$tarifCost."<BR>";
if ($tarifCostSetup) { print "<B>".$_lang[TarifsCostSetup].":</B> ".$tarifCostSetup."<BR>"; }
print "<BR>";
print "<center><a class=rootlink href=order.php?vid=$vid&tarif=$tarif->id>".$_lang[Order]."</a></center>";
if ($cnt == $rowsCnt) { $cnt=0; print "</td></tr>"; }
else { print "</td>";}
}
print "</table><BR>";
}
$isBegin = false;
}
}
foot('utf-8');
mclose();
?>