Raised This Month: $ Target: $400
 0% 

Check log for specific words


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-19-2009 , 15:57   Re: Check log for specific words
Reply With Quote #1

Here ->
PHP Code:
stock CheckForString(const szDir[16], const szFile[16], const szString[])
{
    new 
szLocalDir[32];
    
get_localinfo("amx_basedir"szLocalDircharsmax(szLocalDir));
    new 
szPath[64];
    
formatex(szPathcharsmax(szPath), "%s/%s/%s"szLocalDirszDirszFile);
    
    new 
iFile fopen(szPath);
    if(!
iFile)
        return 
0;
    
    new 
szBuffer[128];
    while(!
feof(iFile))
    {
        
fgets(iFileszBuffercharsmax(szBuffer));
        if(!
szBuffer[0])
            continue;
        
        if(
containi(szBufferszString) != -1)
        {
            
fclose(iFile);
            return 
1;
        }
    }
    
fclose(iFile);
    return 
0;

Just use CheckForString("logs", "somefile.log", "searched_string") , returns 0 if file not exists or string wasn't found else returns 1
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 08-19-2009 at 17:00.
Alka 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 15:12.


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