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!


Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2008
    Location
    Victoria, Australia
    Posts
    462
    Tokens
    2,114
    Habbo
    Fiendly

    Latest Awards:

    Default Need help with two things.. PHP+ShoutCast

    First things first.
    Looking to have the Current DJ/Description outputted onto my webserver. Looking for a small simple code for this, nothing too complex. Anyone know how to do this?

    Also:
    Any idea on how to refresh a php script without reloading the page, or infact reload a div tag?
    Looked at a few scripts but they seem to confusing to my tastes so does anyone know how?

    +rep to everyone who helps

  2. #2
    Join Date
    May 2007
    Location
    Canada
    Posts
    172
    Tokens
    137

    Default

    Firstly, you can use a simple stats script to output the current DJ to your viewers. If it is a log your looking to save, then why not have it send that to the FTP? in a secure directory that only you have access to. Though, like I said, to output DJ Information, all you need is a simple Radio Status PHP scrip, which you can find at http://habboemotion.net under their resources section.

    Secondly, you can refresh a php script by using ajax, though personally I don't use much of it. But another solution is to put it in your root directoy (the php file) or whatever directory , though I find the root works best, and then do a php include like so

    Code:
     
    <?php include('filename.php')?>
    if the code above doesn't work just google php includes
    Last edited by tdog360; 22-01-2011 at 10:27 AM.



    Habboxlive.com

  3. #3
    Join Date
    Sep 2009
    Location
    Hull
    Posts
    827
    Tokens
    0

    Latest Awards:

    Default

    For your shoutcast script, habboemotion should have one...

    And as for your refreshing div thing, you can use jquery

    put this in your <head></head> tags...

    <head>

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>

    <script type="text/javascript">

    $(document).ready(function() {
    $("#this_div").load("dj_stats.php");
    var refreshId = setInterval(function() {
    $("#this_div").load("dj_stats.php");
    }, 5000); /* 1 second = 1000 */
    });

    </script>

    </head>

    <body>
    <div id="this_div"></div>
    </body>
    That will basically load dj_stat.php into that div every 5 seconds...

    Enjoy, Lew.
    Last edited by LMS16; 22-01-2011 at 10:31 AM.
    Im not here to be loved, I love to be hated :-}


  4. #4
    Join Date
    Dec 2008
    Location
    Victoria, Australia
    Posts
    462
    Tokens
    2,114
    Habbo
    Fiendly

    Latest Awards:

    Default

    Quote Originally Posted by LMS16 View Post
    For your shoutcast script, habboemotion should have one...

    And as for your refreshing div thing, you can use jquery

    put this in your <head></head> tags...



    That will basically load dj_stat.php into that div every 5 seconds...

    Enjoy, Lew.
    Unfortunately thats not working for me..

    Code:
    <html>
     <head>
      <script type="text/javascript" src="../stats.js"></script>
      <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
    
    <script type="text/javascript">
    
    $(document).ready(function() {
    $("#stats").load("stats.php");
    var refreshId = setInterval(function() {
    $("#stats").load("stats.php");
    }, 5000); /* 1 second = 1000 */
    });
    
    </script>
     
    <link rel="icon" href="images/favicon.ico" type="image/x-icon">
    
        <title>Crossfire</title>
    </head> 
    
     <body>
    
      <div id="stats">
       <?php echo $viewerCount; ?>
      </div>
    
     </body>
    </html>
    Am I doing anything wrong? Just getting a blank page..

  5. #5
    Join Date
    Sep 2009
    Location
    Hull
    Posts
    827
    Tokens
    0

    Latest Awards:

    Default

    That jquery refresh's a page into a blank div. It doesnt refresh the content inside the div. Put that script on a seperate page and load the shoucats script into it.

    You'll work it out

    Lew.
    Im not here to be loved, I love to be hated :-}


Posting Permissions

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