Вход Регистрация
Файл: public_html/page/payin.php
Строк: 137
<?php 
if (!defined('BASE_DIR')) { exit(header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'true)); }

if (!isset(
$_SESSION['user_id'])) { exit(header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'true)); } 

if (
$users_info['ban'] == 1) { exit(header('Location: /ban.php?mode='.$users_info['ban'])); } 

$obEngine->addTitleHtml('Пополнение баланса');
   
?>
<div class="wrapper">
 <div class=main>
  <div class=m_left>
   <div class=m_title>Пополнение баланса</div>
   <?php 
   
if (isset($_GET['mode']) && $_GET['mode'] = 'preview')
   { 
     
$sum = isset($_POST['sum']) ? round(floatval($_POST["sum"]),2) : 0;
     
     if (
$sum <= 0) { exit(header('Location: /payin.php?msg=200')); }
     
     
$sum_comm sprintf("%.2f"$sum + ($sum*$obEngine->getConfig('comm_pay')/100)); 
     
     if (
$sum_comm <= 0) { exit(header('Location: /payin.php?msg=200')); }
     
     
$desc base64_encode('Пополнение баланса пользователя '.$users_info['login']);
     
     
$query $mysqli->query("SELECT `id` FROM `".PREFIX."_history_pay` WHERE `user_id` = '".$_SESSION['user_id']."' and `status` = '0' and `type` = '1' LIMIT 1");    
  
     if (
$query->num_rows)
     {
       
$res $query->fetch_assoc();   
         
       
$id_zakaz $res['id'];  
         
       
$mysqli->query("UPDATE `".PREFIX."_history_pay` SET `time_add` = NOW(), `price` = '".$sum."', `money` = '".$sum_comm."' WHERE `user_id` = '".$_SESSION['user_id']."' and `status` = '0' and `type` = '1' LIMIT 1");            
     }   
     else
     {
       
$mysqli->query("INSERT INTO `".PREFIX."_history_pay`
                                      (
                                       `time_add`,
                                       `user_id`,
                                       `type`,
                                       `payment`,
                                       `price`,
                                       `money`,
                                       `wallet`
                                      )
                                      VALUES
                                      (
                                       NOW(),
                                       '"
.$_SESSION['user_id']."',                                       
                                       '1',
                                       '',
                                       '"
.$sum."',
                                       '"
.$sum_comm."',
                                       ''
                                      )"
);
       
       
$id_zakaz $mysqli->insert_id();
     }    
     
     
$arHash = array(ID_SHOP_PAYEER$id_zakaz$sum_comm'RUB'$descSECRET_KEY_PAYEER);
     
$sign strtoupper(hash('sha256'implode(':'$arHash)));
     
?>
     <div class="m_l">Сумма к оплате: <b><?php echo $sum_comm?></b> руб.&nbsp;[ <a href="?sum=<?php echo $sum?>">Изменить</a> ]</div>
     <br>
     <div class="m_l">Выберите способ оплаты:</div>
     <div class="pay_btn">
      <form method="POST" action="https://merchant.webmoney.ru/lmi/payment.asp">
       <input type="hidden" name="LMI_PAYMENT_AMOUNT" value="<?php echo $sum_comm?>">
       <input type="hidden" name="LMI_PAYMENT_DESC_BASE64" value="<?php echo $desc?>">
       <input type="hidden" name="LMI_PAYEE_PURSE" value="<?php echo WMR?>">       
       <input type="hidden" name="LMI_PAYMENT_NO" value="<?php echo $id_zakaz?>" />
       <input class="wmoney" type="submit" value="Webmoney">
      </form>
     </div>
     <div class="pay_btn">
      <form method="GET" action="https://payeer.com/merchant/">
       <input type="hidden" name="m_shop" value="<?php echo ID_SHOP_PAYEER?>">
       <input type="hidden" name="m_orderid" value="<?php echo $id_zakaz?>">
       <input type="hidden" name="m_amount" value="<?php echo $sum_comm?>">
       <input type="hidden" name="m_curr" value="RUB">
       <input type="hidden" name="m_desc" value="<?php echo $desc?>">
       <input type="hidden" name="m_sign" value="<?php echo $sign?>">
       <input type="hidden" name="form[ps]" value="2609">
       <input type="hidden" name="form[curr[2609]]" value="RUB">
       <input type="submit" class="wmoney" name="m_process" value="Payeer" />
      </form>
     </div>    
     <?php
   
}
   else
   {
     
$sum = isset($_GET['sum']) ? $_GET['sum'] : 10;  
       
     
?>
     <form name=form1 method=post action=?mode=preview onsubmit="return validate1();">        
      <div class=pay_btn style="line-height:24px;"> 
       <b style="float:left;margin: 0 10px 0 0;">Сумма пополнения в рублях:</b> 
       <input style="width: 180px;"  type="text" name=sum id="sum" value="<?php echo $sum?>" onkeyup="calculate();" maxlength="6">
       <span class=comment2>(+<b><span id=webmoney><?php echo $sum_comm $sum*$obEngine->getConfig('comm_pay')/100?></span></b> руб. комиссия)</span>  
       <button type="submit" name="merchant" style="float:right;">Далее</button>
      </div>
     </form>
     <?php
     $query 
$mysqli->query("SELECT *, DATE_FORMAT(time_add, '%d.%m.%Y, %H:%i') as f_time_add FROM `".PREFIX."_history_pay` WHERE `user_id` = '".$_SESSION['user_id']."' and `type` = '1' and `status` = '1'");
     
     if (
$query->num_rows)
     {
       
?>
       <table class="all_table" width="600" align="left" border="0" cellspacing="0" cellpadding="0">
        <tr>
         <td class="all_title">№</td>
         <td class="all_title">Дата</td>        
         <td class="all_title">Платежная система</td>
         <td class="all_title">Сумма</td>
        </tr>
        <?php
        $n 
1;
        
        while (
$row $query->fetch_assoc()) 
        {
          
?>
          <tr>
           <td class="all_mid"><?php echo $n?></td>
           <td class="all_mid"><?php echo $row['f_time_add']; ?></td>
           <td class="all_mid"><?php echo $row['payment']; ?></td>
           <td class="all_mid"><?php echo $row['price']; ?> руб.</td>
          </tr>
          <?php
          
          $n
++;
        }        
        
?>        
       </table>
       <?php
     
}
   }    
   
?>
  </div>
  <?php include 'module/user_menu.php'?>                   
 </div>
</div>
<script type="text/javascript">
function calculate ()
{
  $temp = $("#sum").val();
  $temp = Number($temp)*<?php echo $obEngine->getConfig('comm_pay')/100?>;
  $temp = $temp.toFixed(2);
  $('#webmoney').html($temp);
  $('#megakassa').html($temp);
}

function validate1 ()
{
    valid = true;
        if (Number(document.form1.sum.value) < 1  || isFinite(document.form1.sum.value) == false)
    {
                alert ('Минимальная сумма для пополнения 1 рубль');
                valid = false;
    }
    return valid;
}
</script>
Онлайн: 0
Реклама