View Full Version : check which user has window open

11-04-2010, 06:48 PM
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.

<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 ??)


11-04-2010, 06:50 PM
Javascript question, not PHP.

11-04-2010, 06:52 PM
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

11-04-2010, 06:58 PM
The only part which may be PHP related is integrating the link into your page. Other than that, definitely all JS related. :D 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:


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.

11-04-2010, 08:44 PM
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:


11-04-2010, 11:36 PM
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..