Update messages with correspondence.


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
16 views
Guys tell me how to do that would be in correspondence on the website posts updated ? Now if the answer message to leave but the new look until you reload the page ? Don't know what file to throw in here that the file structure itself of correspondence correspondence is here ajax_user.php
<?session_start();require_once('../connect/connect.php');include_once('../lib/lib.php');require('../user/pdk.php');$id_tema = intval($_POST['id_tema']);$vizavi = intval($_POST['vizavi']);$tema=$_POST['tema'];$r = mysql_query("SELECT * FROM mess WHERE id_tema=".$id_tema."AND ( (komu=".$vizavi." AND ot_kogo=".$_SESSION['ID_P'][1].") OR (ot_kogo=".$vizavi." AND komu=".$_SESSION['ID_P'][1].") )");$yes_tema = mysql_num_rows($r);$r = mysql_query("SELECT * FROM mess_blok WHERE kto_ud = '".$vizavi."' AND kogo_ud  = '".intval($_SESSION['ID_P'][1])."'");$nr = mysql_num_rows($r);if($nr)$err = 'Этот пользователь занес Вас в черный список. Вы не можете оставлять ему сообщения';else{if(isset($_POST['message']) && $yes_tema){$me=_pre2($_POST['message']);$mess=$me[1];if(!$mess) $err .= "Введите текст сообщения<br>"; if(!$err) { if($vizavi==0) { $autor_komu='Administrator'; $email = $rru['email']; } else { $r=mysql_query("SELECT id_akk, contakt, email FROM akk WHERE id_akk='".$vizavi."'"); $nr = mysql_num_rows($r); if(!$nr) { $err .= "There is no such user
"; } else { $rr=mysql_fetch_array($r); $autor_komu=$rr['contakt']; $email = $rr['email']; } } if(!$err) { $vz = max($_SESSION['ID_P'][1], $vizavi).'_'.min($_SESSION['ID_P'][1], $vizavi); $query="INSERT INTO mess ( ot_kogo, autor, autor_komu, komu, mess data tema, id_tema, vz ) VALUES ( '".$_SESSION['ID_P'][1]."', '".$_SESSION['ID_P'][3]."', '".$autor_komu."', '".$vizavi."', '".$mess."', NOW(), '".anti(urldecode($tema))."', '".$id_tema."', '".$vz."' ) "; if(!mysql_query($query)) { $err = 'failed to send message'; } else { $ok = 'Message sent'; if($vizavi) { $c='Hello!

You received a message on the site '.$_SERVER['HTTP_HOST'].'
To view the message go to my account

Sincerely, site administration '.$_SERVER['HTTP_HOST'].' '; $thm='Received a message on the site '.$_SERVER['HTTP_HOST']; } else { $c='Hello!

You received a message on the site '.$_SERVER['HTTP_HOST']; $thm='Message for site administrator '.$_SERVER['HTTP_HOST']; } @mail_utf8($email, $thm, $c, $rru['email']); } } } } } if($err) { ?> document.getElementById('err').innerHTML = '<?=$err?>';document.getElementById('id_message').value = '';<?}else{?>document.getElementById('err').innerHTML = '<?=$ok?>';document.getElementById('id_message').value = '';<?}if($yes_tema){if($vizavi>0){$r=mysql_query("SELECT * FROM akk WHERE id_akk='".$vizavi."'");$nr=mysql_num_rows($r);if($nr){$rr=mysql_fetch_array($r);$autor_komu=$rr['contakt'];$lok=" id_tema = ".$id_tema." AND ((ot_kogo='".$vizavi."' AND komu='".$_SESSION['ID_P'][1]."' )OR (ot_kogo='".$_SESSION['ID_P'][1]."' AND komu='".$vizavi."')) ";$da=1;}}elseif($vizavi===0){$autor_komu='Администратор';$lok=" id_tema = ".$id_tema." AND ((ot_kogo='".$vizavi."' AND komu='".$_SESSION['ID_P'][1]."' )OR (ot_kogo='".$_SESSION['ID_P'][1]."' AND komu='".$vizavi."')) ";$da=1;}}if($da){mysql_query("UPDATE mess SET pr=1 WHERE id_tema='".$id_tema."' AND ot_kogo='".$vizavi."' ");$query = "SELECT * FROM messWHERE ".$lok."ORDER BY data DESC ";//echo $query;$Recordset1 = mysql_query($query);while ($row_Recordset1 = mysql_fetch_array($Recordset1)){echo ''; if($row_Recordset1['ot_kogo']==$_SESSION['ID_P'][1]) // outbound { echo ''; echo ''; echo str_replace("\","
",trim($row_Recordset1['mess'])); echo '
'.date("d-my [H:i]", strtotime($row_Recordset1['data'])); if(!$row_Recordset1['pr']) echo ' unread'; echo ''; echo ''; echo ''.$row_Recordset1['autor'].''; } else // incoming { echo ''; echo ''.$row_Recordset1['autor'].''; echo ''; echo ''; echo str_replace("\","
",trim($row_Recordset1['mess'])); echo '
'.date("d-my [H:i]", strtotime($row_Recordset1['data'])); echo ''; } echo ''; } } ?>

5aec85e729eb0932868328.png
by | 16 views

3 Answers

0 like 0 dislike
Without seeing the code, I would say that you need ajax. But seeing the code I realized that you need a programmer.
by
0 like 0 dislike
You to freelancing.
by
0 like 0 dislike
Code is of course terrible, but people apparently learn and asked a question. What attacked?
On topic:
1 you Can use Ajax (Google ajax javascript setInterval)
2 But it is better to use WebSocket
by
110,608 questions
257,187 answers
0 comments
40,796 users