Видно приват!

Статус
В этой теме нельзя размещать новые ответы.

Karapuz1

Новичок
Репутация
0 / 279
Почему все видят сообщения которые отправлены вприват!
Я сравнил с другими и ошибок нету вроде!

chat.php

Код:
<?
define('INSIDE', true);
include("inc/db_connect.php");

$stat = mysql_fetch_array(mysql_query("SELECT `id`,`user`,`bloked`,`m_time`,`room`,`rank`,`color`,`font`,`admin`,`tribe` FROM `players` WHERE `user` = '".$_COOKIE['user']."' AND `pass` = '".$_COOKIE['pass']."' LIMIT 1"));
  mysql_query("SET CHARSET cp1251");
if (empty($stat['id']) || $stat['bloked']) {
  print "<script>top.location='index.php?action=logout'</script>";
  exit;
}

mysql_query("UPDATE `players` SET `lpv` = '".time()."' WHERE `user` = '".$stat['user']."' LIMIT 1");

include("inc/chat/functions.php");

$mess_id=$_GET['message_id'];

if ($_GET['action']=="send") {
  $text = HtmlSpecialChars(Trim($_POST['text']));
  if ($stat['m_time']>time()) $text="";
  if ($text=="") { $clear_text = 0; } else {
    $clear_text = 1;
    $to_login = "";
    $private = "";
    $to_clan = "";
    if (preg_match("/клану \[(.*?)\]/", $text, $private_clan)) {
      $privateclan = $private_clan['1'];
      if ($stat[tribe]==$privateclan) {      
      $text = str_replace('клану ['.$privateclan.']',' ',$text);
      $to_clan = $privateclan;
    }else $text="Вы не состоите в этом клане";
    }
    elseif (preg_match("/приватно \[(.*?)\]/", $text, $private_temp)) {
      $private = $private_temp['1'];
      $text = str_replace('приватно ['.$private.']',' ',$text);
    }
    elseif (preg_match("/для \[(.*?)\]/", $text, $to_login_temp)) {
      $to_login = $to_login_temp['1'];
      $text = str_replace('для ['.$to_login.']',' ',$text);
    }
$search = array("<", ">",);
$replace = array("&lt;", "&gt;");
$text = str_replace($search, $replace, $text);
    include("inc/chat/smiles.php");

if ($stat['font']=='b') $text = '[b]'.$text.'[/b]';
elseif ($stat['font']=='i') $text = '[i]'.$text.'[/i]';
elseif ($stat['font']=='bi') $text = '[i][b]'.$text.'[/b][/i]';

if ($stat['admin']) $send = '<font face="Comic Sans MS" size="2">'.$text.'</font>';
else $send = $text;
    insert_msg($send,$to_login,$private,0,'','','',$to_clan);
  }
  $mess_id=$_POST['message_id'];
}

