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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Feb 2006
    Posts
    262
    Thanks
    23
    Thanked 1 Time in 1 Post

    Post Where is the error ?!?!?!

    Good day to you all,
    It's been couple hours that I'm working on this can somebody help me to find my how to solve my error in the following code :

    PHP Code:
    $logInTracker="successLog.txt"
    function 
    success($logSuccess,$logInTracker,$loginName,$goHere)
    {
           
    $date=date ("l dS of F Y h:i:s A");
        
    $register_globals = (bool) ini_get('register_gobals');
        if (
    $register_globals$ip getenv(REMOTE_ADDR);
        else 
    $ip $_SERVER['REMOTE_ADDR'];

            
    // If webmaster wants to log successful logins
        
    if($logSuccess=="1"){
            
    $log=fopen("files/$logInTracker""a+");


    $lines=file($logInTracker);//load the lines to an array
    $insert_line 0;//the line to insert at...could be a post variable
    $insert_text "$loginName" logged in on$date Logged IP address: ."$ip" ."\n";
    //this could be a post variable, but at any case make sure to append the var with the new line, otherwise it will run together
    $temp="";//start a temp variable to work with
    $count=1;//initialize a counter


    foreach($lines as $line){
    (
    $count != $insert_line) ? $temp .= $line $temp .= $insert_text $line;
    $count++;

    The problem come from the line 17. I' have tried many thing, maybe it's right in front of me.......

    Thanks

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Perhaps you could tell us what error you are getting?

  • #3
    Regular Coder Iszak's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Western Australia
    Posts
    332
    Thanks
    2
    Thanked 58 Times in 57 Posts
    Ok from what I saw it's this line
    "$insert_text = "$loginName" . logged in on: $date - Logged IP address: ."$ip" ."\n";"
    I've corrected it, I also noticed that you forgot the trailing / ending bracket(s), whether it's because we're only seeing a small portion of the code, or what. So for your sanity I didn't correct that.
    Code:
    $logInTracker="successLog.txt"; 
    function success($logSuccess,$logInTracker,$loginName,$goHere)
    {
           $date=date ("l dS of F Y h:i:s A");
        $register_globals = (bool) ini_get('register_gobals');
        if ($register_globals) $ip = getenv(REMOTE_ADDR);
        else $ip = $_SERVER['REMOTE_ADDR'];
    
            // If webmaster wants to log successful logins
        if($logSuccess=="1"){
            $log=fopen("files/$logInTracker", "a+");
    
    
    $lines=file($logInTracker);//load the lines to an array
    $insert_line = 0;//the line to insert at...could be a post variable
    $insert_text = $loginName." logged in on: ".$date." - Logged IP address: ".$ip."\n";
    //this could be a post variable, but at any case make sure to append the var with the new line, otherwise it will run together
    $temp="";//start a temp variable to work with
    $count=1;//initialize a counter
    
    
    foreach($lines as $line){
    ($count != $insert_line) ? $temp .= $line : $temp .= $insert_text . $line;
    $count++;
    }

  • #4
    Regular Coder
    Join Date
    Feb 2006
    Posts
    262
    Thanks
    23
    Thanked 1 Time in 1 Post
    Resolved


  •  

    Posting Permissions

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