Help with people_online.php

Website Scripts for your Helbreath Server.
GoD~
Regular
Posts: 53
Joined: Sat Sep 11, 2004 4:54 am

Post by GoD~ »

HI, i need some help because i dont know how to config people_online.php :rolleyes:
This is the script:

<?
$dir = "
$servname_lenth = ;
$start = "There are currently ";
$end = " people on this server!";
$lines = file($dir."\\GameServerLog".date("Ymd").".log");
$final = substr(substr($line, 35 + $servname_lenth, 8), 0, -1);
echo $start.$final.$end;
?>

Wht im suposse to put in the things that are in bold?

THX :lol:

Sorry for my english...im from Argentina :rolleyes:
<img src='http://img350.imageshack.us/img350/1465/god21ee.jpg' border='0' alt='user posted image' />
wannabee
Loyal fan
Posts: 270
Joined: Sun Dec 21, 2003 12:42 am

Post by wannabee »

1) $servname_lenth = is now long in characters your server name is (HGserver name)
2) $lines = file($dir."\\GameServerLog".date("Ymd").".log"); this line you don't need to worry about, it's just dumping the whole file into a buffer
3) $final = substr(substr($line, 35 + $servname_lenth, 8), 0, -1);
i seem to have made a mistake here, sorry about that. it should be:

Code: Select all

foreach ($lines as $line) {
$final = substr(substr($line, (35 + $servname_lenth), 8), 0, -1);
}
Hope it works now...
-Plague
<!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->Human knowleag belongs to THE WORLD<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br>So i highly dislike people who keep to their proud selfs... thats why i wanna share everything i got with you guys :D
GoD~
Regular
Posts: 53
Joined: Sat Sep 11, 2004 4:54 am

Post by GoD~ »

THX....IT WORKS :D

Other thing: why i cant run Easyphp when i run HGServer? or i cant run HGServer when Easyphp runing?

GoD~ :lol:
<img src='http://img350.imageshack.us/img350/1465/god21ee.jpg' border='0' alt='user posted image' />
wannabee
Loyal fan
Posts: 270
Joined: Sun Dec 21, 2003 12:42 am

Post by wannabee »

i don't know but easy php is a poor choice, if you can't install php for apache yourself there are other more advanced and secure packages out there. If i find my old link, i'll post it here. Basicly just google it.
<!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->Human knowleag belongs to THE WORLD<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br>So i highly dislike people who keep to their proud selfs... thats why i wanna share everything i got with you guys :D
GoD~
Regular
Posts: 53
Joined: Sat Sep 11, 2004 4:54 am

Post by GoD~ »

OK i will search for each till u post a link :)

GoD~
<img src='http://img350.imageshack.us/img350/1465/god21ee.jpg' border='0' alt='user posted image' />
wannabee
Loyal fan
Posts: 270
Joined: Sun Dec 21, 2003 12:42 am

Post by wannabee »

<a href='http://www.devside.net/' target='_blank'>http://www.devside.net/</a> has a good one.
<!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->Human knowleag belongs to THE WORLD<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br>So i highly dislike people who keep to their proud selfs... thats why i wanna share everything i got with you guys :D
assman
noob
Posts: 26
Joined: Sat Feb 14, 2004 6:48 am

Post by assman »

ok it seems not to work any1 know what im doing wrong...

here is what i got

<?
//---------------------Config starts here-----------------------------

$dir = "C:\\Documents and Settings\\GaNgStA\\Desktop\\HBServer 3.2"; // Use duble back slashes (\\) (Don't include the end "\\")
$servname_lenth =11 ; // How many characters is in your server name
$start = "There are currently "; // What it displays before the number
$end = " people on this server!"; // What it displays after the number

//-----------------------Code starts here-----------------------------
$lines = file($dir."\\GameServerLog".date("Ymd").".log"); // Puts all lines in the file into the $lines array
foreach ($lines as $line_num => $line) {
foreach ($lines as $line) {
$final = substr(substr($line, (35 + $servname_lenth), 8), 0, -1);
}
}
echo $start.$final.$end;
?>
wannabee
Loyal fan
Posts: 270
Joined: Sun Dec 21, 2003 12:42 am

Post by wannabee »

assman wrote:foreach ($lines as $line_num => $line) {
foreach ($lines as $line) {
$final = substr(substr($line, (35 + $servname_lenth), 8), 0, -1);
}
}
why do you have 2 "foreach"? (i must have not made it clear enough)

ok here is what you should have:

Code: Select all

<?
//---------------------Config starts here-----------------------------

$dir = "C:\\Documents and Settings\\GaNgStA\\Desktop\\HBServer 3.2"; // Use duble back slashes (\\) (Don't include the end "\\")
$servname_lenth =11; // How many characters is in your server name
$start = "There are currently "; // What it displays before the number
$end = " people on this server!"; // What it displays after the number

