Author Topic: Message and Friendship Requests real time notification by csibusz  (Read 2009 times)

csibusz

  • Prime Member
  • ****
  • Posts: 165
  • Karma: +17/-2
Message and Friendship Requests real time notification by csibusz

Message :

Code: [Select]
$query = "SELECT*FROM `dsb_user_inbox` ";
$result = mysql_query($query);

// Return the results, loop through them and echo

while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
if ($row['is_read'] == 1){
      echo '';}
    elseif ($_SESSION[_LICENSE_KEY_]['user']['user_id'] == $row['fk_user_id']){
      echo '<center>
    <p><table border="0" cellspacing="0" cellpadding="10" bgcolor="red"><tbody><tr><td style="padding: 10px; background: red">
<b><a href="mailbox.php"><font color="white">'.$row['_user_other'].' sent a message</font></a></b></td></tr></tbody></table></p></center>'; } break ;
}


Friendship Requests :

Code: [Select]
$query = "SELECT*FROM `dsb_user_networks` ";
$result = mysql_query($query);

// Return the results, loop through them and echo

while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
if ($row['nconn_status'] == 1){
      echo '';}
    elseif ($_SESSION[_LICENSE_KEY_]['user']['user_id'] == $row['fk_user_id_other']){
      echo '<center>
    <p><table border="0" cellspacing="0" cellpadding="10" bgcolor="red"><tbody><tr><td style="padding: 10px; background: red">
<b><a href="friendship_requests.php"><font color="white">Friendship Requests!</font></a></b></td></tr></tbody></table></p></center>';}
}

notification.php :

Code: [Select]
<?php
/******************************************************************************
Etano
===============================================================================
File:                       home.php
$Revision: 679 $
Software by:                DateMill (http://www.datemill.com)
Copyright by:               DateMill (http://www.datemill.com)
Support at:                 http://www.datemill.com/forum
*******************************************************************************
* See the "docs/licenses/etano.txt" file for license.                         *
******************************************************************************/

require 'includes/common.inc.php';
require 
_BASEPATH_.'/includes/user_functions.inc.php';
require 
_BASEPATH_.'/skins_site/'.get_my_skin().'/lang/home.php';







$query "SELECT*FROM `dsb_user_inbox` ";
$result mysql_query($query);

// Return the results, loop through them and echo

while($row mysql_fetch_array($resultMYSQL_ASSOC))
{
if (
$row['is_read'] == 1){
      echo 
'';}
    elseif (
$_SESSION[_LICENSE_KEY_]['user']['user_id'] == $row['fk_user_id']){
      echo 
'<center>
    <p><table border="0" cellspacing="0" cellpadding="10" bgcolor="red"><tbody><tr><td style="padding: 10px; background: red">
<b><a href="mailbox.php"><font color="white">'
.$row['_user_other'].' sent a message</font></a></b></td></tr></tbody></table></p></center>'; } break ;
}



$query "SELECT*FROM `dsb_user_networks` ";
$result mysql_query($query);

// Return the results, loop through them and echo

while($row mysql_fetch_array($resultMYSQL_ASSOC))
{
if (
$row['nconn_status'] == 1){
      echo 
'';}
    elseif (
$_SESSION[_LICENSE_KEY_]['user']['user_id'] == $row['fk_user_id_other']){
      echo 
'<center>
    <p><table border="0" cellspacing="0" cellpadding="10" bgcolor="red"><tbody><tr><td style="padding: 10px; background: red">
<b><a href="friendship_requests.php"><font color="white">Friendship Requests!</font></a></b></td></tr></tbody></table></p></center>'
;}
}




Include javascript code frame.html header tag refresh time 3 ms

libritario

  • Confirmed Member
  • **
  • Posts: 7
  • Karma: +0/-0
Re: Message and Friendship Requests real time notification by csibusz
« Reply #1 on: July 25, 2014, 12:43:55 PM »
I do not found this file notification.php

csibusz

  • Prime Member
  • ****
  • Posts: 165
  • Karma: +17/-2
Re: Message and Friendship Requests real time notification by csibusz
« Reply #2 on: July 26, 2014, 02:07:19 AM »
create notification.php

