PHP/JS messenger

how to create php instant messanger

Page 1 of 1

4 Replies - 1436 Views - Last Post: 17 August 2009 - 10:27 AM

#1 it_1  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 15
  • Joined: 10-August 09

PHP/JS messenger

Posted 17 August 2009 - 12:23 AM

Hi friends,

i have issues in creating messagner in php .
in that am using ajax , php and mysql to create messagner.


am using two pages messagner login window(messagner login.php) ) and mesagner chat window(messagner.php)

the following lines am giving my issues how to solve that,

1.when the person (x) is sending message to person(Y) in that,the person(X) corrsponding windows is open already,

in mycode, am refreshing the page( messagner login.php) at regular intervals for identifying if the person received any message from other users,its for opening the messagner window.
i.e if the person(x) sended message to person(y) when the person(y) logined to show the messagner box with person(x) sended message.after that,they both chat vice versa through that messagner window.

but if the person(y) sending the respose message to person(x) here messagner window is refreshing only once.here is that my issue i dont want to refresh the person(x) window after the person opened already.


i hope i get excellent ideas from this forum,and also new chat idea also am excepting please any one reply me fastly.

Is This A Good Question/Topic? 0
  • +

Replies To: PHP/JS messenger

#2 Wimpy  Icon User is offline

  • R.I.P. ( Really Intelligent Person, right? )
  • member icon

Reputation: 159
  • View blog
  • Posts: 1,038
  • Joined: 02-May 09

Re: PHP/JS messenger

Posted 17 August 2009 - 01:51 AM

This issue is more related to Javascript than to PHP... Well...

All comes down to how you open your chat windows, a simple javascript popup or some kind of a custom window? No matter how you do it you should be able to keep a reference to the window you have opened, when you get a new message for a specific user check if a window is already opened using the corresponding window-reference (if there are any yet). If the window is not open or if a reference does not exist open a new window. :)
Was This Post Helpful? 0
  • +
  • -

#3 it_1  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 15
  • Joined: 10-August 09

Re: PHP/JS messenger

Posted 17 August 2009 - 03:37 AM

View PostWimpy, on 17 Aug, 2009 - 12:51 AM, said:

This issue is more related to Javascript than to PHP... Well...

All comes down to how you open your chat windows, a simple javascript popup or some kind of a custom window? No matter how you do it you should be able to keep a reference to the window you have opened, when you get a new message for a specific user check if a window is already opened using the corresponding window-reference (if there are any yet). If the window is not open or if a reference does not exist open a new window. :)




yes,i did it,here is my sample code

function call()
{
var new_window;
if(!new_window||new_window.closed)
{
new_window =window.open('index.html',''xxxx","height=400,width=500");
}
else
{
new_window.focus();
}
setTimeout("call()",1500);
}


in this,the code is window is already opened and new window is opening continusoly.


how to solve that..

<html>
<body onload="call()">
welcome
</body>
</html>

am using
Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6058
  • View blog
  • Posts: 23,494
  • Joined: 23-August 08

Re: PHP/JS messenger

Posted 17 August 2009 - 08:13 AM

Moving to Javascript
Was This Post Helpful? 1

#5 Wimpy  Icon User is offline

  • R.I.P. ( Really Intelligent Person, right? )
  • member icon

Reputation: 159
  • View blog
  • Posts: 1,038
  • Joined: 02-May 09

Re: PHP/JS messenger

Posted 17 August 2009 - 10:27 AM

What is the problem? Does multiple windows appear or what? What you have there should work just fine without opening multiple windows! Be more specific please!

View Postit_1, on 17 Aug, 2009 - 12:37 PM, said:

yes,i did it,here is my sample code
function call()
{
	 var new_window;
	  if(!new_window||new_window.closed)
	 {
			new_window  =window.open('index.html',''xxxx","height=400,width=500");
	  }
	 else
	{
			   new_window.focus();
	 }
	  setTimeout("call()",1500);
}

in this,the code is window is already opened and new window is opening continusoly.

how to solve that..
<html>
<body onload="call()">
welcome
</body>
</html>


am using

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1