Файл: region_clean/svadbi.php
Строк: 294
<?
#######################################
## Mod By KoT (borispol) [76-75-072] ##
#######################################
require_once "start.php";
require_once "sid.php";
header('Cache-Control: no-store, no-cache, must-revalidate');
if ($ver == "wml")header ("Content-type:text/vnd.wap.wml; charset=utf-8");
else header("Content-Type:text/html; charset=UTF-8");
require_once "inc.php";
$link = connect_db();
list($row, $id, $ps, $fsize1, $fsize2) = check_login($link);
require_once "version.php";
$mid = intval($mid);
$us = $row['user'];
$translit = $row['translit'];
$message = mysql_real_escape_string(check($message));
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>n
<card title="Свадьбы чата">n";
} else {
echo "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="css/$css.css"/>
<title>Свадьбы чата</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>";
}
switch($go) {
default:
if ($ver == "wml") echo "<p align="center">";
else echo "<div align="center">";
echo "<img src="smilean/love10.gif" alt="Love"/><br/>";
echo $fsize1;
echo $divide;
echo $fsize2;
$print = mysql_query("select * from `svadbi` order by id desc;");
if (mysql_affected_rows() == 0) {
echo $fsize1;
echo 'Свадеб нет!<br/>';
echo $fsize2;
}
while($arr = mysql_fetch_assoc($print)) {
echo $fsize1;
$zhenih = mysql_query ("select `user` FROM `users` where `id`='".(int)$arr['zhenih']."';");
$xc = mysql_fetch_array($zhenih);
$zhen = $xc[0];
$newesta = mysql_query ("select `user` FROM `users` where `id`='".(int)$arr['nevesta']."';");
$xcx = mysql_fetch_array($newesta);
$nevesta = $xcx[0];
echo "Свадьба <b><a href="svadbi.php?$ses&go=view&mid=".$arr['id']."">".$zhen." & ".$nevesta."</a></b> (".$arr['date'].")<br/>";
echo $fsize2;
}
break;
case 'view':
$select = mysql_query ("Select * from `svadbi` where id='".(int)$mid."';");
$inf = mysql_fetch_array ($select);
$zhenih = $inf['zhenih'];
$nevesta = $inf['nevesta'];
$frzhenih = $inf['frzhenih'];
$frnevesta = $inf['frnevesta'];
$days = $inf['date'];
$times = $inf['vremya'];
$organizatory = $inf['organizatory'];
if ($ver == "wml") echo "<p align="center">";
else echo "<div align="center">";
echo "<img src="smilean/love10.gif" alt="Love"/><br/>";
if ($ver == "wml") echo "</p><p align="left">";
else echo "</div><div align="left">";
echo $fsize1;
$zhenih = mysql_query ("select `user` FROM `users` where `id`='".(int)$zhenih."';");
$xc = mysql_fetch_array($zhenih);
$zhen = $xc[0];
$newesta = mysql_query ("select `user` FROM `users` where `id`='".(int)$nevesta."';");
$xcx = mysql_fetch_array($newesta);
$nevestax = $xcx[0];
echo "Приглашаем всех чатлан на свадьбу между двумя любящими сердацми <b>".col_n($zhen)."</b> и <b>".col_n($nevestax)."</b>, которая состоится <b>".$days."</b> в <b>".$times."</b> в нашем чате в комнате <b>ЗАГС</b>.<br/>";
echo $divide;
echo "<u>Друзья жениха:</u> ".$frzhenih."<br/>
<u>Подруги невесты:</u> ".$frnevesta."<br/>";
echo $divide;
echo "Организатор: ".$organizatory."<br/>";
echo $divide;
echo $fsize2;
echo $fsize1;
echo "<a href="svadbi.php?$ses&mid=$mid&ref=$ref&go=send&mod=ok">Послать им поздравление</a>n";
echo $fsize2;
echo '<br/>';
break;
case 'send':
if ($ver == "wml") echo "<p align="center">";
else echo "<div align="center">";
//Проверка на существование ника жениха
if (isset($mod)) {
$select = mysql_query ("Select * from `svadbi` where id='".(int)$mid."';");
$inf = mysql_fetch_array ($select);
$zhenih = $inf['zhenih'];
$nevesta = $inf['nevesta'];
$userm = mysql_query ("select `id` FROM `users` where `sex` = 'М' AND `id` ='".(int)$zhenih."';");
$usm = mysql_fetch_array($userm);
$num = $usm[0];
if (empty($num)) {
echo $fsize1;
echo "<u>Парня с ID <b>".$zhenih."</b> не сущетвует.</u><br/>";
echo $fsize2;
break;
}
$usermx = mysql_query ("select `id` FROM `users` where `sex` = 'Ж' AND `id` ='".(int)$nevesta."';");
$usmx = mysql_fetch_array($usermx);
$numx = $usmx[0];
if (empty($numx)) {
echo $fsize1;
echo "<u>Девушки с ID <b>".$nevesta."</b> не сущетвует.</u><br/>";
echo $fsize2;
break;
}
$row2 = mysql_fetch_array ($result2);
$nkz = $row2['id'];
$loginz = $row2['user'];
echo $fsize1;
$zhe = mysql_query ("select `user` FROM `users` where `id`='".(int)$zhenih."';");
$xc = mysql_fetch_array($zhe);
$zhen = $xc[0];
$newesta = mysql_query ("select `user` FROM `users` where `id`='".(int)$nevesta."';");
$xcx = mysql_fetch_array($newesta);
$nev = $xcx[0];
echo "<img src="smilean/love10.gif" alt="Love"/><br/>
Поздравление со свадьбой для <b>".$zhen."</b> и <b>".$nev."</b><br/>n";
$loginm = UrlEncode($loginm);
$loginz = UrlEncode($loginz);
echo $divide;
echo $fsize2;
if ($ver == "wml") {
echo "<input name="message$ref" maxlength="600" value="$message" title="message"/><br/>n";
echo $fsize1;
echo "<anchor title="go">Отправить<go href="svadbi.php?$ses&ref=$ref&go=send" method="post">n
<postfield name="message" value="$(message$ref)"/>n
<postfield name="loginm" value="$zhen"/>n
<postfield name="loginz" value="$nev"/>n
<postfield name="nkm" value="$zhenih"/>n
<postfield name="nkz" value="$nevesta"/>n
</go></anchor>n";
echo $fsize2;
echo '<br/>';
} else {
echo "<form action=svadbi.php method=post">n
<input type=hidden name=go value=send />n
<input type=hidden name=loginm value=$zhen />n
<input type=hidden name=loginz value=$nev />n
<input type=hidden name=nkm value=$zhenih />n
<input type=hidden name=nkz value=$nevesta />n
<input type=text name=message maxlength="600"><br/>n
<input type=submit class="ibutton" value="Отправить"/></form>n";
}
break;
}
$zhen = mysql_real_escape_string(check($zhen));
$nev = mysql_real_escape_string(check($nev));
$nkm = abs(intval($nkm));
$nkz = abs(intval($nkz));
if (empty($message)) {
echo $fsize1;
echo '<u>Поле поздравления не заполнено!</u><br/>';
echo $fsize2;
break;
}
$msg = $message;
require_once "smile.php";
$msg = smiles($msg);
$minpos = 1200;
$nm = 1200;
for ($j=0; $j <= count($smiles)-1; $j++) {
$tmpp = strpos($msg,$smiles[$j]);
if (($tmpp < $minpos) and ($tmpp !== false)) {
$minpos = $tmpp; $nm = $j;
}
}
if ($minpos != 1200) {
if ($row['translit'] != 1) {
$st1 = substr($msg,0,$minpos+strlen($smiles[$nm]));
$st2 = substr($msg,$minpos+strlen($smiles[$nm]),strlen($msg)-strlen($st1));
$st1 = str_replace($smiles[$nm],$replaces[$nm],$st1);
$msg = $st1.$st2;
} else {
$st1 = substr($msg,0,$minpos);
$st2 = substr($msg,$minpos, strlen($smiles[$nm]));
$st3 = substr($msg,$minpos+strlen($smiles[$nm]),strlen($msg)-strlen($st1)-strlen($st2));
$st1 = trun_to_rus($st1);
$st2 = $replaces[$nm];
$st3 = trun_to_rus($st3);
$msg = $st1.$st2.$st3;
}
}
else if ($row['translit'] == 1) $msg = trun_to_rus($msg);
unset($smiles);
unset($replaces);
if ($row['translit'] == 0) $msg = eregi_replace("((http://))((([a-z0-9-]+(.[a-z0-9-]+)*(.[a-z;]{2,3}))|(([0-9]{1,3}.){3}([0-9]{1,3})))((/|?)[a-z0-9~#%&'_+=:;?.-]*)*)", "<a href="\0">\3</a>", $msg);
$message = $msg;
$nkm = trim("$nkm");
$loginm = trim("$loginm");
$nkz = trim("$nkz");
$loginz = trim("$loginz");
$data = date("d-M-Y [H:i]");
$kol = mt_rand(0,99999999);
$kol2 = mt_rand(0,99999999);
$time = time();
$topic = "Поздравление со свадьбой!!!";
if (mysql_query("Insert into zapiski set klu4='".$kol."', who ='".$us."', idwho ='".$id."', message = '".$message."', towhom = '".$loginm."', idtowhom = '".$nkm."', time = '".$time."', readd = '0', topic = '".$topic."', date='".$data."'")){
echo "<img src="smilean/love10.gif" alt="Love"/><br/>";
$loginm = UrlDecode($loginm);
$loginz = UrlDecode($loginz);
echo $fsize1;
echo "Жених <b>".col_n($loginm)."</b> получил твоё поздравление.<br/>";
echo $fsize2;
} else {
echo $fsize1;
echo "Ошибка! <b>".col_n($loginm)."</b> не получил поздравление.<br/>";
echo $fsize2;
}
if (mysql_query("Insert into zapiski set klu4='".$kol2."', who ='".$us."', idwho ='".$id."', message = '".$message."', towhom = '".$loginz."', idtowhom = '".$nkz."', time = '".$time."', readd = '0', topic = '".$topic."', date='".$data."'")){
echo "<img src="smilean/love10.gif" alt="Love"/><br/>";
echo $fsize1;
echo "Невеста <b>".col_n($loginz)."</b> получила твоё поздравление.<br/>";
echo $fsize2;
} else {
echo $fsize1;
echo "Ошибка! <b>".col_n($loginz)."</b> не получила поздравление.<br/>";
echo $fsize2;
}
break;
}
echo $fsize1;
echo $divide;
echo $fsize2;
if ($go) {
echo $fsize1;
echo "<a href="svadbi.php?$ses&ref=$ref">Свадьбы</a><br/>n";
echo $fsize2;
}
echo $fsize1;
echo "<a href="enter.php?$ses&ref=$ref">Прихожая</a><br/>";
echo $fsize2;
include_once "foot.php";
?>