Jump to content


This topic is now archived and is closed to further replies.


A complicated script

Recommended Posts

Hello all!

I need a script that generates a report based on HLDS logs (half life dedicated server) and Admin List (users.ini). Basically it takes first name from users.ini, searches for it in the logs, then prints the name and the last date he connected. Then takes the same name, some thing and so on.

Admins from users.ini are listed like this:


and logs are like this:

L 02/08/2006 - 14:20:11: "name1<96><STEAM_ID_LAN><>" connected, address ""
L 02/08/2006 - 14:24:13: "name2<96><STEAM_ID_LAN><>" connected, address ""

Now for the tricky part:

If someone with the admin accont "name2" joins the server with "SOMETHING - name2", server recognises him as an admin and i would like the script to do the same.

Something else, i have two server with different kind of logging. For the first one, there are no special lines for admin logins in the log but for the second one, it logs a like for every admin login like this:

Login: "SOMETHING - name1<1540><VALVE_ID_LAN><>" became an admin (account "name1") (access "abcdefghijklmnopqrstu") (address "")

I've tryed a script that prints the admins that didn't join the server in 30 days based on that kind of log. Maybe you can use this code and adapt it to use the kind of logging for first server (no additional log lines for admin logins):



        $fc=explode("\n", file_get_contents($dir."/".$file));
            if(preg_match("/^L (.*) \- (.*)\: \[admin(.*)\.amxx\] Login\: \\\"(.*)\\\" became an admin \(account \\\"(.*)\\\"\) \(access \\\"(.*)\\\"\) \(address \\\"(.*)\\\"\)/", $rr, $m)){
                $ldate=strtotime($m[1]." ".$m[2]);

foreach($last as $ke => $va){
    echo $ke." was last seen on ".date("Y-m-d H:i:s", $va)."\n";

Thank you so much for your time and eventual replies!

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.