Code: [Select]
<?php
/******************************************************************************
Etano
===============================================================================
File:                       home.php
$Revision: 679 $
Software by:                DateMill (http://www.datemill.com)
Copyright by:               DateMill (http://www.datemill.com)
Support at:                 http://www.datemill.com/forum
*******************************************************************************
* See the "docs/licenses/etano.txt" file for license.                         *
******************************************************************************/

require 'includes/common.inc.php';
require 
_BASEPATH_.'/includes/user_functions.inc.php';
require 
_BASEPATH_.'/skins_site/'.get_my_skin().'/lang/home.php';







$query "SELECT*FROM `dsb_user_inbox` ";
$result mysql_query($query);

// Return the results, loop through them and echo

while($row mysql_fetch_array($resultMYSQL_ASSOC))
{
if (
$row['is_read'] == 1){
      echo 
'';}
    elseif (
$_SESSION[_LICENSE_KEY_]['user']['user_id'] == $row['fk_user_id']){
      echo 
'<center>
    <p><table border="0" cellspacing="0" cellpadding="10" bgcolor="red"><tbody><tr><td style="padding: 10px; background: red">
<b><a href="mailbox.php"><font color="white">'
.$row['_user_other'].' sent a message</font></a></b></td></tr></tbody></table></p></center>'; } break ;
}



$query "SELECT*FROM `dsb_user_networks` ";
$result mysql_query($query);

// Return the results, loop through them and echo

while($row mysql_fetch_array($resultMYSQL_ASSOC))
{
if (
$row['nconn_status'] == 1){
      echo 
'';}
    elseif (
$_SESSION[_LICENSE_KEY_]['user']['user_id'] == $row['fk_user_id_other']){
      echo 
'<center>
    <p><table border="0" cellspacing="0" cellpadding="10" bgcolor="red"><tbody><tr><td style="padding: 10px; background: red">
<b><a href="friendship_requests.php"><font color="white">Friendship Requests!</font></a></b></td></tr></tbody></table></p></center>'
;}
}



libritario

  • Confirmed Member
  • **
  • Posts: 7
  • Karma: +0/-0
Re: Message and Friendship Requests real time notification by csibusz
« Reply #3 on: August 01, 2014, 12:45:59 AM »
Where do I put this file ? on main folder??
Please I need u explain little more where do I have to put each code..
Thanks

AF

  • Prime Member
  • ****
  • Posts: 117
  • Karma: +3/-2
Re: Message and Friendship Requests real time notification by csibusz
« Reply #4 on: September 15, 2015, 12:24:16 AM »
Has anyone implemented this live notification yet??

AF

  • Prime Member
  • ****
  • Posts: 117
  • Karma: +3/-2
Re: Message and Friendship Requests real time notification by csibusz
« Reply #5 on: September 16, 2015, 11:31:41 PM »
And... where is the js code that you mentioned to place in the header tags??

Include javascript code frame.html header tag refresh time 3 ms


csibusz

  • Prime Member
  • ****
  • Posts: 165
  • Karma: +17/-2
Re: Message and Friendship Requests real time notification by csibusz
« Reply #6 on: October 27, 2015, 06:25:03 AM »
libritario yes main folder

JohnHarperJr

  • Active Member
  • ***
  • Posts: 78
  • Karma: +6/-0
    • SocialGratis.com
Re: Message and Friendship Requests real time notification by csibusz
« Reply #7 on: October 31, 2015, 09:30:55 PM »
And... where is the js code that you mentioned to place in the header tags??

Include javascript code frame.html header tag refresh time 3 ms

For those of you not familiar with javascript,


Code: [Select]
<meta http-equiv="refresh" content="5; URL=http://www.yourdomain.com/yoursite.html">

OR

Code: [Select]
<script>
setTimeout(function(){
   window.location.reload(1);
}, 5000);
</script>

Tooken

  • Prime Member
  • ****
  • Posts: 146
  • Karma: +3/-0
Re: Message and Friendship Requests real time notification by csibusz
« Reply #8 on: November 29, 2015, 07:22:17 PM »
Hi,

It is a good mod and I've  implemented this but the downside  I noticed is that the refreshing does it to the whole page and not just to the new messages item. If someone is writing a message for example and takes longer than the refresh time that is set, loses all the data when the page refreshes. Anything I am doing wrong? Or any improvement on this?
thanks
David