Raised This Month: $ Target: $400
 0% 

Retrieve data from log string


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jack86
Veteran Member
Join Date: Dec 2008
Location: Belgrade, Serbia
Old 07-05-2010 , 15:15   Retrieve data from log string
Reply With Quote #1

I need help for a specific one time plugin. A buddy of mine gave me php script that reads bans from database and post them on our forum, and since i have a separate log for bans all i need is plugin that will read that logs once and store them into sql. Im stuck at part where it should read from line and take that info. Log line looks like this

L 05/11/2010 - 22:48:16: Ban: " dzoniJ<4490><STEAM_0:0:17887801><>" ban and kick " Dzivaldo<4587>< STEAM_0:1:23584114><>" (minutes " 90") (reason " Banovan si od dzoniJ") (IP " 109.92.183.155")

Now my idea is to somehow detect these border characters for required string like L data1 : "data2< "data3< etc, and get data between them, but i need a bit (a lot ) of help.
__________________

Jack86 is offline
Old 07-06-2010, 16:48
Jack86
This message has been deleted by Jack86. Reason: useless code
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-06-2010 , 17:30   Re: Retrieve data from log string
Reply With Quote #2

For the first 3 arguments, parse_loguser() can do the job.
__________________
Arkshine is offline
Jack86
Veteran Member
Join Date: Dec 2008
Location: Belgrade, Serbia
Old 07-07-2010 , 03:51   Re: Retrieve data from log string
Reply With Quote #3

OK, i did it diferently than before and it works, but now i have " character in front of name gotten with parse_loguser and i dont know how to remove it (remove_quotes doesnt work)

PHP Code:
        while (!feof(File))
        {
            
fgets(File,line,sizeof(line)-1);
            
            
split(line,temp,sizeof (temp) -1,useless0": ")
            
split(temp,useless0timersizeof(timer)-1"L ")

            
split(line,useless0admnamesizeof(admname)-1"n: ")
            
split(admname,tempsizeof (temp)-1nameidsizeof(nameid)-1"kick ")
            
            
parse_logusertempnamesizeof(name)-1,userid,useless0)
            
parse_logusernameidname2sizeof(name)-1,userid,authidsizeof(authid)-1)
            
            
split(nameid,useless0tim3sizeof(tim3)-1"minutes")
            
parsetim3minutessizeof(minutes)-1)
                
            
split(tim3,useless0ip1sizeof(ip1)-1"IP")
            
parseip1ipsizeof(ip)-1
__________________


Last edited by Jack86; 07-07-2010 at 04:04.
Jack86 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:10.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode