View file book/index.php

File size: 2.3Kb
<?php
session_name("SID");
session_start();
include_once "../theme/index.php";
include_once"../conf.php";
include_once"../config.php";
include_once "../template/login2.php";


if (!$_SESSION[uin]=="" && !md5($_SESSION[par])=="" && md5($_SESSION[par])==$provpar && $_SESSION[uin]==$provuin)
{

echo'<br><hr><big><center>ЧAT</center></big>';

$file = @file("book/book.dat");
$file = @array_reverse($file);
if(isset($_GET[page]) && eregi("^[1-9]\$",$_GET[page]))
{$page=$_GET[page];}
else {$page=1;}
$sp = $msg*$page;
$minus = $sp-$msg;
$count = count($file);

for($i=$minus; $i<$sp && $i<$count; $i++){
$dt = explode(":||:",$file[$i]);

$i2=round($i+1); //номер сообщения если надо..

echo'<br>';


$text = @file("../users/$dt[0].log");
if ($text!="")

	$data = explode(":||:",$text[0]);
	$status=trim($data[16]);

$status = str_replace('Недоступен','<img src="../img/status/stop.png" align="absmiddle"> ',$status);
$status = str_replace('Отсутствую','<img src="../img/status/away.png" align="absmiddle"> ',$status);
$status = str_replace('Занят','<img src="../img/status/bisy.png" align="absmiddle"> ',$status);
$status = str_replace('Онлайн','<img src="../img/status/on.png" align="absmiddle"> ',$status);
$status = str_replace('Оффлайн','<img src="../img/status/off.png" align="absmiddle"> ',$status);

echo $status;

if($dt[1]!=""){echo'<a href="../anketa.php?uins='.$dt[0].'&amp;'.SID.'"><font color="#ee1111"><b>'.$dt[1].' </b></font></a>
				<font color="bbbbbb">('.$dt[3].')</font><br>'.$dt[2].'<br>';
}else{
		echo'<a href="../anketa.php?uins='.$dt[0].'&amp;'.SID.'"><font color="#ee1111"><b>'.$dt[0].' </b></font></a>
			<font color="999999">('.$dt[3].')</font><br>'.$dt[2].'<br>'; 
	}}
echo'<hr>';
if($page>1) echo'<a href="index.php?page='.($page-1).'"><< </a>|';
if(count($file)>$sp) echo'<a href="index.php?page='.($page+1).'"> >></a><br>';
##############

echo'<br><form action="add.php?'.SID.'" method="post">
	Сообщение:<br><br>
	<textarea name="mess" cols="30" rows="3"></textarea><br><br>
	<input type="submit" value="Отправить!"></form>';

echo'<br><a href="smiles.php?'.SID.'">Cмайлы</a><br>';

}else{
header ("Location: ../index.php?".SID);
}

include_once "../theme/foot.php";

?>