Вход Регистрация
Файл: gorod/zags.php
Строк: 128
<?php

#############################################
# Автор: Anv@r.all    #  Moded by: Anvar    #
#                     # Web: http://apwa.ru #
#   apwa.ru           # DATE:  2011         #
#############################################

define('IN_PHPBB'true);
$phpbb_root_path '../';
include(
$phpbb_root_path 'extension.inc');
include(
$phpbb_root_path 'common.'.$phpEx);
include(
$phpbb_root_path 'fetchposts.'.$phpEx);

$userdata session_pagestart($user_ipPAGE_GENERAL);
init_userprefs($userdata);

$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word$replacement_word);

$gconf=mysql_fetch_array(mysql_query("SELECT * FROM `phpbb_gorod_conf`"));

include(
$phpbb_root_path 'includes/page_header.'.$phpEx);

if(
$userdata['user_active']!=1)
{
        
message_die(GENERAL_MESSAGE'Авторизуйтесь или зарегистрируйтесь!');
}
else
{

        echo 
'<table width="100%"><tr><td class="catSides"><span class="cattitle"><center>Онлайн город</center></span></td></tr></table>';
        
        if(
$gconf[0]['open']!=1)
        {
               
$action htmlspecialchars(trim($_GET['action']));
               
               switch(
$action)
               {
                     default:
                      
$x mysql_query("SELECT * FROM `phpbb_gorod_zaks` WHERE `on`='".$userdata['username']."' OR `ona`='".$userdata['username']."'");
                      
$x mysql_fetch_assoc($x);

                      if ((
$x['date']-3600)>time())
                      {
                               
message_die(GENERAL_MESSAGE'Предложение зделано пользователем <font color="red">'.$x['avtor'].'</font><br/>
                               День свадьбы: <font color="red">'
.date("d-m-Y",$x['date']).'</font><br/>
                               Время окончания заявки: <font color="red">'
.date("H:i:s",$x['date']).'</font><br/>
                               Прошу не опаздывать, у вас всего час на сборы! По истечении указанного времени вы не сможете расписаться!'
);
                      }
                      else
                      {
                               if ((
$x['date']-3600)<time() && $x['date']>time())
                               {
                                       if ((
$userdata['user_gender']==&& empty($x['onyes'])) || ($userdata['user_gender']!=&& empty($x['onayes'])))
                                       {
                                              if(
$userdata['user_gender']==1)
                                              {
                                                      
$message 'Согласны ли вы расписаться с '.$x['ona'].'?';
                                              }
                                              else
                                              {
                                                      
$message 'Согласны ли вы расписаться с '.$x['on'].'?';
                                              };
                                              
message_die(GENERAL_MESSAGE$message '<br/><a href="zags.php?action=es">Да</a> <a href="index.php">Нет</a>');
                                       }
                                       else
                                       {
                                              
message_die(GENERAL_MESSAGE'Здравствуй, '.$userdata['username'].'!<br/>Сегодня у тебя отвественный и особенный день!<br/>Ожидай вторую половинку.<br/>');
                                       }
                               }
                               else
                               {
                                       if (!
$userdata['gorod_brak']) 
                                       {
                                              echo 
'<table width="100%"><tr><td class="row1">';
                                              echo 
'Администрация сайта искрене рада видеть ВАС здесь.<br/>Здесь вы можете сделать предложение одному из жителей города<br/>';
                                              echo 
'<form action="zags.php?action=go" method="post"><br/>';
                                              echo 
'Кому делаем предложение:<br/>';
                                              echo 
'<input name="name" type="text" value=""/>';
                                              echo 
'<input type="submit" value="Сделать!"/>';
                                              echo 
'</form></td></tr></table>';
                                       }
                                       else
                                       {
                                              
message_die(GENERAL_MESSAGE'Вы уже сделали предложение или состоите в браке.<br/> <a href="razvod.php">Развестись всегда можно тут!</a>');                                                  
                                       }
                                }
                       }
                    break;
                    case 
'es':
                       
$x mysql_query("SELECT * FROM `phpbb_gorod_zaks` WHERE `on`='".$userdata['username']."' OR `ona`='".$userdata['username']."'");
                       if(!
mysql_num_rows($x))
                       {
                                
message_die(GENERAL_ERROR'Ну и что ты здесь забыл?');
                       }
                       
                       
$x mysql_fetch_assoc($x);
                       if(
$userdata['user_gender'] == 1)
                       {
                               if(!empty(
$x['onyes']))
                               {
                                      
message_die(GENERAL_ERROR'Вы уже согласились!');
                               }
                               
mysql_query("UPDATE `phpbb_gorod_zaks` SET `onyes`='yes' WHERE `id`='".$x['id']."'");
                               
$message 'Ваше соглашение принято! Ожидайте соглашения второй стороны!';
                       }
                       else
                       {
                              if(!empty(
$x['onayes']))
                              {
                                      
message_die(GENERAL_ERROR'Вы уже согласились!');
                              }
                              
mysql_query("UPDATE `phpbb_gorod_zaks` SET `onayes`='yes' WHERE `id`='".$x['id']."'");
                              
$message 'Ваше соглашение принято! Ожидайте соглашения второй стороны!';
                       }

                       
$c mysql_query("SELECT * FROM `phpbb_gorod_zaks` WHERE `on`='".$userdata['username']."' OR `ona`='".$userdata['username']."'");
                       
$c mysql_fetch_assoc($c);
                       if(!empty(
$c['onayes']) && !empty($c['onyes']))
                       {
                              
$message 'Поздравляем! Ваш брак состоялся! Теперь вы законный муж и жена!';
                              if(
$userdata['user_gender'] == 1)
                              {
                                      
mysql_query("UPDATE ".USERS_TABLE." SET `gorod_brak`='".$c['ona']."' WHERE `user_id`='".$userdata['user_id']."'");
                                      
mysql_query("UPDATE ".USERS_TABLE." SET `gorod_brak`='".$c['on']."' WHERE `username`='".$c['ona']."'");
                              }
                              else
                              {
                                      
mysql_query("UPDATE ".USERS_TABLE." SET `gorod_brak`='".$c['on']."' WHERE `user_id`='".$userdata['user_id']."'");
                                      
mysql_query("UPDATE ".USERS_TABLE." SET `gorod_brak`='".$userdata['username']."' WHERE `username`='".$c['on']."'");
                              }
                              
mysql_query("DELETE FROM `phpbb_gorod_zaks` WHERE `on`='".$userdata['username']."' OR `ona`='".$userdata['username']."'");
                       }
                       
message_die(GENERAL_MESSAGE$message '<br/><a href="zags.php">В загс</a>');
                    break;
                    case 
'go':
                       
$name htmlspecialchars(mysql_real_escape_string(trim($_POST['name'])));
                       if( !
$name )
                       {
                               
message_die(GENERAL_ERROR'Введите имя!');
                       }
                       
$x mysql_query("SELECT * FROM ".USERS_TABLE." WHERE `username`='$name'");
                       if(!
mysql_num_rows($x))
                       {
                               
message_die(GENERAL_ERROR'Такого пользователя не существует!');
                       }
                       
$bv mysql_query("SELECT * FROM `phpbb_gorod_zaks` WHERE `avtor`='".$userdata['username']."'");
                       if(
mysql_num_rows($bv)!=0)
                       {
                               
message_die(GENERAL_ERROR'Вы уже ждёте свадьбу!');
                       }
                       
$x mysql_fetch_assoc($x);
                       if(
$x['pol']==$userdata['user_gender'])
                       {
                               
message_die(GENERAL_ERROR'Однополые браки строго запрещены!');
                       }
                       if(
$x['username']==$userdata['username'])
                       {
                               
message_die(GENERAL_ERROR'Вы хотите женится сам на себе?');
                       }
                       
$to_userid $x['user_id'];

                       if(
$userdata['user_gender']==1)
                       {
                               
mysql_query("INSERT INTO `phpbb_gorod_zaks` (`date`,`on`,`ona`,`avtor`)VALUES('".(time()+30*30*12*1)."','".$userdata['username']."','$name','".$userdata['username']."')");
                       }
                       else
                       {
                               
mysql_query("INSERT INTO `phpbb_gorod_zaks` (`date`,`on`,`ona`,`avtor`)VALUES('".(time()+30*30*12*1)."','$name','".$userdata['username']."','".$userdata['username']."')");
                       }
                       
$privmsg_message 'Вам назначена свадьба пользователем ' $userdata['username'] . '!<br/>';
                       
$privmsg_message .= 'Приходите в ЗАГС ' date("H:i:s, d-m-Y",(time()+30*30*12*1)-3600) . '<br/>Просьба не опаздывать!';
                       
$sql_info "INSERT INTO " PRIVMSGS_TABLE " (privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date)
                            VALUES ('MESSAGE!', " 
$userdata['user_id'] . ", " $to_userid", '".time()."')";
                   if ( !(
$result $db->sql_query($sql_infoBEGIN_TRANSACTION)) )
                   {
                       
message_die(GENERAL_ERROR"Could not insert/update private message sent info."""__LINE____FILE__$sql_info);
                   }
                   
$privmsg_sent_id $db->sql_nextid();

                   
$sql "INSERT INTO " PRIVMSGS_TEXT_TABLE " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)
                       VALUES (
$privmsg_sent_id, '" $bbcode_uid "', '" str_replace("'""''"$privmsg_message) . "')";
                   if ( !
$db->sql_query($sqlEND_TRANSACTION) )
                   {
                       
message_die(GENERAL_ERROR"Could not insert/update private message sent text."""__LINE____FILE__$sql_info);
                   }

                   
$sql "UPDATE " USERS_TABLE "
                       SET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " 
time() . "  
                       WHERE user_id = " 
$to_userid
                   if ( !
$status $db->sql_query($sql) )
                   {
                       
message_die(GENERAL_ERROR'Could not update private message new/read status for user'''__LINE____FILE__$sql);
                   }  
                       
message_die(GENERAL_MESSAGE'Свадьба назначена на '.date("H:i:s, d-m-Y",(time()+30*30*12*1)-3600).'<br/>');
                     break;
              }
       }
}

include(
$phpbb_root_path 'includes/page_tail.'.$phpEx);
?>
Онлайн: 0
Реклама