print "<script LANGUAGE=\"JavaScript\">";
if ($mess_id!="") {
  $chat = mysql_query("SELECT * FROM `chat` WHERE `id` > ".$mess_id." AND (`room` = '".$stat['room']."' OR `room` = '0' OR `room` = '') ORDER BY `id`");
  while($chats = mysql_fetch_array($chat)) {
    if ($chats['id']>$mess_id) {
      $mess_id=$chats['id'];
      if ($chats['date']+60 > time()) {
        if ($chats['system']==1) {
          if ($chats['system_to']=="") {
            if ($chats['msg']<>"") {
              echo "top.ChatMsg('".date('H:i:s',$chats['date'])."','','<LABEL STYLE=\'COLOR: Red\' title=\'Уровень важности: Высокий\'>[u][b]Внимание![/b][/u]</LABEL> ".stripslashes($chats['msg'])."','1','0');";
              echo "\n";
            }
          } else {
            if ($chats['system_to']==$stat['user']) {
              if ($chats['msg']<>"") {
                echo "top.ChatMsg('".date('H:i:s',$chats['date'])."','','<LABEL STYLE=\'COLOR: Green\' title=\'Уровень важности: Низкий\'>[u][b]Внимание![/b][/u]</LABEL> ".stripslashes($chats['msg'])."','1','0');";
                echo "\n";
              }
            }
          }
          if ($chats['redirect']) $redirect=$chats['redirect'];
        } elseif (!empty($chats['to_clan']) && $chats['to_clan']==$stat['tribe']) {
        if ($chats['login']==$stat['user']) { $my=1; $me=0; } else { $my=0; $me=1; }
        echo "top.ChatMsg('".date('H:i:s',$chats['date'])."','".$chats['login']."','<FONT class=private onclick=\'top.cl(\"$chats[to_clan]\");\'>клану [".$chats[to_clan]."]</FONT> ".stripslashes($chats['msg'])."','".$me."','".$my."');";
        echo "\n";
        } elseif ($chats['private']<>"" && ($chats['login']==$stat['user'] || $chats['private']==$stat['user'])) {
          if ($chats['login']==$stat['user']) { $my=1; $me=0; } else { $my=0; $me=1; }
          if ($my==1) { $pp=$chats['private']; } else { $pp=$chats['login']; }
          echo "top.ChatMsg('".date('H:i:s',$chats['date'])."','".$chats['login']."','<FONT class=private onclick=\'top.pp(\"".$pp."\");\'>приватно [".$chats['private']."]</FONT>".stripslashes($chats['msg'])."','".$me."','".$my."');";
          echo "\n";
        } elseif ($chats['to_login']<>""){
          unset ($stick);
          if ($chats['to_login']==$stat['user']) { $my=0; $me=1; $stick=1; }
          if ($chats['login']==$stat['user']) { $my=1; $me=0; $stick=1; }
          if ($my==1) { $to=$chats['to_login']; } else { $to=$chats['login']; }
          echo "top.ChatMsg('".date('H:i:s',$chats['date'])."','".$chats['login']."','";
          if (isset($stick) && !empty($stick)) { echo "<FONT class=player onclick=\'top.to(\"".$to."\");\'>"; }
          echo "для [".$chats['to_login']."]</FONT><font color=".$chats['color']."> ".stripslashes($chats['msg'])."</font>','".$me."','".$my."');";
          echo "\n";
        } elseif ($chats['private']=="" && $chats['to_login']=="" && empty($chats['to_clan']) && $chats['system']<>1) {
          if ($chats['login']==$stat['user']) $my=1; else $my=0;
          echo "top.ChatMsg('".date('H:i:s',$chats['date'])."','".$chats['login']."','<font color=".$chats['color']."> ".addslashes($chats['msg'])."</font>','0','".$my."');";
          echo "\n";
        }
      }
    }
  }
} else { $mess_id=-1; }
print"\ntop.MsgSent('".$mess_id."'";
if (isset($clear_text)) print ",'1'";
print ");\n";
if ($redirect) echo"top.main.location=\"$redirect?\"+Math.random();\"\"\n";
print "</SCRIPT>";
mysql_close($link);
?>
 
Такая же фигня!


вот say.php!Я и поменял его!

Код:
<?
session_start();
define('INSIDE', true);
include("inc/db_connect.php");
include("inc/html_header.php");

$stat = mysql_fetch_array(mysql_query("SELECT * FROM `players` WHERE `user` = '".$_COOKIE['user']."' AND `pass` = '".$_COOKIE['pass']."'"));
  mysql_query("SET CHARSET cp1251");
if (empty($stat['id']) || $stat['bloked']) {
  print "<script>top.location='index.php?action=logout'</script>";
  exit;
}


$CH = date("H");
$CM = date("i");
$CS = date("s");

?>
<BODY onload="init(); top.RefreshChat(); showTime(); tl();" leftmargin=0 topmargin=0 rightmargin=0 bgcolor=#000000 oncontextmenu="return false;">
<script LANGUAGE="JavaScript">
function smiles() {
  var x = event.screenX - 150;
  var y = event.screenY - 350;
  var sFeatures = "dialogLeft:"+x+"px;dialogTop:"+y+"px;dialogHeight:380px;dialogWidth:305px;help:no;status:no;unadorned:yes";
  window.showModelessDialog("smiles.html", window, sFeatures);
}

var FocusTimeOut;

function DoFocus() { top.bottom.out.text.focus(); }

function FocusText() { FocusTimeOut=setTimeout(DoFocus,10); }

function init() {
FocusText();
top.chat.document.write("<html><head><link rel=stylesheet type=\"text/css\" href=\"i/main.css\">");
top.chat.document.write("<meta http-equiv=Content-Type content=\"text/html; charset=windows-1251\"><META Http-Equiv=Cache-Control Content=no-cache><meta http-equiv=PRAGMA content=NO-CACHE><META Http-Equiv=Expires Content=0></head>");
top.chat.document.write("<body bgcolor=#cecece oncontextmenu=\"return false;\"><DIV ID=chat_form style='position:absolute; visibility:hidden'></DIV>");
top.chat.document.write("<\script>function check_ctrl(){ CtrlPress=window.event.ctrlKey; }<\/script>");
top.chat.document.write("<DIV ID=oMenu CLASS=\"menu\" onmouseout=\"top.closeMenu()\" width=0 height=0></DIV>");
top.chat.document.write("<div id=MyChat>");
}

