Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,415
    Thanks
    269
    Thanked 32 Times in 31 Posts

    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

  • #2
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Javascript question, not PHP.

  • #3
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,415
    Thanks
    269
    Thanked 32 Times in 31 Posts
    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

  • #4
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    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.

  • #5
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    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/

  • #6
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,415
    Thanks
    269
    Thanked 32 Times in 31 Posts
    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.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •