Файл: weddings/includes/information.php
Строк: 74
<?php
$para=get_user($ank['para']);
if ($ank['para']!=0){
echo "<img src='/weddings/icons/brak.png' alt='*'> <a href='/info.php?id=$para[id]'>".($ank['pol']==1?"Женат на ":"Замужем за")." $para[nick]</a><br/>";
if ($ank['time_brak']==0){
mysql_query("UPDATE `user` SET `time_brak` = '".$time."' WHERE `id` ='".$para['id']."'");
mysql_query("UPDATE `user` SET `time_brak` = '".$time."' WHERE `id` ='".$ank['id']."'");
}
$timediff=$time-$ank['time_brak'];
$oneMinute=60;
$oneHour=60*60;
$oneDay=60*60*24;
$dayfield=floor($timediff/$oneDay);
$hourfield=floor(($timediff-$dayfield*$oneDay)/$oneHour);
$minutefield=floor(($timediff-$dayfield*$oneDay-$hourfield*$oneHour)/$oneMinute);
$secondfield=floor(($timediff-$dayfield*$oneDay-$hourfield*$oneHour-$minutefield*$oneMinute));
$sDaysLeft=$dayfield;
$sDaysText = "дней";
$nDaysLeftLength =strlen($sDaysLeft);
$d_1=substr($sDaysLeft,-1,1);
if (substr($sDaysLeft,-2,1) != 1 && $nDaysLeftLength>1){
if ($d_1 == 2 || $d_1== 3 || $d_1== 4){
$sDaysText="дня";
} elseif ($d_1== 1){
$sDaysText="день";
}
}
if ($nDaysLeftLength==1){
if ($d_1==2 || $d_1== 3 || $d_1== 4){
$sDaysText="дня";
} elseif ($d_1== 1){
$sDaysText="день";
}
}
$sHoursLeft=$hourfield;
$sHoursText = "часов";
$nHoursLeftLength = strlen($sHoursLeft);
$h_1=substr($sHoursLeft,-1,1);
if (substr($sHoursLeft,-2,1) != 1 && $nHoursLeftLength>1)
{
if ($h_1== 2 || $h_1== 3 || $h_1== 4)
{
$sHoursText = "часа";
}
elseif ($h_1== 1)
{
$sHoursText = "час";
}
}
if ($nHoursLeftLength==1)
{
if ($h_1== 2 || $h_1== 3 || $h_1== 4)
{
$sHoursText = "часа";
}
elseif ($h_1== 1)
{
$sHoursText = "час";
}
}
echo "<img src='/weddings/icons/time_brak.png' alt='*'> В браке <b>$sDaysLeft $sDaysText $sHoursLeft $sHoursText</b><br/>";
if ($user['id']==$ank['id'])echo "<img src='/weddings/icons/divorce.png' alt='*'> <a href='/weddings/activity/divorce.php'>Подать на развод</a><br/>";
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `weddings` WHERE `id_para` = '".$ank['id']."' LIMIT 1"),0)==0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `weddings` WHERE `id_user` = '".$ank['id']."' LIMIT 1"),0)==0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `weddings` WHERE `id_para` = '".$user['id']."' LIMIT 1"),0)==0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `weddings` WHERE `id_user` = '".$user['id']."' LIMIT 1"),0)==0 && $user['para']==0 && $ank['para']==0 && $user['pol']!=$ank['pol'] && $user['id']!=$ank['id'])echo "<img src='/weddings/icons/brak.png' alt='*'> <a href='/weddings/activity/proposal.php?id=$ank[id]'>".($ank['pol']==0?"Предложить выйти замуж ":"Предложить поженится")."</a><br/>";
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `weddings` WHERE `id_para` = '".$ank['id']."' AND `id_user` = '".$user['id']."' LIMIT 1"),0)!=0)echo "<img src='/weddings/icons/defeat.png' alt='*'> <a href='/weddings/activity/defeat.php?id=$ank[id]'>Отменить предложение</a><br/>";
?>