function ch_form () {
  var t = document.out.text.value;
  if (t == "//exit" || t == "// exit") { top.window.location="index.php?action=logout"; return false; }
  if (t == "//refresh" || t == "// refresh") { top.window.location.reload(); return false; }
  if (t == "//admins" || t == "// admins") { window.open("admins.php","","width=300,height=400,noresizable"); return false; }
}

function tl()
{
        var size = document.body.clientWidth-214;
        if (size<80) { size=80 }
        document.out.text.width = size;
}
window.onresize=tl;
</SCRIPT>

<table height="40" cellpadding="0" cellspacing="0" background="i/chat/back.gif" width="100%">
<tr>
<FORM action="chat.php?action=send" target="hdn" method="post" name=out onsubmit="ch_form(); top.StopChatTimer();">

<input type="hidden" value="-1" name="message_id">
<input type="hidden" name="act" value="">

<td>[img]i/chat/left.gif[/img]</td>
<td>[img]i/chat/Chat.gif[/img]
<input type="submit" name="sbm" style="display:none"></td>
        <td valign="middle" id="input" width="100%"><input type="text" size="100%" maxlength="250" name="text" class=inputpr style="BORDER-RIGHT: 0px solid; BORDER-LEFT: 0px solid"></td>
        <td><input type=image src="i/chat/say.gif" width="31" height="40" style="cursor: pointer" border="0" title="Отправить сообщение" class=inputs>
        </td>
        <td>[img]i/chat/erase.gif[/img]</td>
<?
 if ($stat['admin'] == 1) 
echo "<td><img src='i/chat/system.gif' width=27 height=40 border=0 style='cursor: pointer' title='Центр администрирования' onclick=\"parent.main.location='admin/index.php?';\"></td>";

if ($stat['admin'] == 1 || (($stat['rank'] >= 12 && $stat['rank'] < 15) || $stat['rank'] >= 98)) 
    echo "<td><img src='i/chat/transl.gif' width=27 height=40 border=0 style='cursor: pointer' title='Отчёт о переводах' onclick=\"parent.main.location='perevod.php?';\"></td>";

?>
    <td>[img]i/chat/smile.gif[/img]</td>
        <td background="i/chat/br_c.gif" width="21" nowrap></td>
        <td>[img]i/chat/dop_invent.gif[/img]</td>
<?
if ($stat['level'] >= 4)
    echo "<td><img src='i/chat/dop_peredach.gif' width=24 height=40 border=0 style='cursor: pointer' title='Передача предметов / кредитов' onclick=\"parent.main.location='main.php?set=transfer';\"></td>";
if ($stat['sclon'] == 'dark') 
        echo "<td><img src='i/chat/dop_dark.gif' width=24 height=40 border=0 style='cursor: pointer' title='ТЬма' onclick=\"parent.main.location='dark.php?';\"></td>";
if ($stat['sclon'] == 'light') 
        echo "<td><img src='i/chat/dop_light.gif' width=24 height=40 border=0 style='cursor: pointer' title='Свет' onclick=\"parent.main.location='light.php?';\"></td>";
 if ($stat['tribe']) 
        echo "<td><img src='i/chat/dop_klan.gif' width=24 height=40 border=0 style='cursor: pointer' title='Клан' onclick=\"parent.main.location='main.php?set=clan';\"></td>";
if (($stat['rank'] >= 10 && $stat['rank'] < 15) || $stat['rank'] >= 98) 
echo "<td><img src='i/chat/dop_neutral.gif' width=24 height=40 border=0 style='cursor: pointer' title='Инквизиция' onclick=\"parent.main.location='guard.php?';\"></td>";

