bulk import 1.5.xx

Hello here my contribution

bulk importer for elgg 1.5.xx
I tried to use
http://community.elgg.org/pg/plugins/bogdan/read/98994/import_preconfigured_profiles without any success
then went to look for alternative and stubled upon:
http://community.elgg.org/pg/pages/view/4042/ which was a bit outdated

<?php
 error_reporting(E_ALL);
 ini_set("display_errors", 1);
   
    require_once('/srv/d_onlymages/www/pixangelsuk.co.uk/htdocs/engine/start.php');
   
    global $CONFIG;
    if (!isset($CONFIG))
     $CONFIG = new stdClass;
     
    $ordner = "/srv/d_onlymages/www/htdocs/import";
    $rb_datei = fopen($ordner."/user.csv", "r");
    if ($rb_datei) {
        $array = explode("\n", fread($rb_datei, filesize($ordner."/user.csv")));
    }
    $total_array = count($array);
    echo $total_array;  
    $i = 0;      
    while($i <= $total_array) {          
        $data = explode(",", $array[$i]);      
        $name = str_replace('"','',utf8_decode($data[0]));
        $username = str_replace('"','',utf8_decode($data[1]));
        $email = str_replace('"','',utf8_decode($data[2]));      
        $password = str_replace('"','',utf8_decode($data[3]));
       
        if(strlen($name) ==0) {
            $name = $username;
        } 

            try {
                $guid = register_user($username, $password, $name, $email, false, 0, '');
            }
            catch ( RegistrationException $e ){
                $guid = 0;
            }

            if ( $guid )
            {
            $new_user = get_entity($guid);
               // Send user validation request on register only
                request_user_validation($guid);
                set_user_validation_status($guid, true);
    //                $new_user->disable('new_user');    // Now disable
                foreach ( $user_profile as $shortname => $value)
                {
                    if (isset($accesslevel[$shortname])) {
                        $access_id = (int) $accesslevel[$shortname];
                    } else {
                        $access_id = 0;
                    }
                    create_metadata($guid, $shortname, $value, 'text', $guid, $access_id);
                }
            }

     
        echo "<br>Username: ".$username." - Name: ".$name. " - E-Mail: ".$email. " - Password: ".$password;          
               
        $i++;
    }    
?>