Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12

Thread: Im giving up :(

  1. #1
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Im giving up :(

    I am somewhat experienced with php and I am trying to do something new here so please bear with me. I dont have any experience with ftp funtions so if someone could help me better understand what the best way to go about getting a solution to my post.

    *this is what I would like it to do.

    First, open .log files from a ftp dir (as many as there is) and grab info from that log file and place it into mysql.

    PHP Code:
    $ftp ftp_connect("host");
    ftp_login($ftp"user""pass");
    $filelist ftp_nlist($ftp"/Dir");
    $size sizeof($filelist);
    $count 0;
    if (
    $size 0)
    {
        for(
    $j=1$j <= $size$j++)
        {
            
    $i $j 1;
            if ( 
    stristr($filelist[$i], ".log") )
            {
                
    ftp_get($ftp".".$filelist[$i], $filelist[$i], FTP_ASCII);
                
    ftp_delete($ftp$filelist[$i]);
            }
        }
    }
    else 
    $empty 1
    THis is all I have so far. From here, I do not know what to do and its driving me crazy trying to figure it out.

    So.... we open the dir, get the info from each .log file and then lets place it into the mysql. After were done, were deleting the .log files we placed into the sql.


    Part 2.

    I dont need alot of info from the log file's. I just need two things. 1. each persons username, and each person's ip.

    I have attatched a .txt file of a sample of what I need to get. If you take a look, besides all the jargin I dont need, all I need is the playername and Ip address. Each file size is differant, it will be on a differant line each time.

    I know this is a tough one, hopefully someone can help O-o :/
    Attached Files Attached Files
    Last edited by bimmer528; 04-24-2004 at 04:05 AM. Reason: added .txt

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    I gather that you chose not to read our posting guidelines as you are required to do before creating your thread?

    http://www.codingforums.com/postguide.htm

    Read them now please.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    besides the title, how else did I break the house rules? It all comes down to 1 thing. Helping others regardless of any posting guideline. Sorry if I didn't read your guidelines before I posted. If that means I wont get any help, then there are plenty of other places where I can get some.

    thx in advance.

  • #4
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bimmer528
    It all comes down to 1 thing. Helping others regardless of any posting guideline. Sorry if I didn't read your guidelines before I posted. If that means I wont get any help, then there are plenty of other places where I can get some.

    thx in advance.
    Nice attitude
    Maybe you think we have nothing better to do then opening posts with titles like that to find out what the problem is. Your wrong. Most of us have jobs and have their own projects + all of us here are volunteers.
    So the least you can do is making it as easy for us as possible.
    Even if you don't care about the people you expect to spend time helping you, then i would still be a good idea to choose a more informative and inviting title.
    Simply because your post will be ignored if it has a braindeath title like yours, which means you wount be helped.

    Think of it as advertisement for trying to get other people to help you, which i suppose is your goal.
    So change your title.


    Inside your post, you also don't exactly give a lott of usefull info.
    Does the code you posted works, do you know how to insert a record into mySQL, what's your tablestructure etc

    Your choosen approach is also not exactly the most efficient way to get that info, since it would be better logged on login, which is like no effort at all.
    Analysing the logfile over the webserver is simply a waste of runtime resources.

    About your actual question:
    It wount be easy to get the IP and name out of the logfiles, simply because your logfiles are's structured enough.
    So you will need
    - to read it line by line and only keep the lines that contain "l o g g e d i n f r o m" --> check the manual for reading files line by line + the strpos() function to know if the line contains the "logged in ...'this step alone will take a lott of processingtime if you have a reasonable number of logged on users.
    - then explode the line on the spaces and only keep the second and seventh element. Or you'll need to use a regex for the IP and a function to know the last position of the username (possbly reusing the strpos() for the "logged ..." and then using this inside a substr() to set the endpositon) if the username can contain spaces. supposing it doesn't contain spaces, then you'll need
    $parts=explode(' ',$line);
    $user=$parts[1];
    $IP=$parts[6];
    - then you'll need to store this, but your not exactly giving any info about the format you need this info in. Store it all in one cell? A record for each user?
    Last edited by raf; 04-24-2004 at 09:00 AM.
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #5
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Quote Originally Posted by bimmer528
    besides the title, how else did I break the house rules? It all comes down to 1 thing. Helping others regardless of any posting guideline. Sorry if I didn't read your guidelines before I posted. If that means I wont get any help, then there are plenty of other places where I can get some.

    thx in advance.
    The majority of our members do not have a problem with reading the rules and abiding by them. You are more than welcome to leave then. Don't let the door hit your you know what on the way out. I'll tell you what though with an attitude like that good luck getting help from anyone else.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #6
    Regular Coder
    Join Date
    Mar 2004
    Posts
    232
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Don't be that cruel. His title wasn't that bad. You can just answer his question while ignoring the title cant you?

  • #7
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by stophon4
    Don't be that cruel. His title wasn't that bad.
    I don't think Spookster was cruell. He asks to respect the rules, which everyone should do anyway + he's the moderator of this forum so it's one of his tasks to make sure the rules are followed.
    I can't think of any sensible reason why bimmer528 didn't change the title. Can you? I'e seen may people getting called on bad titles, and you can immedeately see who the loosers are (the ones that will start arguing for example, ot the ones that think thy have some kind of right to get help) and who's smart or mature enough to shape up.

    You don't find his title bad? Realy.
    You also doen't seem to think there is anything wrong with his attitude since.
    Well, if noone will bother t help him because of his title and attitude, then your his last hope. So step in and help him.
    But i wount bother anymore. He probably wount be around here for long anyway and i fear that unless one of us write the complete code, we wount be able to get it running anyway.
    Quote Originally Posted by stophon4
    You can just answer his question while ignoring the title cant you?
    Indeed, but most of us will choose to simply ignore him, unless he might decide to follow our rules/spooksters advice
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #8
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    wow a bad title to my post. 1 word comes to mind- RELAX. You go on rant's that are paragraphs long for what? You say you have no time to be reading help threads with useless titles but yet you post 2,3,4 paragraphs on how my title is and what it "should be" with your reasoning. Why are you guys so pissed off? Did my bad title really get you in a bad mood? wtf is wrong with some people.. sigh.

    btw raf, I apprieciate the help you did give me but not the comment about your "feeling you had". Its rather moot anyway since I did get it working this morning.

  • #9
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by raf
    . He probably wount be around here for long anyway
    nope, sure wont now.

  • #10
    New Coder
    Join Date
    Dec 2003
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Lets be reasonable how many percent of the users read those rules( new users)? 30% max???

    I do not know how it can affect the whole board? I think if someone does not like the title just don't help the guy. Why do you have to make such a big deal out of this?

    i think its a good tile, i feel the same when something is not working out but i know its supposed to be the same....

    you are making users go away!

    (my opinion)
    Last edited by fimi; 04-25-2004 at 02:29 AM.

  • #11
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    completley disagree with the above post....

    I understand that most members when the come here wont read the rules... true, we all know that and understand that we need to push people in the right direction... However, if you read the reply post... He never mentioned changing the way he writes his title and and made it sound like spookster (moderator) was wrong.

    I think that when people come here they feel they have the right to be helped, and I feel it is more of a privilage... If you make a mess up on your first post, a simple apology will get things moving, nobody is expected to be perfect first time round, but the post was a clear sign of disrespect.

    and just to add, how can you say that "its not a bad title", the title should be descriptive and describe the problem at hand...

  • #12
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Well I'm glad you worked out whatever your coding problem was. Now maybe you can work out whatever problem you seem to have with interacting with other members of this community. You were politely told to read the rules however you decided a proper response would be to cop and attitude and relay to us that you could just go somewhere else and get help.

    Fimi,

    I have been a part of this forum for the past 5-6 years now and guess what this site gets more and more popular every year. Why? Because we the moderators and the very helpful regular members such as raf and many others make it place where getting help is much easier. If we did not enforce the rules the way we do we would end up with a forum full of junk that people would have to weed through when looking to find answers to their own questions. When members use the search feature to find answers they pull up a list of "titles". How would you like to have to sift through 50 titles like "Help im a newbie" or "Im giving up" to find a thread that is most closely related to the problem you are having? That is why we make such a big deal out of it.

    Obviously this thread is going to go nowhere fast so let's just end it here.

    Thread closed! Besides I enjoy getting the last word in because i'm such kooky guy.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •