Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Website Alerter

  1. #1
    Join Date
    Oct 2007
    Posts
    824
    Tokens
    71

    Latest Awards:

    Default Website Alerter

    I need to code an alerter script that can alert everyone who is currently viewing my site in real time. A javascript alert would do.

    How should I do that, and no i'm not asking for the script, i'm asking how to do it and what I should use so don't flame me (which happens to about 97% of the people who ask questions on here).

  2. #2
    Join Date
    Aug 2005
    Location
    London
    Posts
    9,773
    Tokens
    146

    Latest Awards:

    Default

    Well you'll have to have an frame/section of the site that automatically refreshes automatically (Eg the radio stats or any other flatfiles that will be put onto the main page from an external page). You would have to then open the page , add the javascript alert code to the flatfile and when the frame reloads automatically the alert would be popped up , then you could re edit the file and remove it.

    That's the only basic and logical way that I can think off doing it .

  3. #3
    Join Date
    Sep 2005
    Location
    East London
    Posts
    3,028
    Tokens
    0

    Latest Awards:

    Default

    ajax...

  4. #4
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Send an AJAX request to a file ex: viewAlerts.php

    in viewAlerts.php it connects to the database, and checks for messages

    it returns the message to the Javascript or returns 0 if there isn't any. If it returns a message, PHP will set a cookie/session for that EX: $_SESSION['alert_' . $id];

    Javascript checks to see if it was 0, if else it was a message.. and it alerts it.

  5. #5
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    I don't see why'd you need to set a session?
    Hi, names James. I am a web developer.

  6. #6
    Join Date
    Aug 2006
    Location
    Manchester, UK
    Posts
    2,016
    Tokens
    141
    Habbo
    florx

    Latest Awards:

    Default

    So you don't keep getting the alert every time the AJAX requests the page.

  7. #7
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Quote Originally Posted by Jahmes View Post
    I don't see why'd you need to set a session?
    You could also set a cookie.

  8. #8
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Dentafrice View Post
    You could also set a cookie.
    Mmm.. Cookies!

    Why would you use both, thats just a waste of code.

  9. #9
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    I never thought of that.
    Hi, names James. I am a web developer.

  10. #10
    Join Date
    Oct 2007
    Posts
    824
    Tokens
    71

    Latest Awards:

    Default

    Thanks Dent, ill try it out

Page 1 of 2 12 LastLast

Posting Permissions

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