[bf1942] bf2 rcon php script
sechon at blackmud.com
Mon Jun 27 12:43:28 EDT 2005
I tried that but it was hanging up for some reason. Not too concerned
because it actually works at this point, trying to get the interface and
logging up to par now (got authentication for admins set-up already).
Now, here's where I'm stumped. How can I cut out a portion of a string? I
know I can replace portions with nothing, but I can't quite figure out how
to cut a longer string with random stuff in between. Here's an example:
ID: 2 - SomePlayer is remote ip: 126.96.36.199:3381 ->
CD-key hash: 1234somehash4321
ID: 24 - OtherPlayer is remote ip: 188.8.131.52:3382 ->
CD-key hash: 4321anotherhash1234
I want to cut out everything from " is remote ip" to "ID:" (ID on the next
player really, just eating the ip and hash).
How would I go about that? I've been RTFM'ing for a while now, and I've
toyed with both replace functions to no avail..Probably just overlooking
something. I'm already replacing the Id: output with <br><b>ID:</b>, but I
just can't figure out how to tell the replace to start and end where I want.
Since the IP and playername won't always be the same # of chars, I can't
even do a count that way I don't think?
I hope noone minds this somewhat OT tangent..
From: Andrew Armstrong [mailto:andrewa at bigpond.net.au]
Sent: Monday, June 27, 2005 3:12 AM
To: bf1942 at icculus.org
Subject: Re: [bf1942] bf2 rcon php script
You should just be able to while (socket_read...) the data until you get the
complete packet, then wait till you get the last terminator and it should be
as fast as possible.
----- Original Message -----
From: "Joe" <sechon at blackmud.com>
To: <bf1942 at icculus.org>
Sent: Monday, June 27, 2005 6:10 PM
Subject: RE: [bf1942] bf2 rcon php script
> Ah yeah had to sleep() a bit more, got it! Thanks!
> Updated the script package with a few minor tweaks including that.
> -----Original Message-----
> From: Andrew Armstrong [mailto:andrewa at bigpond.net.au]
> Sent: Monday, June 27, 2005 3:01 AM
> To: bf1942 at icculus.org
> Subject: Re: [bf1942] bf2 rcon php script
> As far as I know its not 'cut off', rather you are sent large packet
> in segments, so you should wait to receive the next packet, or something
> that effect.
> Check the admin/default.py script for some explanation (x02 or x04 is the
> packet delimiter I think).
> - Plasma
> ----- Original Message -----
> From: "Joe" <sechon at blackmud.com>
> To: <bf1942 at icculus.org>
> Sent: Monday, June 27, 2005 5:42 PM
> Subject: [bf1942] bf2 rcon php script
> > Right off the bat, I have to say I'm not sure how risky this is as I
> > check any data coming in from the forms, it's intended to just be a
> > point.
> > A few notes - All three files have the same declarations in them. I
> > to create a config file and include it in the future. I'm just very
> > having a working php -> RCON connection! I can work the rest gradually
> > Having a ranked server, we're fairly limited what we can do so... Gotta
> > what ya can! bf2cc has no way to restrict user access yet and instead of
> > holding my breath on that junk I'd much rather use firefox..heh. If I
> > some kind of gui language at all I think I'd have a nice remote manager!
> > Hehe..
> > A big note, and maybe a bf2 rcon bug: When the player list is requested,
> > it's cut off way early on the first output. In my script I request it
> > and combine the strings to get the correct player list.
> > http://www.clanc.cc/bf2/bf2_kickban_rcon-php.tgz
> > It's a complete mess, I already know! ;] If you do anything cool to it,
> > be interested in seeing it as well.
> > /eggs
More information about the Bf1942