Файл: room.php
Строк: 373
<?php
ini_set('display_errors', 'off');
header ("Content-type: text/html; charset=utf-8");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-relative");
include "./ini.php";
print '<?xml version="1.0" encoding="UTF-8"?>';
print "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head>";
mysql_query ("select * from bannedib WHERE ci='$ci' AND ( ((ip = '".getenv(REMOTE_ADDR)."')and(browser = '".getenv(HTTP_USER_AGENT)."')) or ((ip = '".getenv(REMOTE_ADDR)."') and (browser = '')) or (login='$id'))");
if(mysql_affected_rows()!=0){include "b.php";}?>
<SCRIPT language=JavaScript>
var tohex = new Array(256);
var hex = "0123456789ABCDEF";
var count = 0;
for (x=0; x<16; x++) {
for (y=0; y<16; y++) {
tohex[count] = hex.charAt(x) + hex.charAt(y);
count++;
}
}
function ColorCode(hexcode) {
if (hexcode.length == 7) {
this.r = parseInt(hexcode.substring(1,3),16);
this.g = parseInt(hexcode.substring(3,5),16);
this.b = parseInt(hexcode.substring(5,7),16);
}
else if (hexcode.length == 6) {
this.r = parseInt(hexcode.substring(0,2),16);
this.g = parseInt(hexcode.substring(2,4),16);
this.b = parseInt(hexcode.substring(4,6),16);
}
else {
this.r = this.g = this.b = 0;
alert("Error: ColorCode constructor failed");
}
if (isNaN(this.r)||isNaN(this.g)||isNaN(this.b))
alert("Error: ColorCode constructor failed");
}
function ColorList(hexcodes) {
var i = 0;
var c = 0;
this.codes = new Array(Math.round(hexcodes.length/7));
while (i < hexcodes.length) {
if (isNaN(parseInt(hexcodes.substring(i,i+6),16))) ++i;
else {
this.codes[c] = new ColorCode(hexcodes.substring(i,i+6));
i += 7;
++c;
}
}
this.len = c;
}
function interpolate (x1, y1, x3, y3, x2) {
if (x3 == x1) return y1
else return (x2-x1)*(y3-y1)/(x3-x1) + y1
}
function lowcolorindex (x, y, z) {
if (y == 1) return 0
else return Math.floor( (x*(z-1))/(y-1) )
}
function hicolorindex (x, y, z, low) {
if ( low*(y-1) == x*(z-1) ) return low
else if (y == 1) return 0
else return Math.floor( (x*(z-1))/(y-1) + 1 )
}
function gradient (thetext,thecolors) {
var colors = new ColorList(thecolors);
var numcolors = colors.len;
var numchars = thetext.length;
var rr = 0;
var gg = 0;
var bb = 0;
var lci = 0;
var hci = 0;
for (i=0; i<numchars; ++i) {
lci = lowcolorindex(i, numchars, numcolors);
hci = hicolorindex(i, numchars, numcolors, lci);
rr = Math.round(interpolate( lci/(numcolors-1), colors.codes[lci].r, hci/(numcolors-1), colors.codes[hci].r, i/(numchars-1)));
gg = Math.round(interpolate( lci/(numcolors-1), colors.codes[lci].g, hci/(numcolors-1), colors.codes[hci].g, i/(numchars-1)));
bb = Math.round(interpolate( lci/(numcolors-1), colors.codes[lci].b, hci/(numcolors-1), colors.codes[hci].b, i/(numchars-1)));
document.write(thetext.charAt(i).fontcolor('#' + tohex[rr]+tohex[gg]+tohex[bb]));
}
}
</script>
<?
$start = gettime();
$r = rand(0,100000);
$login = autorize();
if($login['fsize'] == "medium") { $fsize1 = ""; $fsize2 = ""; }
elseif($login['fsize'] == "small") { $fsize1 = "<small>"; $fsize2 = "</small>"; }
elseif($login['fsize'] == "big") { $fsize1 = "<big>"; $fsize2 = "</big>"; }
$query_settings = @mysql_query("select `val2` from `".$px."".$stable."` where `var`='$room' and `mod`='room' and `ci`='".$login['ci']."';");
$settings = @mysql_fetch_array($query_settings);
$num_msgs = $login['nmsgs'];
$time_update = $login['tupdate'];
if(empty($num_msgs)) $num_msgs=5;
if(empty($time_update)) $time_update=300;
$timenow = strftime("%H:%M:%S");
$rtitle = $settings['val2'];
$pass=htmlspecialchars(stripslashes(trim($pass)));
$room=htmlspecialchars(stripslashes(trim($room)));
$q_letters_in = @mysql_query("select count(*) from `".$px.$ltable."` where `to_user`='".$login['login']."' and ci='".$ci."' and `new`=1;");
$num_in=@mysql_fetch_array($q_letters_in);
$pr_count = @mysql_query("SELECT count(*) FROM `".$px.$utable."` WHERE ltime>'".intval(time()-$offline)."' AND room='$room' and ci= '$ci';");
$pdc = @mysql_fetch_array($pr_count);
$q_letters_in = @mysql_query("select count(*) from `".$px.$ltable."` where `to_user`='".$login['login']."' and ci='".$ci."' and `new`=1;");
$num_in=@mysql_fetch_array($q_letters_in);
$pr_count = @mysql_query("SELECT count(*) FROM `".$px.$utable."` WHERE ltime>'".intval(time()-$offline)."' AND room='$room' and ci= '$ci';");
if($mod=="privat")
print '<card id="main" title="'.$settings['val2'].'-('.$pdc['count(*)'].')" ontimer="room.php?ci='.$ci.'&id='.$id.'&pass='.$pass.'&room='.$room.'&mod=privat&r='.$r.'"><timer value="'.$time_update.'"/>';
else
if ($room == "intim"){
print '<card id="main" title="Интим -('.$pdc['count(*)'].')" ontimer="room.php?ci='.$ci.'&id='.$id.'&pass='.$pass.'&key='.$key.'&room='.$room.'&r='.$r.'"><timer value="'.$time_update.'"/>';
}else{
print '<card id="main" title="'.$settings['val2'].'-('.$pdc['count(*)'].')" ontimer="room.php?ci='.$ci.'&id='.$id.'&pass='.$pass.'&room='.$room.'&r='.$r.'"><timer value="'.$time_update.'"/>';
}
if ($login['sftwhr'] == "1")
print '<do type="options" name="whowhere" label="Кто?Где?"><go href="online.php?ci='.$ci.'&id='.$id.'&pass='.$pass.'&room='.$room.'&r='.$r.'" method="get"/></do>cccccccc c';
if ($login['sftltrs'] == "1")
print '<do type="options" name="letters" label="Письма('.$num_in['count(*)'].')"><go href="letters/inbox.php?ci='.$ci.'&id='.$id.'&pass='.$pass.'&r='.$r.'" method="get"/></do>';
if (($login['sfthr'] == "1") and ($room !== "intim"))
print '<do type="options" name="whohere" label="Кто здесь('.$pdc['count(*)'].')"><go href="here.php?ci='.$ci.'&id='.$id.'&pass='.$pass.'&room='.$room.'&r='.$r.'" method="get"/></do>';
if ($login['sftsay'] == "1")
print '<do type="options" name="say" label="Обновить"><go href="room.php?ci='.$ci.'&id='.$id.'&pass='.$pass.'&room='.$room.'&r='.$r.'" method="get"/></do>';
if ($login['sftref'] == "1")
print '<do type="options" name="refresh" label="Сказать"><go href="#say" method="get"/></do>';
if (($room !== "intim") and ($login['sftpriv'] == "1")) print '<do type="options" name="privat" label="'.$lang['privat'].'"><go href="./room.php?ci='.$ci.'&id='.$id.'&pass='.$pass.'&room='.$room.'&mod=privat&r='.$r.'" method="get"/></do>';
if ($room == "intim") print '<do type="options" name="changekey" label="Сменить ключ"><go href="./intim.php?ci='.$ci.'&id='.$id.'&pass='.$pass.'&room=intim" method="get"/></do>';
if ($room=="vict") print '<do type="options" name="stats" label="Топ 10"><go href="statistic.php?ci='.$ci.'&id='.$id.'&pass='.$pass.'&room='.$room.'&mod=stats&r='.$r.'" method="get"/></do>';
$pdc = @mysql_fetch_array($pr_count);
if($mod=="privat")
print "<title>".$settings['val2']." (".$pdc['count(*)'].")</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link rel="StyleSheet" type="text/css" href="style/0".$s.".css"></head><body>";
else
print "<title>".$settings['val2']." (".$pdc['count(*)'].")</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link rel="StyleSheet" type="text/css" href="style/0".$s.".css"></head><body>";
print "<meta http-equiv="refresh" content=".$time_update.";url=./room.php?s=$s&ci=$ci&id=$id&pass=$pass&room=".$room."></a>";
print '<p>';
$posts = $login['posts'];
$moder = $login['moder'];
$admin = $login['admin'];
$ltime = $login['ltime'];
$ban = $login['ban'];
$btime = $login['btime'];
$breason = $login['breason'];
if($login) {
if(!empty($room)) {
if(!empty($private)) $pr = explode(".",$private);
if($room=="vict")
$query_msg = @mysql_query("select * from `".$px.$vtable."` where ci='".$ci."' and login='".$login['login']."' order by id desc;");
else
$query_msg = @mysql_query("select * from `".$px.$mtable."` where ci='".$ci."' and login='".$login['login']."' order by id desc;");
if($room=="intim")
$query_msg = @mysql_query("select * from `".$px.$prtable."` where ci='".$ci."' and login='".$login['login']."' and key='$key' order by id desc;");
if($room=="unlim")
$query_msg = @mysql_query("select * from `".$px.$untable."` where ci='".$ci."' and login='".$login['login']."' order by id desc;");
$prevmsg = @mysql_fetch_array($query_msg);
if($ban == "kill")
print $lang['you_are_killed'];
elseif(!empty($ban)) {
if($btime >= time()) {
$enter = $btime - time();
print "".$fsize1."<b>$ban ".$lang['kick_you'].$lang['reason'].": $breason! ".$lang['unban']."<u>".$enter."</u>".$lang['s']."!</b>".$fsize2."<br/>";
} else {
@mysql_query("update `".$px.$utable."` set ban='', btime='', breason='' where id='".$id."' and ci='$ci';");
require "./room.inc.php"; }
} else {
@mysql_query("update `".$px.$utable."` set ltime='".time()."', room='".$room."' where id='".$id."' and ci='$ci';");
if($translit=="user") { $nik=strtok($msg," "); $msg=strstr($msg," "); $msg=latrus($msg); $msg=$nik.$msg; }
if($translit=="toall") { $msg=latrus($msg); }
$msg=htmlspecialchars(stripslashes(trim($msg)));
if($login['moder'] && $bold) $msg = "<b>".$msg."</b>";
if($login['moder'] && $small) $msg = "<small>".$msg."</small>";
if($login['moder'] && $underline) $msg = "<u>".$msg."</u>";
if($login['moder'] && $big) $msg = "<big>".$msg."</big>";
if($login['admin'] && $superbig) $msg = "<big><big>".$msg."</big></big>";
if($login['admin'] && $blink) $msg = "<blink>".$msg."</blink>";
if($login && $color) $msg = "<span style="color:$color;">".$msg."</span>";
if($login && $emotions) $msg = "$emotions".$msg."";
include "./sm/convert_to_smiles.php";
if(!empty($msg) && $msg!=$prevmsg['msg']) {
if($room=="vict")
{@mysql_query("insert into `".$px.$vtable."` values(0,'".$login['login']."','$msg','".$pr[0]."','".$pr[1]."','','','".time()."','$ci');");}
if($room=="unlim")
{@mysql_query("insert into `".$px.$untable."` values(0,'".$login['login']."','$msg','".$pr[0]."','".$pr[1]."','".time()."','$ci');");}
if($room=="intim")
{@mysql_query("insert into `".$px.$prtable."` values(0,'".$login['login']."','$msg','$key','".time()."','$ci');");}
if (($room !== "vict") and ($room !== "intim") and ($room !== "unlim"))
{@mysql_query("insert into `".$px.$mtable."` values(0,'".$login['login']."','$msg','".$pr[0]."','".$pr[1]."','".time()."','$room','$ci');");
}
@mysql_query("update `".$px.$utable."` set posts='".++$posts."', ltime='".time()."' where id='".$id."' and ci='$ci';"); }
if($room=="vict") include "./vict.inc.php";
if($login['fsize'] == "small") { $fsize1 = "<small>"; $fsize2 = "</small>"; }
elseif($login['fsize'] == "big") { $fsize1 = "<big>"; $fsize2 = "</big>"; }
else { $fsize1 = ""; $fsize2 = ""; }
print $fsize1;
include "./room.inc.php";
print $fsize2;
} } else { print $lang['room_not_exist']; }
} else { print $lang['not_loged']; }
@mysql_close();
$end = gettime();
print "</div></div><div class="contur_rek"><div class="header_rek">".$fsize1."<a href="./history.php?s=$s&ci=$ci&id=$id&pass=$pass&room=$room&start=$num_msgs&r=$r">".$lang['history']."</a>";
print " | <a href="./ignor.php?s=$s&ci=$ci&id=$id&pass=$pass">".$lang['ignor']."</a>";
print " | <a href="./enter.php?s=$s&ci=$ci&id=$id&pass=$pass">Прихожая</a>".$fsize2."</div></div>";
print "".$fsize1."<small>Speed ".round(($end - $start), 5)." sec".$fsize2."";
print '</small></div></body></html>';
?>