<?php

// mod by Defast
// ICQ: 529-68-36

include '../system/start.php';
include '../system/functions.php';

reg();

$str['mesto'] = 'Форум';
$str['block'] = $set['site'].' / Форум ';
include '../style/'.$style.'/head.php';

switch($act) {
	// Просмотр своих сообщений
	case 'message':
		echo '<div class="where">Просмотр своих сообщений</div>';
		
		$r = mysql_query("SELECT * FROM `forum_posts` WHERE `login` = '" . $user['login'] . "' ORDER by `time` DESC LIMIT " . $page . "," . $set['str'] . "");
		$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_posts` WHERE `login` = '" . $user['login'] . "'"), 0);
		
		while ($e = mysql_fetch_assoc($r)) {
			echo ($i % 2) ? '<div class="forum2">' : '<div class="forum1">';
			$theme = mysql_fetch_assoc(mysql_query("SELECT `title` FROM `forum_topics` WHERE `id` = '" . $e['id_topic'] . "'"));
			echo '<a href="topic.php?id=' . $e['id_topic'] . '">' . $theme['title'] . '</a> (' . clock($e['time']) . ')<br />
			' . text($e['text']);
			echo '</div>';
			$i++;
		}
		
		if($total > $set['str'])
			pages($page, $total, 'look.php?act=message&amp;', $set['str']);
	break;
	
default :
	header("Location: index.php");
}

include '../style/'.$style.'/foot.php';
?>