<?php
require_once 'db.php';
require_once 'functions.php';
require_once 'account_functions.php';
require_once 'article_functions.php';

function create_users_from_csv($csv)
{
    $csv = read_file($csv);
    while ($record = fgets($csv)) {
        $fields = explode(',', $record);

        $username = $fields[0];
        $email = $fields[1];
        $password = $fields[2];
        $role_id = $fields[3];

        create_user(
            $username,
            $email,
            $password,
            $password,
            $role_id,
        );
    }
}

function delete_users($ids)
{
    foreach ($ids as $id) {
        delete_account($id);
    }
}
