View file user/in_mess.php

File size: 1.28Kb
<?php
$fp = fopen ($cms.'user/'.$_SESSION['user_login'].'/mess_stat.txt', "w+");
fwrite ($fp, '');
fclose ($fp);

if (filesize($cms.'user/'.$_SESSION['user_login'].'/mess_in.txt') == 0) echo 'Писем нет';
else
	 {
			    $st_r = $cgf_ind_mess;
			    // столько выводим



			if (is_file($cms.'user/'.$_SESSION['user_login'].'/mess_in.txt')) $post = @file($cms.'user/'.$_SESSION['user_login'].'/mess_in.txt'); else echo 'Ошибка';

			$count_post = count($post);

			if (empty($_GET['postpages'])) {
			    $pages = 1;
			} else {
			    $pages = (int) $_GET['postpages'];
			}

			$j = ($count_post-1)-(($pages-1)*$st_r);
			$i = $j-$st_r;
			for(; $i<$j && $j>=0; $j--)
			{
			$fn = explode("|",$post[$j]);

			echo '

<div class="mess1"><div class="user_name">'.$fn[0].' - <a href="/?page=anketa&log_in='.$fn[1].'">'.$fn[1].'</a></div></div>
<div class="mess2">'.$fn[2].'</div>
          <hr>
			     ';


			}
			echo 'Страницы:&nbsp;'."\n";
			$all = ceil($count_post/$st_r);
			 for ($i=1;$i<=$all;$i++) {
			     if ($pages==$i) {
			        echo '<b>'.$i.'</b> ';
			    } else {
			        echo '<a href="/?page='.$_GET['page'].'&mess_id='.$_GET['mess_id'].'&postpages='.$i.'">'.$i.'</a> '."";
			    }

			 }
	}


?>