Файл: chats/zags/index.php
Строк: 270
<?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" );
$max = $row['num_msgs'];
$login = $row['login'];
if ( empty( $max ) )
{
$max = 5;
}
switch ( $mod )
{
case "creat" :
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>";
echo "<div align="center">Вы действительно хотите поженитсо с {$to}???</div>";
echo "<form method="post" action="index.php">";
echo "С кем:<br/>";
echo "<input name="to" maxlength="12" value="{$to}"/><br/>";
echo "Ваш Логин:<br/>";
echo "<input name="subject" maxlength="30" value="{$login}"/><br/>";
////echo "<input name="subject" maxlength="30"/value="{$subject}"/><br/>";
echo "Предложение:<br/>";
echo "<input name="text" maxlength="512"/><br/>";
echo "Цвет текста:<br/>";
echo "<select name="col" title="send">";
echo "<option value="0">Системный</option>";
echo "<option value="1">Синий</option>";
echo "<option value="2">Зеленый</option>";
echo "<option value="3">голубой</option>";
echo "<option value="4">коричневый</option>";
echo "<option value="5">Желтый</option>";
echo "<option value="6">Черный</option>";
echo "<option value="7">Красный</option>";
echo "</select><br/>n";
if ( $row['trans'] == 1 )
{
echo "<input name="translit" type="checkbox" value="1">Транслит<br/>";
}
echo "<input type="hidden" name="mod" value="send"/>rn<input type="hidden" name="id" value="{$id}"/>rn<input type="hidden" name="pass" value="{$pass}"/> rn<input value="Отправить" type="submit" class="cp">rn</form>";
///<form action=./expr/warn.php>
///<input type=submit name="doGo" value="Click!">
///</form>
break;
case "send" :
echo "<meta http-equiv="refresh" content="1;URL=../enter.php?id={$id}&pass={$pass}"/>";
echo "<title>Sending...</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( $to ) )
{
echo "<div>Кому письмо? :)</div>";
break;
}
else
{
{
if ( empty( $text ) )
{
echo "<div>Напиши хоть пару строчек своей половинке!</div>";
break;
}
else
{
$to = check( $to );
$q = @mysql_query( @"select id from users where login='".$to."';" );
if ( @( mysql_num_rows( @$q ) == 0 ) )
{
echo "<div>Такого юзера не существует!</div>";
break;
}
else
{
$data = mysql_fetch_array( $q );
$to = $data['id'];
$subject = check( $subject );
$text = check( $text );
$subject = substr( $subject, 0, 60 );
$text = substr( $text, 0, 1024 );
if ( $col == "1" )
{
$text = "<font color=blue>".$text."</font>";
}
else if ( $col == "2" )
{
$text = "<font color=lime>".$text."</font>";
}
else if ( $col == "3" )
{
$text = "<font color=aqua>".$text."</font>";
}
else if ( $col == "4" )
{
$text = "<font color=maroon>".$text."</font>";
}
else if ( $col == "5" )
{
$text = "<font color=yellow>".$text."</font>";
}
else if ( $col == "6" )
{
$text = "<font color=black>".$text."</font>";
}
else if ( $col == "7" )
{
$text = "<font color=red>".$text."</font>";
}
$login = $row['login'];
if ( mysql_query( "Insert into zags set id=0, login='".$login."',topic='".$subject."', msg='".$text."', id_from='".$id."', id_to='{$to}', wtime='".time( )."', new=1, del_in=0, del_out=0" ) )
{
echo "<div>Ваше предложение успешно отправлено!</div>";
break;
}
else
{
echo "<div>Ошибка...</div>";
break;
}
}
}
}
}
case "in" :
$q = mysql_query( "select id from zags where id_to='{$id}' and del_in=0;" );
$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 )
{
echo "<div>Пака вам никто не зделал предложение</div>";
break;
}
else
{
echo "<div>Вам зделали предложение поженитсо! Уже[{$num}] человек</div>";
}
$s = intval( $s );
if ( $s < 0 )
{
$s = 0;
}
$i = $s;
$res = mysql_query( "select id,login,topic,wtime,new from zags where id_to='{$id}' and del_in=0 order by wtime desc limit {$s},{$max}" );
while ( $lett = mysql_fetch_array( $res ) )
{
++$i;
$lid = $lett['id'];
$from = $lett['login'];
$subject = $lett['topic'];
$time = date( "H:i", $lett['wtime'] );
$new = $lett['new'];
if ( $new == 1 )
{
echo "<b>{$i}.r<a href="index.php?id={$id}&pass={$pass}&mod=view&lid={$lid}&ref={$ref}">{$subject}</a>r({$from})</b><br/>";
}
else
{
echo "<b>{$i}.</b> <a href="index.php?id={$id}&pass={$pass}&mod=view&lid={$lid}&ref={$ref}">{$subject}</a>r({$from})<br/>";
}
}
if ( $s + $max < $num )
{
print "<a href="index.php?id={$id}&pass={$pass}&mod={$mod}&s=".( $s + $max )."">Следующие</a><br/>";
break;
}
case "out" :
$q = mysql_query( "select id from zags where id_from='{$id}' and del_out=0;" );
$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 )
{
///echo "<div>У вас нет исходящих писем</div>";
break;
}
else
{
echo "<div>Вы уш зделали [{$num}] предложений</div>";
}
$s = intval( $s );
if ( $s < 0 )
{
$s = 0;
}
$i = $s;
$res = mysql_query( "select id,topic,wtime,new from zags where id_from='{$id}' and del_out=0 order by wtime desc limit {$s},{$max}" );
while ( $lett = mysql_fetch_array( $res ) )
{
$lid = $lett['id'];
$subject = $lett['topic'];
$time = date( "H:i", $lett['wtime'] );
$new = $lett['new'];
++$i;
echo "<b>{$i}.</b>r<a href="index.php?id={$id}&pass={$pass}&mod=view&lid={$lid}&ref={$ref}">{$subject}</a>r({$time})<br/>";
}
if ( $s + $max < $num )
{
print "<a href="index.php?id={$id}&pass={$pass}&mod={$mod}&s=".( $s + $max )."">Следующие</a><br/>";
break;
}
case "view" :
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>";
$lid = intval( $lid );
$q = mysql_query( "select * from zags where id='{$lid}'" );
$lett = @mysql_fetch_array( @$q );
$to = $lett['id_to'];
$from = $lett['id_from'];
if ( $id != $to && $id != $from )
{
echo "<div>Это письмо не для вас!</div>";
break;
}
else
{
if ( $id == $to )
{
mysql_query( "update zags set new=0 where id='{$lid}'" );
}
$from = $lett['login'];
$subject = $lett['topic'];
$text = $lett['msg'];
$time = date( "[H:i - d.m]", $lett['wtime'] );
echo "<div>Предложение от <b>{$from}</b></div>";
echo "Его ник: <u>{$subject}</u><br/>";
echo "Дата: {$time}<br/>";
echo "{$subject} предлогает вам руку и сердце:<br/>{$text}";
echo "<br/>---<br/>";
///echo "<a href="index.php?id={$id}&pass={$pass}&mod=creat&to={$from}&ref={$ref}">Подтвердить</a><br/>";
echo "<a href="da.php?id={$id}&pass={$pass}&mod=creat&to={$from}&ref={$ref}">Подтвердить</a><br/>";
echo "<a href="index.php?id={$id}&pass={$pass}&mod=del&lid={$lid}&ref={$ref}">Послать подальше</a><br/>---";
break;
}
case "del" :
echo "<meta http-equiv="refresh" content="1;URL=./index.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>";
$lid = intval( $lid );
$q = mysql_query( "select id_to,id_from from zags where id='{$lid}'" );
$lett = @mysql_fetch_array( @$q );
$to = $lett['id_to'];
$from = $lett['id_from'];
if ( $id == $to )
{
mysql_query( "update zags set del_in=1 where id='{$lid}'" );
}
if ( $id == $from )
{
mysql_query( "update zags set del_out=1 where id='{$lid}'" );
}
mysql_query( "delete from zags WHERE (del_in = '1')and(del_out = '1')" );
mysql_query( "OPTIMIZE TABLE `zags`" );
break;
case "delall" :
echo "<meta http-equiv="refresh" content="1;URL=./index.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( "update zags set del_in=1 where id_to='{$id}'" );
mysql_query( "update zags set del_out=1 where id_from='{$id}'" );
mysql_query( "delete from zags WHERE (del_in = '1')and(del_out = '1')" );
mysql_query( "OPTIMIZE TABLE `zags`" );
break;
default :
mysql_query( "DELETE FROM `zags` WHERE `wtime` < ".( time( ) - 604800 ).";" );
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>";
echo "<div>Предложение хранятся не более недели!</div>n";
echo "<a href="da.php?id={$id}&pass={$pass}&mod=creat&to={$from}&ref={$ref}">Подтвердить</a><br/>";
$q1 = mysql_query( "select id from zags where id_to='{$id}' and new=1 and del_in=0;" );
$in1 = mysql_num_rows( $q1 );
$q2 = mysql_query( "select id from letters where id_to='{$id}' and del_in=0;" );
$in2 = mysql_num_rows( $q2 );
$q3 = mysql_query( "select id from zags where id_from='{$id}' and del_out=0;" );
$in3 = mysql_num_rows( $q3 );
////echo "<a href="index.php?id={$id}&pass={$pass}&mod=in&ref={$ref}">Ваши любовники ({$in1}/{$in2})</a><br/>rn<a href="index.php?id={$id}&pass={$pass}&mod=out&ref={$ref}">Ваши избранники ({$in3})</a><br/>rn<a href="index.php?id={$id}&pass={$pass}&mod=creat&ref={$ref}">Зделать предложение</a><br/>rn---<br/>rn<a href="index.php?id={$id}&pass={$pass}&mod=delall&ref={$ref}">Полный развод наф</a><br/>";
break;
}
echo "---<br/>";
if ( isset( $mod ) )
{
///echo "<a href="index.php?id={$id}&pass={$pass}&ref={$ref}">Письма</a><br/>";
}
$end = gettime( );
echo "<a href="../my/index.php?id={$id}&pass={$pass}&ref={$ref}">Личное</a><br/>rn<a href="../enter.php?id={$id}&pass={$pass}&ref={$ref}">Прихожая</a><br/>rn<p align="center">rn[".round( $end - $mystart, 5 )."]";echo "<div class="ab"><b>© KOT <a href="http://waufon.ru">waufon.ru</a></b></div>";
print "</p></body></html>";
mysql_close( $link );
?>