Admin page with SQL table creation and insertion
diff --git a/admin/insert.php b/admin/insert.php
index 77df79b..f6f836f 100644
--- a/admin/insert.php
+++ b/admin/insert.php
@@ -1,9 +1,12 @@
 <?php
 	require '../credentials.php';
 	require '../php/utils.php';
+	
+	$csvname = $_FILES['csvname']['tmp_name'];
+	$dbname = $_POST['dbname'];
 
 	// Read from CSV
-	$inscrits = array_map('str_getcsv', file('inscrits.csv'));
+	$inscrits = array_map('str_getcsv', file($csvname));
 	array_shift($inscrits); // remove header
 	
 	$start = 1;
@@ -11,8 +14,9 @@
 	foreach ($inscrits as $user) {
 		$i = ($i + 1) % ($start + count($inscrits));
 		if ($i == 0) $i = $i + 1;
-		$template = "INSERT INTO `newusers` (`id`, `nom`, `curs`, `grau`, `quimata`, `requested`, `mort`, `password`)" .
+		$template = "INSERT INTO `".$dbname."` (`id`, `nom`, `curs`, `grau`, `quimata`, `requested`, `mort`, `password`)" .
 					" VALUES (NULL, '".$user[0]."', '".$user[1]."', '".$user[2]."', ".$i.", '0', '0', '')";
-		if (query($template)) echo $template . "<br />";
+
+		if (query($template)) header("Location: ./index.php");
 	}
 ?>