Log in

View Full Version : Counters and such



additional
12-04-2006, 08:02 AM
Ok, I need somebody to tell me the script for "Habbo's In Hotel". So how many habbos are checked in. I know its PHP, I've had it before but I've losted it. I'm also looking for a hit counter script, simple so every time someboody goes onto the site it adds a hit to the counter. Also, how many users are online (on my site). If you could reply with the codes, that would be most helpful. Thanks.

Mentor
12-04-2006, 12:52 PM
This has all been said before.


Ok. First 2 are easy, (users online + hit counter) both scripts can be found in my tutoral
http://thybag.co.uk/index.php?p=Tutorials&ind=25&page=2
hits is first and users online/today is underneath

Habbo online counter, is still in progress, as in where no sure its grabing the right line of code


<?php
//get page
$lines = file('http://www.habbohotel.co.uk/');

//Get line
$Ndata = $lines['71']; // may be line 72 or 70 - try till one works

//Remove what we dont want
$Ndata = str_replace('<div id="toolbar-habbocount">', '', $Ndata);
$Ndata = str_replace("Habbos online</div>", "", $Ndata);

// Add text and output
echo "Current Habbos Online: ".$Ndata;
?>


So try a few lines and see if any work :D

Sygon.
12-04-2006, 01:01 PM
This has all been said before.


Ok. First 2 are easy, (users online + hit counter) both scripts can be found in my tutoral
http://thybag.co.uk/index.php?p=Tutorials&ind=25&page=2
hits is first and users online/today is underneath

Habbo online counter, is still in progress, as in where no sure its grabing the right line of code


<?php
//get page
$lines = file('http://www.habbohotel.co.uk/');

//Get line
$Ndata = $lines['71']; // may be line 72 or 70 - try till one works

//Remove what we dont want
$Ndata = str_replace('<div id="toolbar-habbocount">', '', $Ndata);
$Ndata = str_replace("Habbos online</div>", "", $Ndata);

// Add text and output
echo "Current Habbos Online: ".$Ndata;
?>


So try a few lines and see if any work :D

Carl what does str_replace do,

Mentor
12-04-2006, 01:10 PM
replace a string with something else.

Its getting the line off habbos site which is
<div id="toolbar-habbocount"> 10,000 Habbos online</div>

or whatever, and the str repaces basicly rmove everything but the number.
So you can add what ever prefix/suffix u like :D

Sygon.
12-04-2006, 01:16 PM
Thanks :D im on my long mile to learning php reading a book called sams php 5 unleased lol

`m_>
12-04-2006, 01:40 PM
Btw thats easy code, anyone got code for .com and .ca stats?

Sygon.
12-04-2006, 01:45 PM
mayb e change the .co.uk to .com?

`m_>
12-04-2006, 01:59 PM
mayb e change the .co.uk to .com?

nah the lines are different ;[

Mentor
12-04-2006, 02:06 PM
Btw thats easy code, anyone got code for .com and .ca stats?
You call it easy when u cant modife it that simply.


Changes, diffent line.
Diffent url.
Diffent tags.


<?php
//get page
$lines = file('http://www.habbohotel.com/habbo/en/');

//Get line
$Ndata = $lines['610']; // may be line 611 or 609 - try till one works

//Remove what we dont want
$Ndata = str_replace('<span class="white">', '', $Ndata);
$Ndata = str_replace("</span></b></td>", "", $Ndata);

// Add text and output
echo "Current Habbos Online: ".$Ndata;
?>


I think thats the right line, testing will be needed to make sure :)

Verrou
05-11-2006, 04:58 AM
BUMMMMMPPPP!
Lines for AU? I'm a n33b at PHP,
Thankles,

Ver.

RNelson
05-11-2006, 05:11 AM
Carl i suggest making a thread with every hotel script it will get stickied ;)

Zaub
05-11-2006, 07:09 AM
Habbo AU

<?php
$url = "http://www.habbo.com.au/"; // make this your hotel address
$start = "<div id=\"toolbar-habbocount\">";
$end = " Habbos online";
$read = file_get_contents($url);
$data = eregi("$start(.*)$end", $read, $output);
print $output[1];
?>

Habbo SG

<?php
$url = "http://www.habbo.sg/"; // make this your hotel address
$start = "<div id=\"toolbar-habbocount\">";
$end = " Habbos online";
$read = file_get_contents($url);
$data = eregi("$start(.*)$end", $read, $output);
print $output[1];
?>

Habbo CA

<?php
$url = "http://www.habbo.ca/"; // make this your hotel address
$start = "<div id=\"toolbar-habbocount\">";
$end = " Habbos online";
$read = file_get_contents($url);
$data = eregi("$start(.*)$end", $read, $output);
print $output[1];
?>

Habbo US

<?php
$url = "http://www.habbo.com.au/"; // make this your hotel address
$start = "<div id=\"toolbar-habbocount\">";
$end = " Habbos online";
$read = file_get_contents($url);
$data = eregi("$start(.*)$end", $read, $output);
print $output[1];
?>

:Blob
05-11-2006, 12:10 PM
Nearly every hotel (Except two, japan and sweden)

http://webshakes.com/Ryan/hotel.php
or
http://www.webshakes.com/Ryan/hotel.php
or
http://www.speed-networks.org/~webshake/Ryan/hotel.php

Webshakes works for me, just not anyone else..

Edit: Some dont work :(

Want to hide these adverts? Register an account for free!