Размер файла: 1.98Kb
<?php
include 'include/head.php';
if(file_exists("letters/$name.class"))
{
$file=file("letters/$name.class");
$count=count($file);
}
else
{
$count = "0";
}
function myhtml($myhtml)
{
$myhtml=str_replace(".ab.","<img src=\"smiles/ab.gif\">",$myhtml);
$myhtml=str_replace(".ac.","<img src=\"smiles/ac.gif\">",$myhtml);
$myhtml=str_replace(".ag.","<img src=\"smiles/ag.gif\">",$myhtml);
$myhtml=str_replace(".ad.","<img src=\"smiles/ad.gif\">",$myhtml);
$myhtml=preg_replace("!(http://[\S]+)([\s]|$)!i","<a href=\"redirect.php?redirect=\\1\">\\1</a> ",$myhtml);
return $myhtml;
}
ob_start(myhtml);
if(empty($name) or empty($pass))
{
echo 'Write name and password!';
echo '<meta http-equiv="refresh" content="2; url=login.php">';
exit;
}
if(file_exists("users/$name.class"))
{
$myFile = "users/$name.class";
$myPass = implode('', file($myFile));
if($myPass == "$pass")
{
echo "<u>Letters</u>($count) / <a href=\"smiles.php?name=$name&pass=$pass\">Smiles</a><br/>";
if(file_exists("letters/$name.class"))
{
$onpage="5";
$allpage=ceil($count/$onpage);
if(empty($page))
{
$page='1';
}
$amsg=$page*$onpage;
$fmsg=$amsg-$onpage;
for($i=$fmsg;$i<$amsg;$i++)
{
if (!empty($file[$i]))
{
$body=explode("messcode",$file[$i]);
$myPost = $body[0];
echo "$myPost<br>";
}
}
if($page!=='1')
{
echo '<a href="?name='.$name.'&pass='.$pass.'&page='.($page-1).'"><<<<</a>';
}
if ($page!=='1' and $page<$allpage)
{
echo ' | ';
}
if ($page<$allpage)
{
echo '<a href="?name='.$name.'&pass='.$pass.'&page='.($page+1).'">>>>></a>';
}
}
else
{
echo '<br/>- No letters!<br/>';
}
echo "<br/><a href=\"sendmess.php?name=$name&pass=$pass\">Write</a> / <a href=\"index.php?name=$name&pass=$pass\">Cabinet</a>";
}
else
{
echo 'Error in password!';
echo '<meta http-equiv="refresh" content="2; url=login.php">';
}
}
else
{
echo 'This user is not exist!';
echo '<meta http-equiv="refresh" content="2; url=login.php">';
}
include 'include/foot.php';
?>