?>
        <td background="i/chat/br_d.gif" width="17" nowrap></td>

        <td valign="middle" background="i/chat/back_c.gif"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,28,0" width="70" height="27">
        <param name="movie" value="i/chat/clock.swf?h=<?=$CH;?>&m=<?=$CM;?>&s=<?=$CS;?>" /><param name="quality" value="high" />
    <param name="bgcolor" value="#000000" />
    <embed 
        src="i/chat/clock.swf?h=<?=$CH;?>&m=<?=$CM;?>&s=<?=$CS;?>"
    quality="high"
    bgcolor="#000000"
        width="70"
        height="27"
    type="application/x-shockwave-flash"
    pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></td>
    
        <td>[img]i/chat/exit.gif[/img]</td>
        <td background="i/chat/right.gif" width="39" nowrap></td>
        </form>
</tr>
</table>

<iframe name="pinger" id="pinger" width="1" height="1" style="position: absolute;"></iframe>

</body>
</html>
 
Ты наверно chat.php say.php /inc/chat/functions.php разные поставил, ставь от одной версии
 
Мде...(((( Я паникую! Ничего не получается! У меня последняя сборака алекса про!

Вот functions.php


Код:
<?php
function insert_msg($msg,$to_login,$private,$system = 0, $system_to = "", $redirect = "", $rooms = "", $to_clan="") {
  global $stat;
if ($rooms=="") { $rooms = ""; }
  if ($private!="") { $rooms = ""; }
  $bot = mysql_fetch_array(mysql_query("SELECT rank FROM players WHERE user = '$to_login'"));
  mysql_query("LOCK TABLES `chat` WRITE");
  mysql_query("INSERT INTO `chat` (`id`,`room`,`login`,`date`,`msg`,`system`,`system_to`,`redirect`,`to_login`,`private`,`color`,`to_clan`) VALUES (NULL, '".$rooms."', '".$stat['user']."', '".time()."', '".$msg."','".$system."','".$system_to."','".$redirect."','".$to_login."','".$private."','".$stat['color']."','".$to_clan."')");
  mysql_query("UNLOCK TABLES");
  if ($bot[rank]==60){
  include("inc/chat/bot_text.php");
  mysql_query("LOCK TABLES `chat` WRITE");
  mysql_query("INSERT INTO `chat` (`id`,`room`,`login`,`date`,`msg`,`system`,`system_to`,`redirect`,`private`,`color`) VALUES (NULL, '".$rooms."', '".$to_login."', '".time()."', '".$msg."','".$system."','".$system_to."','".$redirect."','".$stat['user']."','red')");
  mysql_query("UNLOCK TABLES");
  }
  if ($bot[rank]==61){
  include("inc/chat/inf_text.php");
  mysql_query("LOCK TABLES `chat` WRITE");
  mysql_query("INSERT INTO `chat` (`id`,`room`,`login`,`date`,`msg`,`system`,`system_to`,`redirect`,`private`,`color`) VALUES (NULL, '".$rooms."', '".$to_login."', '".time()."', '".$msg."','".$system."','".$system_to."','".$redirect."','".$stat['user']."','red')");
  mysql_query("UNLOCK TABLES");
  }
  if ($bot[rank]==62){
  include("inc/chat/spam_text.php");
  mysql_query("LOCK TABLES `chat` WRITE");
  mysql_query("INSERT INTO `chat` (`id`,`room`,`login`,`date`,`msg`,`system`,`system_to`,`redirect`,`private`,`color`) VALUES (NULL, '".$rooms."', '".$to_login."', '".time()."', '".$msg."','".$system."','".$system_to."','".$redirect."','".$stat['user']."','red')");
  mysql_query("UNLOCK TABLES");
  }
}
?>

Помогите кто нибудь!Буду очень признателен!
 
Как то странно! Взял я мою игру, токо не переделанную и поставил на localhost!
Скопировал chat.php,say.php, папку chat, таблицу chat из игры моей и вставил все в не переделанную!Думал не будет работать, а вот и нет!Приват не видно!Значит я подумал что ошибка не в этих файлах, а в чем тогда может быть?
 
Может, но где именно?Кто поможет буду всегда рейтинг повышать!Отблагодарю как смогу!
 
Код:
 mysql_query("INSERT INTO `chat` mysql_query("INSERT INTO `chat`(`id`,`room`,`login`,`date`,`msg`,`system`,`system_to`,`redirect`,`private`,`color`) VALUES (NULL, '".$rooms."', '".$to_login."', '".time()."', '".$msg."','".$system."','".$system_to."','".$redirect."','".$stat['user']."','red')");

в общем возможно у тебя в базе нет поля `private`
 
Статус
В этой теме нельзя размещать новые ответы.
Сверху