blob: 77df79b8aab116fc36329b28704e4916526f662c [file] [log] [blame]
Andreufd98b5d2019-09-22 13:15:10 +02001<?php
2 require '../credentials.php';
3 require '../php/utils.php';
Andreub78c8792019-09-22 14:51:13 +02004
5 // Read from CSV
6 $inscrits = array_map('str_getcsv', file('inscrits.csv'));
7 array_shift($inscrits); // remove header
Andreufd98b5d2019-09-22 13:15:10 +02008
Andreub78c8792019-09-22 14:51:13 +02009 $start = 1;
Andreufd98b5d2019-09-22 13:15:10 +020010 $i = $start;
11 foreach ($inscrits as $user) {
12 $i = ($i + 1) % ($start + count($inscrits));
13 if ($i == 0) $i = $i + 1;
Andreub78c8792019-09-22 14:51:13 +020014 $template = "INSERT INTO `newusers` (`id`, `nom`, `curs`, `grau`, `quimata`, `requested`, `mort`, `password`)" .
Andreufd98b5d2019-09-22 13:15:10 +020015 " VALUES (NULL, '".$user[0]."', '".$user[1]."', '".$user[2]."', ".$i.", '0', '0', '')";
Andreub78c8792019-09-22 14:51:13 +020016 if (query($template)) echo $template . "<br />";
Andreufd98b5d2019-09-22 13:15:10 +020017 }
18?>