Files
Chamilo/main/cron/user_import/get_data_from_mail.php
T
Xes 73154ae174
Behat tests 1.11.x 🐞 / PHP 7.4 Test on ubuntu-latest (push) Canceled after 0s
PHP-CS-Fixer / composer_install (7.4) (push) Canceled after 0s
Chamilo 1.11.40 (ZIP oficial v1.11.40)
Fuente: https://github.com/chamilo/chamilo-lms/releases/download/v1.11.40/chamilo-1.11.40.zip
sha256: 1cf4bf2cc7bae1ef1a1eff643235db1d552f78ddf4b6dd1e2d2dac9868679439
Snapshot independiente (rama huerfana); diffable vs 1.11.38. vendor incluido.
2026-08-06 17:59:45 +02:00

36 lines
1.1 KiB
PHP

<?php
/**
* This script gets users details of a given list of users
* (given by e-mail) and prints the details in /tmp/list.txt
* To enable script, prefix the first die(); with //.
*
* @package chamilo.cron.user_import
*/
/**
* Initialization.
*/
/* Example of input file:
sam@example.com
Matthew@example.com
HERMAN@example.com
*/
exit();
//change filename depending on file containing mails list
$list = file('input.txt');
require_once '../../inc/global.inc.php';
$users = Database::get_main_table(TABLE_MAIN_USER);
$string = '';
foreach ($list as $mail) {
$mail = trim($mail);
$sql = "SELECT user_id, official_code, firstname, lastname, email FROM $users WHERE email = '$mail'\n";
$res = Database::query($sql);
if (Database::num_rows($res) == 0) {
$string .= 'No encontrado;'.$row['email'];
} else {
$row = Database::fetch_assoc($res);
$string .= $row['user_id'].';'.$row['email'].';'.$row['firstname'].';'.$row['lastname'].';'.$row['official_code']."\r\n";
}
}
echo $string;
file_put_contents('/tmp/list.txt', $string);