<?php define('_IN_JOHNCMS', 1); $rootpath = '../'; $textl = 'Mening mehmonlarim'; require_once ($rootpath . "incfiles/core.php"); require_once ($rootpath . "incfiles/head.php"); // Проверка юзера if (!$user_id) { echo display_error('Faqat sayt a\'zolariga!<br />Saytga <a href="' .$home. '/registration.php">a\'zo bo\'ling</a> yoki <a href="' .$home. '/login.php">saytga kiring</a>!'); require_once ($rootpath . "incfiles/end.php"); exit; } $act = isset($_GET['act']) ? $_GET['act'] : ''; switch ($act) { default: echo '<div class="phdr"><b>Mening mehmonlarim</b></div>'; $g_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `my_guests` WHERE `my_id` = '" . $user_id . "';"), 0); if ($g_count > 0) { $p_ank = mysql_result(mysql_query("SELECT `prosm_ank` FROM `users` WHERE `id` = '" . $user_id . "';"), 0); echo '<div class="menu">Barcha mehmonlar: [' . $g_count . ']<br />'; echo 'Anketa ko`rilgan: [' . $p_ank . ']</div>'; $req = mysql_query("SELECT `my_guests`.*, `users`.`name`, `users`.`sex`, `users`.`datereg`, `users`.`lastdate` FROM `my_guests` LEFT JOIN `users` ON `my_guests`.`guest_id` = `users`.`id` WHERE `my_guests`.`my_id` = '" . $user_id . "' ORDER BY `my_guests`.`time` DESC LIMIT " . $start . ", " . $kmess . ";"); while ($res = mysql_fetch_assoc($req)) { echo $i % 2 ? '<div class="list1">' : '<div class="list2">'; //Значек пола if ($res['sex']) { echo '<img src="' . $home . '/theme/' . $set_user['skin'] . '/images/' . ($res['sex'] == 'm' ? 'm' : 'w') . ($res['datereg'] > $realtime - 86400 ? '_new' : '') . '.png" width="16" height="16" style="vertical-align:middle;" alt="' . ($res['sex'] == 'm' ? 'М' : 'Ж') . '" /> '; } else { echo '<img src="' . $home . '/images/del.png" width="12" height="12" style="vertical-align:middle;" alt="' . ($res['sex'] == 'm' ? 'М' : 'Ж') . '" /> '; } //Ник echo '<b><span style="color:' . ($res['sex'] == 'm' ? '#00f' : '#90f') . ';"><a href="' . $home . '/users/profile.php?user=' . $res['guest_id'] . '">' . $res['name'] . '</a></span></b> '; //Онлайн/оффлайн echo ($realtime > $res['lastdate'] + 300 ? '<span class="red"> [Off]</span> ' : '<span class="green"> [ON]</span> '); //Время /* echo (date("d", $res['time']) == date("d", $realtime) ? '(' . date("H:i", $res['time']) . ')' : '(' . date("d/m", $res['time']) . ')'); //Новый гость или нет if ($res['type'] == '0') { echo '<span class="red"><b>new!</b></span><br />'; @mysql_query("UPDATE `my_guests` SET `type` = '1' WHERE `id` = '" . $res['id'] . "';"); } else { echo '<br />'; }*/ //Время echo '<div class="fr">'; //Новый гость или нет if ($res['type'] == '0') { echo '<span style=color:red>'; echo ''.functions::display_date($res['time']).''; echo '<span>'; @mysql_query("UPDATE `my_guests` SET `type` = '1' WHERE `id` = '" . $res['id'] . "';"); } else { echo '<span style=color:gray>'; echo ''.functions::display_date($res['time']).''; echo '<span>'; } echo '</div>'; //Ссылки echo '<span style="float: right; padding: 6px;"> <a href="../mail/index.php?act=write&id=' . $res['guest_id'] . '"><img src="//quvnoq.com/images/sms.png" /></a></span>'; echo '</div>'; ++$i; } //Постраничная навигация if ($g_count > $kmess) { echo '<div class="phdr"><p>Sahifa:<br />' . pagenav('my_guests.php?', $start, $g_count, $kmess) . '</p></div>'; } echo '<div class="menu">» <a href="my_guests.php?act=del">Mehmonlar ro`yhatini tozalash</a></div>'; echo '<div class="menu">» <a href="my_guests.php?act=sbros">Anketa ko`rilganini tozalash</a></div>'; } else { echo '<div class="menu"><b>Xozircha mehmonlar yo`q!</b></div>'; } break; case 'del': //Очистка списка гостей if (isset($_GET['yes'])) { @mysql_query("DELETE FROM `my_guests` WHERE `my_id` = '" . $user_id . "';"); echo '<div class="phdr"><b>Mehmonlar ro`yhatini tozalash</b></div>'; echo '<div class="gmenu"><b>Mehmonlar ro`yhati muvoffaqiyatli tozalandi!</b></div>'; echo '<div class="menu">» <a href="profile.php?">Anketaga</a></div>'; } else { echo '<div class="phdr"><b>Mehmonlar ro`yhatini tozalash</b></div>'; echo '<div class="gmenu">Mehmonlar ro`yhati tozalashni istaysizmi?</div>'; echo '<div class="menu"> <a href="my_guests.php?act=del&yes">Xa</a> | <a href="my_guests.php?">Yo`q</a></div>'; } break; case 'sbros': //Anketa ko`rilganini tozalash if (isset($_GET['yes'])) { @mysql_query("UPDATE `users` SET `prosm_ank` = '0' WHERE `id` = '" . $user_id . "';"); echo '<div class="phdr"><b>Hisoblagichni tozalash</b></div>'; echo '<div class="gmenu"><b>Hisoblagichlar muvoffaqiyatli tozalandi!</b></div>'; echo '<div class="menu">» <a href="profile.php?">Anketaga</a></div>'; } else { echo '<div class="phdr"><b>Mehmonlar ro`yhatini tozalash</b></div>'; echo '<div class="gmenu">Mehmonlar hisoblagichini tozalashni istaysizmi?</div>'; echo '<div class="menu"> <a href="my_guests.php?act=sbros&yes">Tozalash</a> | <a href="my_guests.php?">Bekor qilish</a></div>'; } break; } require_once ($rootpath . "incfiles/end.php"); ?>
<?php if ($user['id'] != $user_id){ $g = mysql_result(mysql_query("SELECT * FROM `my_guests` WHERE `my_id` = '" . $user['id'] . "' AND `guest_id` = '" . $user_id . "' LIMIT 1;"), 0); if (!empty($g)) { @mysql_query("UPDATE `my_guests` SET `time` = '" . $realtime . "', `type` = '0' WHERE `my_id` = '" . $user['id'] . "' AND `guest_id` = '" . $user_id . "';"); } else { @mysql_query("INSERT INTO `my_guests` SET `my_id` = '" . $user['id'] . "', `time` = '" . $realtime . "', `guest_id` = '" . $user_id . "', `type` = '0';"); } //Фиксация просмотра анкеты $p_ank = mysql_result(mysql_query("SELECT `prosm_ank` FROM `users` WHERE `id` = '" . $user['id'] . "';"), 0); $i_ank = (int) $p_ank; $r_ank = $i_ank + 1; @mysql_query("UPDATE `users` SET `prosm_ank` = '" . $r_ank . "' WHERE `id` = '" . $user['id'] . "';"); echo '<div class="menu"><p> » <span class="gray">Mehmonlar (' . $r_ank . ')</span></div>'; } else { //Ссылка на страницу гостей для владельца анкеты $all_guests = @mysql_result(@mysql_query("SELECT COUNT(*) FROM `my_guests` WHERE `my_id` = '" . $user_id . "';"), 0); $new_guests = @mysql_result(@mysql_query("SELECT COUNT(*) FROM `my_guests` WHERE `my_id` = '" . $user_id . "' AND `type` = '0';"), 0); echo '<div><img src="../images/546.png" width="16" height="16"/> <a href="' . $home . '/users/my_guests.php?">Мои гости</a> (' . $all_guests . ($new_guests > 0 ? '/<span class="red">' . $new_guests . '</span>' : '') . ')</div>'; } ?>
CREATE TABLE `my_guests` ( `id` int(11) NOT NULL AUTO_INCREMENT, `my_id` int(11) NOT NULL, `time` int(11) NOT NULL, `guest_id` int(11) NOT NULL, `type` set('0','1') NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=7758 DEFAULT CHARSET=utf8;
# BenderCha (18.09.2015 / 20:48) кто то знат