Файл: gorod/razvod.php
Строк: 71
<?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_ip, PAGE_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`"));
$confirm = ( isset($HTTP_POST_VARS['confirm']) ) ? TRUE : FALSE;
$cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? TRUE : FALSE;
if ( $cancel )
{
redirect(append_sid("index.$phpEx", TRUE));
}
if($userdata['user_active'] != 1)
{
message_die(GENERAL_MESSAGE, 'Пройдите регистрацию!');
}
if($gconf[0]['open'] != 1)
{
if(!$userdata['gorod_brak'])
{
message_die(GENERAL_MESSAGE, 'Вы не состоите в браке!');
}
if ( !$confirm )
{
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'confirm_body' => 'confirm_body.tpl')
);
$message_text = $userdata['username'] . ' Вы хотите развестись с ' . $userdata['gorod_brak'] . '?<br/>';
$template->assign_vars(array(
'MESSAGE_TITLE' => '<b><font color="red">ЗАГС</font> Отдел разводов</b>',
'MESSAGE_TEXT' => $message_text,
'L_YES' => $lang['Yes'],
'L_NO' => $lang['No'],
'S_CONFIRM_ACTION' => append_sid("razvod.$phpEx"),
'S_HIDDEN_FIELDS' => $s_hidden_fields)
);
$template->pparse('confirm_body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
else
{
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$x = mysql_query("SELECT * FROM " . USERS_TABLE . " WHERE `username`='" . $userdata['gorod_brak'] . "'");
$x = mysql_fetch_assoc($x);
$to_userid = $x['user_id'];
$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_info, BEGIN_TRANSACTION)) )
{
message_die(GENERAL_ERROR, "Could not insert/update private message sent info.", "", __LINE__, __FILE__, $sql_info);
}
$privmsg_sent_id = $db->sql_nextid();
$privmsg_message = 'Вы были разведены! ' . date("H:i:s, d-m-Y",(time()+30*30*12*1)-3600) . '<br/>Пользователь ' . $userdata['username'] . ' разорвал брак!';
$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($sql, END_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);
}
mysql_query("UPDATE " . USERS_TABLE . " SET `gorod_brak`='' WHERE `username`='".$userdata['gorod_brak']."'");
mysql_query("UPDATE " . USERS_TABLE . " SET `gorod_brak`='' WHERE `username`='".$userdata['username']."'");
message_die(GENERAL_MESSAGE, 'Объявляю ваш брак не дествительным!<br/>Ну вот вы и свободный человек! Пора уже сделать новое <br/><a href="zags.php">Предложение</a>');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
}
else
{
message_die(GENERAL_MESSAGE, 'Город закрыт администратором!');
}
?>