Вход Регистрация
Файл: RootPanel 1.7.0 FreeCode/RootPanel 1.7.0 FreeCode/_rootbill/_renewdomain.inc.php
Строк: 239
<?
    $domain_id
=@intval($domain_id);
    
$domainMonths=@intval($domainMonths);

    if (
$sub == "renew") {
        
$r=@mysql_query("select * from orders_domains where id='$domain_id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
        if (
mysql_num_rows($r) > 0) {
            
$r mysql_Fetch_object($r);

            
$zone=GetZoneById($r->zone_id);

            if (
IsUserDomainReseller($_SESSION['userId'])) {
                
$domainCost=$zone->renew_if_domainreseller;
            } else if (
IsUserActiveReseller($_SESSION["userId"])) {
                
$domainCost=$zone->renew_if_reseller;
            } else {
                
$domainCostType GetSetting("domainCostType");

                if (
$domainCostType and IsUserHaveActiveOrders($_SESSION['userId'])) { $domainCost=$zone->renew_if_host; }
                else { 
$domainCost=$zone->renew_if_not_host; }
            }

            
$domSpecCost GetSpecialCost($_SESSION['userId'],"zone",$zone->id);
            if (
$domSpecCost) {
                
$domainCost $domSpecCost["cost2"];
            }

            
$domainCost=$domainCost * ($domainMonths/12);
            
$domainDiscount $r->discount;
            
$domainCost $domainCost - ($domainCost/100)*$domainDiscount;

            if (
$promocode) {
                
$coupon GetCoupon("promo",$promocode);
                if (
IsCanUseCoupon($coupon->id,$_SESSION["userId"])) {
                    
$promoId $coupon->id;
                    
$promoSkidka $coupon->value;
                    
$promoTXT ", promo-code $promocode";
                }
            }

            if (
$promoSkidka) {
                if (
$domainCost 0) { $domainCost round($domainCost-$domainCost/100*$promoSkidka,2); }
            }

            @
mysql_query("insert into bills (uid,domain_id,domain_srok,money_domain,created,renew) values('".$_SESSION['userId']."','$domain_id','$domainMonths','$domainCost',NOW(),'1')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
            
$bill_id=mysql_insert_id();
            
$sid=sprintf("%04d"$bill_id);

                 
addUserLog($_SESSION['userId'], "renewdomain""$r->domain, ".($domainMonths/12)." ".$_lang[OrderSokraschenieGod].$promoTXT);
            
AddUsedByToCoupon($promoId,$_SESSION["userId"],$bill_id);

            
$tpl=GetTpl('email_touser_domain_renew'$_SESSION["userLang"]);
            
$subject $tpl[subject]; $template $tpl[template];

            if (
$subject and $template) {
                
$attachPDFtoBill GetSetting("attachPDFtoBill");
                if ((
$attachPDFtoBill and $_SESSION["userAttachPDFtoBill"] != "2") or (!$attachPDFtoBill and $_SESSION["userAttachPDFtoBill"] == "1")) {
                    
$profile=GetUserProfileByUserId($_SESSION['userId']);

                    if (
$profile->org == "3" and $profile->firma and $profile->phone) {
                        
$attachFile createFaktura(''$bill_id2);
                    } else if (
$profile->org == "2" and $profile->name and $profile->surname and $profile->phone) {
                        
$attachFile createFaktura(''$bill_id2);
                    } else if (
$profile->org == "1") {
                        
$attachFile createKvitanciya(''$bill_id2);
                    }
                    if (!
$attachFile) {$attachFile="";}
                }

                
$company_name=GetSetting('company_name');
                
$company_url=GetSetting('company_url');
                
$billing_url=GetSetting('billing_url');
                
$support_url=GetSetting('support_url');
                
$manager_email=GetSetting('manager_email');
                 
                
$template str_replace('{company_name}',$company_name,$template);
                     
$template str_replace('{company_url}',$company_url,$template);
                     
$template str_replace('{billing_url}',$billing_url,$template);
                     
$template str_replace('{support_url}',$support_url,$template);
                     
$template str_replace('{domain}',$r->domain,$template);
                     
$template str_replace('{srok}',($domainMonths/12),$template);
                     
$template str_replace('{login}',$_SESSION["userLogin"],$template);
                     
$template str_replace('{password}',"******",$template);
                     
$template str_replace('{schet}',$sid,$template);
                     
$template str_replace('{domaincost}',round($domainCost*CURK,2)." ".CURS,$template);
                     
$template str_replace('{cost}',round($domainCost*CURK,2)." ".CURS,$template);
                     
$template str_replace('{userid}',$_SESSION['userId'],$template);
         
                
WriteMailLog($subject,$template,$_SESSION["userId"]);
                
sendmail($_SESSION["userEmail"],$company_name,$manager_email,$subject,$template,$attachFile);
                
sendmail($_SESSION["userEmail2"],$company_name,$manager_email,$subject,$template,$attachFile);

                
$admEmails=GetAdminEmailsWhereTrueParam("sendneworder");
                if (
count($admEmails) > 0) {
                    
WriteMailLog("Duplicate: ".$subject,$template);
                }
                
sendmail($manager_email,'',$manager_email,"Duplicate: ".$subject,$template,$attachFile);
                @
unlink($attachFile);
            }
            
mclose();

            
Header("Location: billing.php?do=pay&fromreg=1&id=$bill_id");

            exit;

        }
    }

    
$r=@mysql_query("select * from orders_domains where id='$domain_id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
    if (
mysql_num_rows($r) == 0) {$error=$_lang[ErrorBadId];}

    
_head('utf-8',$_lang[RenewTitleDomain]);
    print 
"<H1 class=pagetitle>".$_lang[RenewTitleDomain]."</H1><hr class=hr>";
    if (
$error) {print $_lang[Error].": $error<BR><BR>";}

    if (
mysql_num_rows($r) > 0) {
        
$r=mysql_fetch_object($r);

        
?>
        <form method=post>
        <input type=hidden name=do value=<?=$do?>>
        <input type=hidden name=sub value=renew>
        <input type=hidden name=domain_id value=<?=$domain_id?>>
        <table class='rpTableBlank' border=0>
        <tr><td align=right><?=$_lang[RenewDomain]?>:&nbsp;</td><td><input class=input type=text name=domain value="<?=$r->domain?>" readonly></td></tr>
        <?
        $minsrok
=@mysql_query("select t1.minsrok_renew from zones as t1, orders_domains as t2 where t1.id=t2.zone_id and t2.id='$domain_id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
        
$minsrok=mysql_fetch_object($minsrok);
        
$minsrok=$minsrok->minsrok_renew;
        
?>
        <tr><td align=right><?=$_lang[RenewNaSrok]?>:</td><Td><select class=input name=domainMonths><option value=<?=$minsrok?>><?=($minsrok/12)?> <?=$_lang[RenewYear]?></option></select></td></tr>
        <? if (GetCouponActiveCount("promo") > 0) { ?>
        <tr><td align=right><?=$_lang[OrderPromoCode]?>:&nbsp;</td><td><input class=input type=text name=promocode value="<?=$promocode?>"></td></tr>
        <? ?>
        <tr><td colspan=2 align=center><BR><input class=button type=submit value=<?=$_lang[RenewRenew]?>></td></tr>
        </table>
        <?
    
}
    
_foot('utf-8');
?>
Онлайн: 1
Реклама