Размер файла: 8.4Kb
<?php
####################
# Автор: [Svig] #
# ICQ: 563000172 #
####################
$sms = "sms";
if($_GET['mode']==$sms)
{
include ("conf.php");
include ("lock.php");
if ($user == $myrow["user"] && $pass == $myrow["pass"])
{
$num = 10;
@$page = $_GET['page'];
$result00 = mysql_query("SELECT COUNT(*) FROM messages WHERE user_name='$user'");
$temp = mysql_fetch_array($result00);
$posts = $temp[0];
$total = (($posts - 1) / $num) + 1;
$total = intval($total);
$page = intval($page);
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
$result2 = mysql_query ("select * from messages where user_name='$user' order by id desc LIMIT $start, $num");
$result3 = mysql_query ("select * from messages where user_name='$user'");
if (mysql_num_rows($result3) > 0)
{
$myrow2 = mysql_fetch_array($result2);
$new = $myrow2['new'] - 1;
$update = mysql_query ("UPDATE messages SET new='$new' WHERE user_name='$user'",$db);
include ("head.php");
do {
include ("smiles/smiles.php");
echo "<div class='nav'>";
echo "От: [<a href='info.php?user=$user&pass=$pass&id=".$myrow2['id_user']."'>".$myrow2['ot_user']."</a>] |<small> ".$myrow2['date']." </small><br />";
echo " ".$myrow2['text']." <br />(<a href='messages.php?mode=del&user=$user&pass=$pass&ids=".$myrow2['id']."'><font color='red'>del</font></a>)<br />";
echo "</div>";
}
while ($myrow2 = mysql_fetch_array($result2));
echo "<div class='nav'>";
if ($page != 1) echo "<a href=messages.php?mode=sms&user=$user&pass=$pass&page=".($page - 1).">Назад</a>";
if ($page != $total) echo " <a href=messages.php?mode=sms&user=$user&pass=$pass&page=".($page + 1).">Далее</a>";
echo "</div>";
}
else
{
include ("head.php");
echo "<div class='nav'>";
echo "Сообщений нет!<br />";
echo "</div>";
echo "<div class='nav'>";
echo "• <a href=menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
include ("foot.php");
exit();
}
echo "<div class='nav'>";
echo "• <a href=menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
include ("foot.php");
exit();
}
else
{
include ("head.php");
echo "<div class='nav'>";
echo "Ошибка! <br />Неверный <b>Ник</b> или <b>Пароль</b>!<br />";
echo "</div>";
echo <<<sss
<div class='nav'>
<a href="index.php">На главную</a>
</div>
sss;
include ("foot.php");
}
}
$add2 = "add2";
if($_GET['mode']==$add2)
{
include ("conf.php");
include ("lock.php");
if ($user == $myrow["user"] && $pass == $myrow["pass"])
{
$users = htmlspecialchars(mysql_real_escape_string(trim($_GET['users']))); if ($users == ''){unset($users); }
include ("head.php");
echo "<div class='nav'>";
echo <<<sss
<form name="form" action="messages.php?mode=s&user=$user&pass=$pass" method="post">
sss;
echo "Кому: ".$users."<br />
<input name='user_name' type='hidden' value='".$users."'>";
echo <<< sss
Сообщение:<br/>
<textarea rows="3" cols="19" name="text"></textarea><br/>
<input name='sub_com' type='submit' value='Отправить'></form>
sss;
echo "</div>";
echo "<div class='nav'>";
echo "• <a href=smile.php?user=$user&pass=$pass>Смайлы</a><br />";
echo "• <a href=menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
include ("foot.php");
exit();
}
else
{
include ("head.php");
echo "<div class='nav'>";
echo "Ошибка! <br />Неверный <b>Ник</b> или <b>Пароль</b>!<br />";
echo "</div>";
echo <<<sss
<div class='nav'>
<a href="index.php">На главную</a>
</div>
sss;
include ("foot.php");
exit();
}
}
$add = "add";
if($_GET['mode']==$add)
{
include ("conf.php");
include ("lock.php");
if ($user == $myrow["user"] && $pass == $myrow["pass"])
{
include ("head.php");
echo "<div class='nav'>";
echo <<<sss
<form name="form" action="messages.php?mode=s&user=$user&pass=$pass" method="post">
Кому:<br />
<input name="user_name" type="text" value=""><br />
Сообщение:<br/>
<textarea rows="3" cols="19" name="text"></textarea><br/>
<input name='sub_com' type='submit' value='Отправить'></form>
sss;
echo "</div>";
echo "<div class='nav'>";
echo "• <a href=smile.php?user=$user&pass=$pass>Смайлы</a><br />";
echo "• <a href=menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
include ("foot.php");
}
else
{
include ("head.php");
echo "<div class='nav'>";
echo "Ошибка! <br />Неверный <b>Ник</b> или <b>Пароль</b>!<br />";
echo "</div>";
echo <<<sss
<div class='nav'>
<a href="index.php">На главную</a>
</div>
sss;
include ("foot.php");
}
}
$s = "s";
if($_GET['mode']==$s)
{
include ("conf.php");
include ("lock.php");
if ($user == $myrow["user"] && $pass == $myrow["pass"])
{
$id_user = $myrow["id"];
$user_name = htmlspecialchars(mysql_real_escape_string(trim($_POST['user_name']))); if ($user_name == ''){unset($user_name); }
$text = htmlspecialchars(mysql_real_escape_string(trim($_POST['text']))); if ($text == ''){unset($text); }
$new = 1;
$date = date("Y-m-d");
$result3 = mysql_query("INSERT INTO messages (user_name,ot_user,text,date,id_user,new) VALUES ('$user_name','$user','$text','$date','$id_user','$new')");
if (isset($text) and isset($user_name))
{
if ($result3 == 'true')
{
include ("head.php");
echo "<div class='nav'>";
echo "Сообщение отправлено!";
echo "</div>";
echo "<div class='nav'>";
echo "• <a href=menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
include ("foot.php");
}
}
else
{
include ("head.php");
echo "<div class='nav'>Ошибка! Сообщение не отправлено!</div>";
echo "<div class='nav'>";
echo "• <a href=menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
include ("foot.php");
}
}
else
{
include ("head.php");
echo "<div class='nav'>";
echo "Ошибка! <br />Неверный <b>Ник</b> или<b>Пароль</b>!<br /></div>";
echo "<div class='nav'><a href='index.php'>На главную</a></div>";
include ("foot.php");
}
}
$del = "del";
if($_GET['mode']==$del)
{
include ("conf.php");
include ("lock.php");
if ($user == $myrow["user"] && $pass == $myrow["pass"])
{
$ids = htmlspecialchars(mysql_real_escape_string(trim($_GET['ids']))); if ($ids == ''){unset($ids); }
$result3 = mysql_query("DELETE FROM messages WHERE id='".$ids."'");
if ($result3 == 'true')
{
include ("head.php");
echo "<div class='nav'>";
echo "Сообщение Удалено!";
echo "</div>";
echo "<div class='nav'>";
echo "• <a href=menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
include ("foot.php");
exit();
}
else
{
include ("head.php");
echo "<div class='nav'>Ошибка! Сообщение не Удалено!</div>";
echo "<div class='nav'>";
echo "• <a href=menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
include ("foot.php");
exit();
}
}
else
{
include ("head.php");
echo "<div class='nav'>";
echo "Ошибка! <br />Неверный <b>Ник</b> или<b>Пароль</b>!<br /></div>";
echo "<div class='nav'><a href='index.php'>На главную</a></div>";
include ("foot.php");
}
}
$adminu = "adminu";
if($_GET['mode']==$adminu)
{
include ("conf.php");
include ("lock.php");
if ($user == $myrow["user"] && $pass == $myrow["pass"])
{
include ("head.php");
echo "<div class='nav'>";
echo <<<sss
<form name="form" action="messages.php?mode=s&user=$user&pass=$pass" method="post">
sss;
echo "<input name='user_name' type='hidden' value='".$adname."'>";
echo <<< sss
Здесь вы можете отправить ваше сообщение <b>Администратору</b>!<br /><br />
Сообщение:<br/>
<textarea rows="3" cols="19" name="text"></textarea><br/>
<input name='sub_com' type='submit' value='Отправить'></form>
sss;
echo "</div>";
echo "<div class='nav'>";
echo "• <a href=smile.php?user=$user&pass=$pass>Смайлы</a><br />";
echo "• <a href=menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
include ("foot.php");
exit();
}
else
{
include ("head.php");
echo "<div class='nav'>";
echo "Ошибка! <br />Неверный <b>Ник</b> или <b>Пароль</b>!<br />";
echo "</div>";
echo <<<sss
<div class='nav'>
<a href="index.php">На главную</a>
</div>
sss;
include ("foot.php");
exit();
}
}
?>