Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-04-2010, 05:48 PM   PM User | #1
durangod
Senior Coder

 
Join Date: Nov 2010
Posts: 1,177
Thanks: 214
Thanked 31 Times in 30 Posts
durangod is on a distinguished road
check which user has window open

hi i was reading this but i tried it and i could not get it to work correctly.

here is what im trying to do, i installed a shout box for my users, its integrated by using session username.

but what i want to do is have a username list under the shoutbox that shows which members (usernames) have the box open. that way the other members can see someone is out there to see their message..

one alternative would be to just have the shoutbox auto open (which i need to learn how to do) as soon as they sign on to the site, but what if they close it right away i still have the same issue (they cant see the message that someone is sending them)

here is how i open the window now, they have to click on the link.
Code:
<a href="#" onClick="javascript:popup=window.open('shoutbox/minichat.php','SHTB','status=0,menubar=0,resizable=0,scrollbars=0,width=297px,height=300px');"><font size="2">Shoutbox</font></a>
i was told this was a php question not javascript so

so how do i know which users have it open?
and how to i autostart the shoutbox? (do i used onload and onunload ??)

thanks
durangod is offline   Reply With Quote
Old 11-04-2010, 05:50 PM   PM User | #2
MattF
Senior Coder

 
Join Date: Jul 2009
Location: South Yorkshire, England
Posts: 2,322
Thanks: 6
Thanked 304 Times in 303 Posts
MattF will become famous soon enoughMattF will become famous soon enough
Javascript question, not PHP.
MattF is offline   Reply With Quote
Old 11-04-2010, 05:52 PM   PM User | #3
durangod
Senior Coder

 
Join Date: Nov 2010
Posts: 1,177
Thanks: 214
Thanked 31 Times in 30 Posts
durangod is on a distinguished road
ok so now what omg, i have one post in javascript section and one post here in php section and both tell me its not php and not javascript, ok so now what do i try, i dont want to have multiple threads... lol
durangod is offline   Reply With Quote
Old 11-04-2010, 05:58 PM   PM User | #4
MattF
Senior Coder

 
Join Date: Jul 2009
Location: South Yorkshire, England
Posts: 2,322
Thanks: 6
Thanked 304 Times in 303 Posts
MattF will become famous soon enoughMattF will become famous soon enough
The only part which may be PHP related is integrating the link into your page. Other than that, definitely all JS related. With regards to the auto loading, that'll be akin to an onload event. There is the function loader method somewhere if you do a search, which is more reliable, if I recall correctly. As to the window issue, you should find the answer here:

http://w3schools.com/jsref/obj_window.asp


Edit: This may actually involve a bit of both if you're planning on polling the server to display a list of which users are currently available to the other users. You'll probably need to use a combination of AJAX for the polling and then a server side PHP script to maintain the current status of each user and notify the other users of such. In all honesty, your best approach is going to be to use a pre-made shoutbox script. You'll have a bugger of a time doing this from scratch unless you're really JS oriented.

Last edited by MattF; 11-04-2010 at 06:05 PM..
MattF is offline   Reply With Quote
Old 11-04-2010, 07:44 PM   PM User | #5
MattF
Senior Coder

 
Join Date: Jul 2009
Location: South Yorkshire, England
Posts: 2,322
Thanks: 6
Thanked 304 Times in 303 Posts
MattF will become famous soon enoughMattF will become famous soon enough
Just doing a quick search, this one looks like it may be something akin to the type of thing you want. A GPL IM type affair. This is the first time I've ever seen the site/software, so have no idea how good/bad it may be:

http://www.fleaim.com/
MattF is offline   Reply With Quote
Old 11-04-2010, 10:36 PM   PM User | #6
durangod
Senior Coder

 
Join Date: Nov 2010
Posts: 1,177
Thanks: 214
Thanked 31 Times in 30 Posts
durangod is on a distinguished road
thanks for the input, im gonna do some looking thru my social site script, i know i have ajax used on here already, and i already have and chat room and it uses ajax...

what im using for my little shoutbox is this

http://spacegirlpippa.co.uk/ just to show you what im using...


i managed to get what i want going (still need to tweek) by changing my open window from the link to open it, to a auto javascript. otherwise it was not able to pick up the window name.. now it picks up the window name on autoload and i can click a (check window) button and it will tell me if the window is open or closed... but i need to get rid of the button checker

that part works fine...


now all i need to do is set and grab the switch open or closed during the session with every page, post the session user name to it and echo the associated username under the shoutbox...

when they close the window or logg off it sets the close switch to closed and takes them off the list...

what i am working on at the moment is to see where best to post this check open or closed code so that it checks with every page... i am considering just making it a session var, i think that would be better maybe, just to do that and call the isset for $_SESSION['boxopen'] each page... im still noodling over this..

Last edited by durangod; 11-04-2010 at 10:38 PM..
durangod is offline   Reply With Quote
Reply

Bookmarks

Tags
check window open, which user window open

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:43 AM.


Advertisement
Log in to turn off these ads.