View Single Post
  #2  
Old 18th July 2017, 20:13
LeeHowarth LeeHowarth is offline
TT
 
Join Date: Nov 2008
Posts: 100
Default
Do not trust this guy he his a scammer, he will get you to work and will have no intention in paying.

Code:
<?php

try
{
    $iterator = new RecursiveDirectoryIterator( '.' );
    $iterator = new RecursiveIteratorIterator( $iterator );
    $updates  = 0;
    foreach ( $iterator as $item )
    {
        $filepath  = $item->getPathName();
        $extension = pathinfo( $filepath, PATHINFO_EXTENSION );
        if ( 0 === strcmp( $extension, 'php' ) )
        {
             $contents = file_get_contents( $filepath );
             if ( $contents === false )
             {
                  continue;
             }
    
             if ( 0 === strpos( $contents, "\xEF\xBB\xBF" ) )
             {
                  $contents = str_replace( "\xEF\xBB\xBF", null, $contents );
                  $found = 1;
             }
             else
             {
                  $found = 0;
             }

             if ( $found === 1 )
             {
                  file_put_contents( $filepath, $contents );
                  $updates++;
             }
        }
    }

    print( "Updated $updates files.\n" );
}
catch ( Exception $e )
{
    printf( "An error occurred: %s\n", $e->getMessage() );
}
will fix the problem if others encounter this issue, it's due to using an editor such as notepad which embeds the UTF-8 byte order mark.
Reply With Quote