Файл: магазин/e-proger/modules/message/mout.php
Строк: 65
<?
if ( $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ) {
define( 'ROOT', 'http://'.$_SERVER['HTTP_HOST'] );
define( 'ROOT_DIR', $_SERVER['DOCUMENT_ROOT'] );
session_start();
include_once ROOT_DIR . '/engine/config.php';
include_once ROOT_DIR . '/engine/func.php';
}
if ( !isset( $_SESSION['id'] ) ) {
echo '<div class="error" style="width: 90%; margin: 10px auto; text-align: center"><b>Ошибка!</b> Вы не авторизированы.<br />Пожалуйста, воспользуйтесь формой авторизации.</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'] ) . '';
}
$user_set = $pdo->Query("SELECT * from php_user WHERE id = '" . $_SESSION['id'] . "'")->fetch(PDO::FETCH_BOTH);
?>
<div class="big_topics bor_top round3 FFF hr">
<div class="wrap_user_r">
<?
include_once ROOT_DIR . '/modules/message/menu.php';
$check_read = mysql_query( "SELECT * FROM php_messages WHERE (to_id = '" . ( int ) $_GET['id'] . "' and from_id = '" . $_SESSION['id'] . "' and m_state = 'outbox' and to_del = 0) or (to_id = '" . $_SESSION['id'] . "' and from_id = '" . ( int ) $_GET['id'] . "' and m_state = 'inbox' and from_del = 0) ORDER BY data ASC" );
if ( mysql_num_rows( $check_read ) > 0 ) {
?>
<div class="wrap_read_mess" style="overflow: hidden; height: inherit; border-bottom: none;">
<?
while ( $get_mess_row = mysql_fetch_array( $check_read ) ) {
$info_from_id = mysql_fetch_array( mysql_query( "SELECT login FROM php_user WHERE id = '" . $get_mess_row['from_id'] . "' LIMIT 1" ) );
/*---формируем дату сообщения---*/
$month = array( 'янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек' );
if ( date( 'd.m.Y', $get_mess_row['data'] ) == date( 'd.m.Y', time() ) ) {
$mess_time = 'сегодня в ' . date( 'H:i', $get_mess_row['data'] );
} else
if ( date( 'd.m.Y', $get_mess_row['data'] ) == date( 'd.m.Y', time() - 86400 ) ) {
$mess_time = 'вчера в ' . date( 'H:i', $get_mess_row['data'] );
} else {
$mess_time = ( int ) date( 'd', $get_mess_row['data'] ) . ' ' . $month[( int ) date( 'm', $get_mess_row['data'] ) - 1] . ' ' . date( 'Y', $get_mess_row['data'] ) . ' в ' . date( 'H:i', $get_mess_row['data'] );
}
?>
<div class="wrap_in_mess"><div class="in_mess_text"><div class="us_name_mess"><?=$info_from_id['login']?></div><?=$get_mess_row['text']?><div class="time_mess"><?=$mess_time?></div></div></div>
<?
}
?>
</div>
<?
} else {
echo '<div style="text-align:center; margin-top:56px; padding:20px 10px; font-weight:bold; color:#999999;">Сообщений не найдено.</div>';
}
}
?>
</div>
</div>