Файл: chats/my/drug.php
Строк: 157
<?php
//////////////////////////////////////////
// CHAT POWERED : http://sim-sim.h2m.ru//
// ICQ : 378036650 //
// Email : olegarhi75@mail.ru //
// WEB SITE Version 1.0 www.waufon.ru //
////////////////////////////////////////
require( "../inc/conf.inc.php" );
require( "../inc/check.php" );
$login = autorize();
$sound = $login['sound'] ;
$max = $row['num_msgs'];
if ( empty( $max ) )
{
$max = 5;
}
switch ( $mod )
{
case "addus" :
echo "<title>Список друзей</title>";
echo "<style type="text/css">";
echo "body { font-size: {$fs}; color: {$tcol}; background-color: {$bcol} }";
echo "a:link,a:visited { text-decoration: underline; color: {$lcol} }";
echo "div { border-style:solid; border-width: 1px; background-color: {$rcol} }";
echo ".cp { border-style:solid; border-width: 0px; color: {$lcol} ; background-color: {$bcol}; text-align: left }";
echo "</style>";
echo "</head>";
echo "<body>";
if($sound=="1")
{
echo "<!--h--><!--h--><a><bgsound src="../sound/ok.wav"></br>";
}
echo "<div align="center">Добавить в список Ваших друзей</div>";
echo "<form method="post" action="drug.php">";
echo "Кого:<br/>";
echo "<input name="usid" maxlength="24" value="{$to}"/><br/>";
if ( $row['trans'] == 1 )
{
echo "<input name="translit" type="checkbox" value="1">Транслит<br/>";
}
echo "<input type="hidden" name="mod" value="adding"/>rn";
echo"<input type="hidden" name="id" value="{$id}"/>rn";
echo"<input type="hidden" name="pass" value="{$pass}"/>rn";
echo"<input value="Добавить в список" type="submit" class="cp">rn</form>";
##############
break;
case "adding" :
echo "<meta http-equiv="refresh" content="1;URL=drug.php?id={$id}&pass={$pass}"/>";
echo "<title>Добавление...</title>";
echo "<style type="text/css">";
echo "body { font-size: {$fs}; color: {$tcol}; background-color: {$bcol}; text-align: center }";
echo "a:link,a:visited { text-decoration: underline; color: {$lcol} }";
echo "div { border-style:solid; border-width: 1px; background-color: {$rcol} }";
echo "</style>";
echo "</head>";
echo "<body>";
#################*/
if ( empty( $usid ) )
{
echo "<div>Кого добавим в список друзей? :)</div>";
}
else
{
$usid = check( $usid );
$q = @mysql_query( "select id, login from users where login='".$usid."';" );
if ( mysql_num_rows( $q ) == 0 )
{
echo "<div>Такого юзера не существует!</div>";
}
else
{
$data = mysql_fetch_array( $q );
$usid = $data['id'];
$login = $data['login'];
if ( mysql_query( "Insert into friends set login='".$login."', id='".$id."', usid='".$usid."' ;" ) )
{
echo "<div>Пользователь успешно добавлен!</div>";
}
else
{
echo "<div>Ошибка...</div>";
}
}
}
break;
case "list" :
$q = mysql_query( "select usid from friends where id='{$id}' ;" );
$num = mysql_num_rows( $q );
echo "<title>Список друзей</title>";
echo "<style type="text/css">";
echo "body { font-size: {$fs}; color: {$tcol}; background-color: {$bcol} }";
echo "a:link,a:visited { text-decoration: underline; color: {$lcol} }";
echo "div { border-style:solid; border-width: 1px; background-color: {$rcol}; text-align: center }";
echo "</style>";
echo "</head>";
echo "<body>n";
if ( $num == 0 )
{
if($sound=="1")
{
echo "<!--h--><!--h--><a><bgsound src="../sound/owibka.wav"></br>";
}
echo "<div>список пуст</div>";
echo "<a href="drug.php?id={$id}&pass={$pass}&ref={$ref}">Назад</a><br/>";
break;
}
else
{
echo "<div>колличество Ваших друзей ({$num})</div>";
}
$s = intval( $s );
if ( $s < 0 )
{
$s = 0;
}
$i = $s;
$res = mysql_query( "select * from friends where id='{$id}' order by usid desc limit {$s},{$max}" );
while ( $drug = mysql_fetch_array( $res ) )
{
++$i;
$drugid = $drug['id'];
$from = $drug['login'];
$tid = $drug['tid'];
$time = date( "H:i", $drug['wtime'] );
echo "<b>{$i}.</b> <b>{$from}</b>r<a href="drug.php?id={$id}&pass={$pass}&mod=del&tid={$tid}&drugid={$drugid}&ref={$ref}">(<b>X</b>)</a><br/>";
}
echo "<a href="drug.php?id={$id}&pass={$pass}&ref={$ref}">Назад</a><br/>";
if ( !( $s + $max < $num ) )
{
break;
}
print "<a href="index.php?id={$id}&pass={$pass}&mod={$mod}&s=".( $s + $max )."">Следующие</a><br/>";
break;
case "del" :
echo "<meta http-equiv="refresh" content="1;URL=./drug.php?id={$id}&pass={$pass}"/>";
echo "<title>Deleting...</title>";
echo "<style type="text/css">";
echo "body { font-size: {$fs}; color: {$tcol}; background-color: {$bcol}; text-align: center }";
echo "a:link,a:visited { text-decoration: underline; color: {$lcol} }";
echo "div { border-style:solid; border-width: 1px; background-color: {$rcol} }";
echo "</style>";
echo "</head>";
echo "<body><div>Пользователь удалён из списка</div>";
$drugid = intval( $drugid );
$q = mysql_query( "select usid,id from friends where id='{$drugid}'" );
$drug = @mysql_fetch_array( $q );
$usid = $drug['usid'];
$id = $drug['id'];
mysql_query( "delete from friends WHERE usid = '{$usid}'" );
break;
case "delall" :
echo "<meta http-equiv="refresh" content="1;URL=drug.php?id={$id}&pass={$pass}"/>";
echo "<title>Deleting...</title>";
echo "<style type="text/css">";
echo "body { font-size: {$fs}; color: {$tcol}; background-color: {$bcol}; text-align: center }";
echo "a:link,a:visited { text-decoration: underline; color: {$lcol} }";
echo "div { border-style:solid; border-width: 1px; background-color: {$rcol} }";
echo "</style>";
echo "</head>";
echo "<body><div>Список очищен!</div>";
mysql_query( "delete from friends WHERE id = '{$id}'" );
mysql_query( "OPTIMIZE TABLE `friends`" );
break;
default :
echo "<title>Список друзей</title>";
echo "<style type="text/css">";
echo "body { font-size: {$fs}; color: {$tcol}; background-color: {$bcol} }";
echo "a:link,a:visited { text-decoration: underline; color: {$lcol} }";
echo "div { border-style:solid; border-width: 1px; background-color: {$rcol}; text-align: center }";
echo "</style>";
echo "</head>";
echo "<body>";
if($sound=="1")
{
echo "<!--h--><!--h--><a><bgsound src="../sound/info.wav"></br>";
}
echo "<div>Список друзей</div>n";
$q = mysql_query( "select usid from friends where id='{$id}' ;" );
$num = mysql_num_rows( $q );
echo "<a href="drug.php?id={$id}&pass={$pass}&mod=list&ref={$ref}">Список друзей ({$num})</a><br/>rn---<br/>rn<a href="drug.php?id={$id}&pass={$pass}&mod=addus&ref={$ref}">Добавить в список</a><br/>rn<a href="drug.php?id={$id}&pass={$pass}&mod=delall&ref={$ref}">Очистить весь список</a><br/>";
break;
}
echo "---<br/>";
$end = gettime( );
echo "<a href="index.php?id={$id}&pass={$pass}&ref={$ref}">Кабинет</a><br/>";
echo"<a href="../enter.php?id={$id}&pass={$pass}&ref={$ref}">Прихожая</a><br/>rn<p align="center">rn[".round( $end - $mystart, 5 )."]";
require("../inc/coper.php");
print "</p></body></html>";
mysql_close( $link );
?>