//-----------------------Code starts here-----------------------------
$lines = file($dir."\\GameServerLog".date("Ymd").".log"); // Puts all lines in the file into the $lines array
foreach ($lines as $line) {
$final = substr(substr($line, (35 + $servname_lenth), 8), 0, -1);
}
echo $start.$final.$end;
?>
<!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->Human knowleag belongs to THE WORLD<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br>So i highly dislike people who keep to their proud selfs... thats why i wanna share everything i got with you guys :D
assman
noob
Posts: 26
Joined: Sat Feb 14, 2004 6:48 am

Post by assman »

lol im doing somethign wrong i put that in and its like...

bam this pops up


Warning: file(C:\Documents and Settings\GaNgStA\Desktop\HB Berserk\GameServerLog20041004.log): failed to open stream: No such file or directory in c:\program files\easyphp1-7\www\online.php on line 10

Warning: Invalid argument supplied for foreach() in c:\program files\easyphp1-7\www\online.php on line 11

Notice: Undefined variable: final in c:\program files\easyphp1-7\www\online.php on line 14
There are currently people on this server!
wannabee
Loyal fan
Posts: 270
Joined: Sun Dec 21, 2003 12:42 am

Post by wannabee »

assman wrote: lol im doing somethign wrong i put that in and its like...

bam this pops up


Warning: file(C:\Documents and Settings\GaNgStA\Desktop\HB Berserk\GameServerLog20041004.log): failed to open stream: No such file or directory in c:\program files\easyphp1-7\www\online.php on line 10

Warning: Invalid argument supplied for foreach() in c:\program files\easyphp1-7\www\online.php on line 11

Notice: Undefined variable: final in c:\program files\easyphp1-7\www\online.php on line 14
There are currently people on this server!
see how the file dosn't realy exist because you pointed it to the wrong directory??? (C:\Documents and Settings\GaNgStA\Desktop\HB Berserk\GameServerLog20041004.log)

try using:
$dir = "C:\\Documents and Settings\\GaNgStA\\Desktop\\HB Berserk\\GameServerLog"
<!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->Human knowleag belongs to THE WORLD<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br>So i highly dislike people who keep to their proud selfs... thats why i wanna share everything i got with you guys :D
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

amazing plague hahaha :D
QUOTE (ADDKiD @ Dec 1 2006, 4:01 PM) <br>You guys make me laugh alot, half the shit I say, is bullshit...<br><br><img src='http://img485.imageshack.us/img485/492/banssig1ng.gif' border='0' alt='user posted image' /><br><br><b>I see no changes at all, wake up in the morning and ask myself...<br>Is life worth living? Should I blast myself?</b><br><br><b><a href='http://2paclegacy.com' target='_blank'>2PacLegacy.com</a></b>
assman
noob
Posts: 26
Joined: Sat Feb 14, 2004 6:48 am

Post by assman »

Umm Btw if im not running the HGserver on my computer then it wont show how many people online right?
becauset his is what i get when i run the php
There are currently people on this server!
no number or is it stupost to belike that :blink:
wannabee
Loyal fan
Posts: 270
Joined: Sun Dec 21, 2003 12:42 am

Post by wannabee »

ok, what it does is it pulls the file off the server, if you really want to do it, you can set the log folder as a ftp server root folder (on the hosters comp) and then you can link the script up to that location. if you use windows XP there should be a easy way of doing it. Read up on IIS is you want to do it this way (this is a ftp hosting software that comes with windows, it runs on the hosts computer).

Note: if you want privasy, it would be nice to set a password on the ftp.
<!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->Human knowleag belongs to THE WORLD<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br>So i highly dislike people who keep to their proud selfs... thats why i wanna share everything i got with you guys :D
assman
noob
Posts: 26
Joined: Sat Feb 14, 2004 6:48 am

Post by assman »

lol its kool little complicated but kool

:D ty
assman
noob
Posts: 26
Joined: Sat Feb 14, 2004 6:48 am

Post by assman »

sorry to bother for this ...it should be simple but i just dont get it :((

Im hosting maps on my server atm..my files are in the folder but the maps i host are not in the folder...that is a separate folder...and my hgservername is HGServerNew which is 11 characters..i put that in and do evryting like it said on here and i still get this
There are currently people on this server!
And yes im hosting all the files on my comp shold my HGserver be in
C:\\Documents and Settings\\GaNgStA\\Desktop\\HB Berserk\\Game Servers\Elvine or w/e other folders that HGservers are in..if you understand what iv have said here plz respond i really like to figure this out..:(
Post Reply