Subversion Repositories ALCASAR

Rev

Rev 587 | Rev 847 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 587 Rev 768
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<HTML><!-- Written by Rexy, Romero P. & 3abTux -->
2
<HTML><!-- Written by Rexy, Romero P. & 3abTux -->
3
<HEAD>
3
<HEAD>
4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
<TITLE>Users import</TITLE>
5
<TITLE>Users import</TITLE>
6
<link rel="stylesheet" href="/css/style.css" type="text/css">
6
<link rel="stylesheet" href="/css/style.css" type="text/css">
7
</HEAD>
7
</HEAD>
8
<body>
8
<body>
9
<?
9
<?
10
# Choice of language
10
# Choice of language
11
$Language = 'en';
11
$Language = 'en';
12
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
12
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
13
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
13
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
14
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
14
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
15
if($Language == 'fr'){
15
if($Language == 'fr'){
16
  $l_title = "Import d'usagers";
16
  $l_title = "Import d'usagers";
17
  $l_database_state = "&Eacute;tat actuel de la base : nombre de groupes =";
17
  $l_database_state = "&Eacute;tat actuel de la base : nombre de groupes =";
18
  $l_number_of_users = "Nombre d'usagers";
18
  $l_number_of_users = "Nombre d'usagers";
19
  $l_text_import = "Importer &agrave; partir d'un fichier texte ('.txt')";
19
  $l_text_import = "Importer &agrave; partir d'un fichier texte ('.txt')";
20
  $l_text_import_help = "Ce fichier ne doit contenir que des noms d'usager &eacute;crit les uns sous les autres.";
20
  $l_text_import_help = "Ce fichier ne doit contenir que des noms d'usager &eacute;crit les uns sous les autres.";
21
  $l_file = "Fichier";
21
  $l_file = "Fichier";
22
  $l_users_service = "D&eacute;finissez leur service (facultatif)";
22
  $l_users_service = "D&eacute;finissez leur service (facultatif)";
23
  $l_users_group = "D&eacute;finissez leur groupe (conseill&eacute;)";
23
  $l_users_group = "D&eacute;finissez leur groupe (conseill&eacute;)";
24
  $l_send = "Envoyer";
24
  $l_send = "Envoyer";
25
  $l_imported_files = "Fichiers des identifiants/mot_de_passe import&eacute;s durant les derni&egrave;res 24h :";
25
  $l_imported_files = "Fichiers des identifiants/mot_de_passe import&eacute;s durant les derni&egrave;res 24h :";
26
  $l_db_import = "Importer &agrave; partir d'une sauvegarde de la base d'usagers (format SQL)";
26
  $l_db_import = "Importer &agrave; partir d'une sauvegarde de la base d'usagers (format SQL)";
27
  $l_db_import_help = "Afin de pouvoir imputer les derni&egrave;re traces de connexion, une sauvegarde de la base actuelle sera automatiquement r&eacute;alis&eacute;e.";
27
  $l_db_import_help = "Afin de pouvoir imputer les derni&egrave;re traces de connexion, une sauvegarde de la base actuelle sera automatiquement r&eacute;alis&eacute;e.";
28
  $l_db_reset = "Remise &agrave; z&eacute;ro de la base usagers";
28
  $l_db_reset = "Remise &agrave; z&eacute;ro de la base usagers";
29
  $l_error_ext_txt = "Erreur! Veuillez s&eacute;lectionner un fichier de type csv ou txt";
29
  $l_error_ext_txt = "Erreur! Veuillez s&eacute;lectionner un fichier de type csv ou txt";
30
  $l_error_ext_sql = "Erreur! Veuillez s&eacute;lectionner un fichier de type sql";
30
  $l_error_ext_sql = "Erreur! Veuillez s&eacute;lectionner un fichier de type sql";
31
  $l_group_empty = "La liste des groupes est vide";
31
  $l_group_empty = "La liste des groupes est vide";
32
}
32
}
33
else {
33
else {
34
  $l_title = "Users import";
34
  $l_title = "Users import";
35
  $l_database_state ="State of the database : number of groups =";
35
  $l_database_state ="State of the database : number of groups =";
36
  $l_number_of_users = "Number of users";
36
  $l_number_of_users = "Number of users";
37
  $l_text_import = "Import from a text file ('.txt')";
37
  $l_text_import = "Import from a text file ('.txt')";
38
  $l_text_import_help = "In this file, you must write only the user login one below the other.";
38
  $l_text_import_help = "In this file, you must write only the user login one below the other.";
39
  $l_file = "File";
39
  $l_file = "File";
40
  $l_users_service = "Define their service (optional)";
40
  $l_users_service = "Define their service (optional)";
41
  $l_users_group = "Define their group (advisable)";
41
  $l_users_group = "Define their group (advisable)";
42
  $l_send = "Send";
42
  $l_send = "Send";
43
  $l_imported_files = "Logins/passwords file imported during the last 24h :";
43
  $l_imported_files = "Logins/passwords file imported during the last 24h :";
44
  $l_db_import = "Import from a saved users database file (SQL format)";
44
  $l_db_import = "Import from a saved users database file (SQL format)";
45
  $l_db_import_help = "In order to impute the last connections, the actual users database will be automaticly saved.";
45
  $l_db_import_help = "In order to impute the last connections, the actual users database will be automaticly saved.";
46
  $l_db_reset = "Reset the users database";
46
  $l_db_reset = "Reset the users database";
47
  $l_error_ext_txt = "Error! Please select a txt or csv file";
47
  $l_error_ext_txt = "Error! Please select a txt or csv file";
48
  $l_error_ext_sql = "Error! Please select a sql file";
48
  $l_error_ext_sql = "Error! Please select a sql file";
49
  $l_group_empty = "The group list is empty";
49
  $l_group_empty = "The group list is empty";
50
}
50
}
51
function getImportFileList(){
51
function getImportFileList(){
52
	$importFile = array();
52
	$importFile = array();
53
	if ($handle = opendir('/tmp')) {
53
	if ($handle = opendir('/tmp')) {
54
		while (false !== ($file = readdir($handle))) {
54
		while (false !== ($file = readdir($handle))) {
55
			if ($file != "." && $file != "..") {
55
			if ($file != "." && $file != "..") {
56
				$ext = pathinfo($file ,PATHINFO_EXTENSION);
56
				$ext = pathinfo($file ,PATHINFO_EXTENSION);
57
				$name = substr($file, 0, -(strlen($ext)+1)); //Retirer les lettres de l'extension ET le point
57
				$name = substr($file, 0, -(strlen($ext)+1)); //Retirer les lettres de l'extension ET le point
58
				if ($ext=="pwd"){
58
				if ($ext=="pwd"){
59
				$importFile[] = $name;
59
				$importFile[] = $name;
60
				}
60
				}
61
			}
61
			}
62
		}
62
		}
63
		closedir($handle);
63
		closedir($handle);
64
	}
64
	}
65
	return $importFile;
65
	return $importFile;
66
}
66
}
67
function creatlog ($login,$password,$service,$RS_out)
67
function creatlog ($login,$password,$service,$RS_out)
68
	{
68
	{
69
 /* génère un fichier en sortie avec les info de connexion en clair */
69
 /* génère un fichier en sortie avec les info de connexion en clair */
70
	fputs($RS_out,"   ---  Accès à Internet via ALCASAR  ---  "."\r\n\r\n");
70
	fputs($RS_out,"   ---  Accès à Internet via ALCASAR  ---  "."\r\n\r\n");
71
	fputs($RS_out,"Service          : $service"."\r\n\r\n");
71
	fputs($RS_out,"Service          : $service"."\r\n\r\n");
72
	fputs($RS_out,"Nom de connexion : $login   |  Mot de passe : $password\r\n\r\n");
72
	fputs($RS_out,"Nom de connexion : $login   |  Mot de passe : $password\r\n\r\n");
73
	fputs($RS_out,"Pensez à changer votre mot de passe (lien sur la page d'authentification)"."\r\n\r\n");
73
	fputs($RS_out,"Pensez à changer votre mot de passe (lien sur la page d'authentification)"."\r\n\r\n");
74
	fputs($RS_out,"--------------------------------------------------------------------------------"."\r\n\r\n");
74
	fputs($RS_out,"--------------------------------------------------------------------------------"."\r\n\r\n");
75
	}
75
	}
76
function GenPassword($nb_car="8")
76
function GenPassword($nb_car="8")
77
	{
77
	{
78
 /* generation aléatoire du mot de passe */
78
 /* generation aléatoire du mot de passe */
79
	$password = "";
79
	$password = "";
80
	$chaine  = "aAzZeErRtTyYuUIopP152346897mMLkK";
80
	$chaine  = "aAzZeErRtTyYuUIopP152346897mMLkK";
81
	$chaine .= "jJhHgGfFdDsSqQwWxXcCvVbBnN152346897";
81
	$chaine .= "jJhHgGfFdDsSqQwWxXcCvVbBnN152346897";
82
	while($nb_car != 0)
82
	while($nb_car != 0)
83
		{
83
		{
84
		$i = rand(0,71);
84
		$i = rand(0,71);
85
		$password .= $chaine[$i];
85
		$password .= $chaine[$i];
86
		$nb_car --;
86
		$nb_car --;
87
		}
87
		}
88
	return $password ;
88
	return $password ;
89
	}
89
	}
90
?>
90
?>
91
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
91
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
92
<tr><th><? echo "$l_title"; ?></th></tr>
92
<tr><th><? echo "$l_title"; ?></th></tr>
93
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
93
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
94
</TABLE>
94
</TABLE>
95
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
95
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
96
<tr><td valign="middle" align="left">
96
<tr><td valign="middle" align="left">
97
<CENTER><H3> 
97
<CENTER><H3> 
98
<?php
98
<?php
99
echo "$l_database_state";
99
echo "$l_database_state";
100
 
100
 
101
$LIBpath = "../lib/";
101
$LIBpath = "../lib/";
102
require('/etc/freeradius-web/config.php');
102
require('/etc/freeradius-web/config.php');
103
if (is_file($LIBpath."sql/drivers/$config[sql_type]/functions.php"))
103
if (is_file($LIBpath."sql/drivers/$config[sql_type]/functions.php"))
104
	{
104
	{
105
	include_once($LIBpath."sql/drivers/$config[sql_type]/functions.php");
105
	include_once($LIBpath."sql/drivers/$config[sql_type]/functions.php");
106
	}
106
	}
107
else
107
else
108
	{
108
	{
109
	echo "<b>Could not include SQL library</b><br>\n";
109
	echo "<b>Could not include SQL library</b><br>\n";
110
	exit();
110
	exit();
111
	}
111
	}
112
include_once($LIBpath.'functions.php');
112
include_once($LIBpath.'functions.php');
113
if ($config['sql_use_operators'] == 'true')
113
if ($config['sql_use_operators'] == 'true')
114
	{
114
	{
115
	include($LIBpath."operators.php");
115
	include($LIBpath."operators.php");
116
	$text = ',op';
116
	$text = ',op';
117
	$passwd_op = ",':='";
117
	$passwd_op = ",':='";
118
	}
118
	}
119
$link = @da_sql_pconnect($config);
119
$link = @da_sql_pconnect($config);
120
if (isset ($_POST ['choix'])) {	$choix = $_POST ['choix']; }
120
if (isset ($_POST ['choix'])) {	$choix = $_POST ['choix']; }
121
	else { $choix = ''; }
121
	else { $choix = ''; }
122
if ($choix == "raz")
122
if ($choix == "raz")
123
	{
123
	{
124
	exec ("sudo /usr/local/sbin/alcasar-mysql.sh --raz");
124
	exec ("sudo /usr/local/sbin/alcasar-mysql.sh --raz");
125
	}
125
	}
126
# un fichier est importé
126
# un fichier est importé
127
if(isset($_FILES['import-users']))
127
if(isset($_FILES['import-users']))
128
	{
128
	{
129
	unset($result);
129
	unset($result);
130
	if (isset ($_POST['service'])) $service = $_POST['service'];
130
	if (isset ($_POST['service'])) $service = $_POST['service'];
131
	if (isset ($_POST['groupe'])) $group = $_POST ['groupe'];
131
	if (isset ($_POST['groupe'])) $group = $_POST ['groupe'];
132
	$destination = '/tmp/import_file.txt';
132
	$destination = '/tmp/import_file.txt';
133
	list($name_file , $extension) = explode("." , $_FILES['import-users']['name']); 
133
	list($name_file , $extension) = explode("." , $_FILES['import-users']['name']); 
134
	$extension = strstr($_FILES['import-users']['name'], '.');
134
	$extension = strstr($_FILES['import-users']['name'], '.');
135
	if ($choix == "csv")
135
	if ($choix == "csv")
136
//import d'un fichier txt
136
//import d'un fichier txt
137
		{
137
		{
138
		if (($extension != '.csv') && ($extension != '.txt')) $result = $l_error_ext_txt;
138
		if (($extension != '.csv') && ($extension != '.txt')) $result = $l_error_ext_txt;
139
		else 
139
		else 
140
			{
140
			{
141
			$tmpdate = date("Ymd-hms");
141
			$tmpdate = date("Ymd-hms");
142
			$file_out = "/tmp/$tmpdate-$name_file.pwd" ;
142
			$file_out = "/tmp/$tmpdate-$name_file.pwd" ;
143
			exec ("sudo /usr/local/sbin/alcasar-mysql.sh --dump");
143
			exec ("sudo /usr/local/sbin/alcasar-mysql.sh --dump");
144
			move_uploaded_file($_FILES['import-users']['tmp_name'], $destination);
144
			move_uploaded_file($_FILES['import-users']['tmp_name'], $destination);
145
			$RS_in   = file ($destination);
145
			$RS_in   = file ($destination);
146
			$da_abort=0;
146
			$da_abort=0;
147
			if ($link)
147
			if ($link)
148
				{
148
				{
149
				if (is_file($LIBpath."crypt/$config[general_encryption_method].php"))
149
				if (is_file($LIBpath."crypt/$config[general_encryption_method].php"))
150
					{
150
					{
151
					include($LIBpath."crypt/$config[general_encryption_method].php");			
151
					include($LIBpath."crypt/$config[general_encryption_method].php");			
152
					$RS_out = fopen ("$file_out", "wb");
152
					$RS_out = fopen ("$file_out", "wb");
153
					foreach ($RS_in as $no => $ligne)
153
					foreach ($RS_in as $no => $ligne)
154
						{
154
						{
155
						$tligne = split(" ",$ligne);
155
						$tligne = split(" ",$ligne);
156
						$login  = str_replace("%0D","",str_replace("%0A","",urlencode ($tligne[0])));
156
						$login  = str_replace("%0D","",str_replace("%0A","",urlencode ($tligne[0])));
-
 
157
						$password  = str_replace("%0D","",str_replace("%0A","",urlencode ($tligne[1])));
157
						if ($login != '')
158
						if ($login != '')
158
							{
159
							{
-
 
160
							if ($password == "")
-
 
161
								{
159
							$password = GenPassword();		
162
								$password = GenPassword();
-
 
163
								}	
160
							$passwd = da_encrypt($password);
164
							$passwd = da_encrypt($password);
161
							$passwd = da_sql_escape_string($passwd);
165
							$passwd = da_sql_escape_string($passwd);
162
/* insertion (login + password) dans la table "radcheck" (si l'usager existe --> changement de mot de passe) */
166
/* insertion (login + password) dans la table "radcheck" (si l'usager existe --> changement de mot de passe) */
163
							$res = @da_sql_query($link,$config,"INSERT INTO $config[sql_check_table] (attribute,value,username $text) VALUES ('$config[sql_password_attribute]','$passwd','$login' $passwd_op);");
167
							$res = @da_sql_query($link,$config,"INSERT INTO $config[sql_check_table] (attribute,value,username $text) VALUES ('$config[sql_password_attribute]','$passwd','$login' $passwd_op);");
164
							if (!$res || !@da_sql_affected_rows($link,$res,$config))
168
							if (!$res || !@da_sql_affected_rows($link,$res,$config))
165
								{
169
								{
166
								echo "<b>Unable to add user $login: " . da_sql_error($link,$config) . "</b><br>\n";
170
								echo "<b>Unable to add user $login: " . da_sql_error($link,$config) . "</b><br>\n";
167
								$da_abort=1;
171
								$da_abort=1;
168
								}
172
								}
169
							else
173
							else
170
								{
174
								{
171
								creatlog ($login,$password,$service,$RS_out);
175
								creatlog ($login,$password,$service,$RS_out);
172
								/*echo $login." : ".$password." , ";*/
176
								/*echo $login." : ".$password." , ";*/
173
								}	
177
								}	
174
/* insertion de l'usager dans la table "userinfo" */
178
/* insertion de l'usager dans la table "userinfo" */
175
							if ($config[sql_use_user_info_table] == 'true' && !$da_abort)
179
							if ($config[sql_use_user_info_table] == 'true' && !$da_abort)
176
								{
180
								{
177
							$res = @da_sql_query($link,$config, "SELECT username FROM $config[sql_user_info_table] WHERE username = '$login';");
181
							$res = @da_sql_query($link,$config, "SELECT username FROM $config[sql_user_info_table] WHERE username = '$login';");
178
							if ($res)
182
							if ($res)
179
								{
183
								{
180
								if (!@da_sql_num_rows($res,$config))
184
								if (!@da_sql_num_rows($res,$config))
181
									{
185
									{
182
									$res = @da_sql_query($link,$config,"INSERT INTO $config[sql_user_info_table] (username,department) VALUES ('$login','$service');");
186
									$res = @da_sql_query($link,$config,"INSERT INTO $config[sql_user_info_table] (username,department) VALUES ('$login','$service');");
183
									if (!$res || !@da_sql_affected_rows($link,$res,$config))
187
									if (!$res || !@da_sql_affected_rows($link,$res,$config))
184
										echo "<b>Could not add user information in user info table: " . da_sql_error($link,$config) . "</b><br>\n";
188
										echo "<b>Could not add user information in user info table: " . da_sql_error($link,$config) . "</b><br>\n";
185
									}	
189
									}	
186
								else
190
								else
187
									echo "<b>User already exists in user info table.</b><br>\n";
191
									echo "<b>User already exists in user info table.</b><br>\n";
188
								}
192
								}
189
							else
193
							else
190
								echo "<b>Could not add user information in user info table: " . da_sql_error($link,$config) . "</b><br>\n";
194
								echo "<b>Could not add user information in user info table: " . da_sql_error($link,$config) . "</b><br>\n";
191
								if ($group != '')
195
								if ($group != '')
192
									{
196
									{
193
									$group = da_sql_escape_string($group);
197
									$group = da_sql_escape_string($group);
194
									$res = @da_sql_query($link,$config,"SELECT username FROM $config[sql_usergroup_table] WHERE username = '$login' AND groupname = '$group';");
198
									$res = @da_sql_query($link,$config,"SELECT username FROM $config[sql_usergroup_table] WHERE username = '$login' AND groupname = '$group';");
195
									if ($res)
199
									if ($res)
196
										{
200
										{
197
										if (!@da_sql_num_rows($res,$config))
201
										if (!@da_sql_num_rows($res,$config))
198
											{
202
											{
199
											$res = @da_sql_query($link,$config,"INSERT INTO $config[sql_usergroup_table] (username,groupname) VALUES ('$login','$group');");
203
											$res = @da_sql_query($link,$config,"INSERT INTO $config[sql_usergroup_table] (username,groupname) VALUES ('$login','$group');");
200
											if (!$res || !@da_sql_affected_rows($link,$res,$config))
204
											if (!$res || !@da_sql_affected_rows($link,$res,$config))
201
												echo "<b>Could not add user to group $group. SQL Error</b><br>\n";
205
												echo "<b>Could not add user to group $group. SQL Error</b><br>\n";
202
											} # end if 
206
											} # end if 
203
										else
207
										else
204
											echo "<b>User already is a member of group $group</b><br>\n";
208
											echo "<b>User already is a member of group $group</b><br>\n";
205
										} # end if
209
										} # end if
206
									else
210
									else
207
										echo "<b>Could not add user to group $group: " . da_sql_error($link,$config) . "</b><br>\n";
211
										echo "<b>Could not add user to group $group: " . da_sql_error($link,$config) . "</b><br>\n";
208
									} # end if ($group)
212
									} # end if ($group)
209
						 		} # end if ($config)		
213
						 		} # end if ($config)		
210
							} # end if ($login !='')
214
							} # end if ($login !='')
211
						} # end foreach
215
						} # end foreach
212
					fclose($RS_out);
216
					fclose($RS_out);
213
					} # end if (is file)
217
					} # end if (is file)
214
				} # end if (link)
218
				} # end if (link)
215
			}
219
			}
216
		}
220
		}
217
	else if ($choix == "bdd")
221
	else if ($choix == "bdd")
218
//import d'une Bdd
222
//import d'une Bdd
219
		{
223
		{
220
		if ($extension != '.sql') $result = $l_error_ext_sql;
224
		if ($extension != '.sql') $result = $l_error_ext_sql;
221
		else 
225
		else 
222
			{
226
			{
223
			exec ("sudo /usr/local/sbin/alcasar-mysql.sh --dump");
227
			exec ("sudo /usr/local/sbin/alcasar-mysql.sh --dump");
224
			move_uploaded_file($_FILES['import-users']['tmp_name'], $destination);
228
			move_uploaded_file($_FILES['import-users']['tmp_name'], $destination);
225
			exec ("sudo /usr/local/sbin/alcasar-mysql.sh --import $destination");
229
			exec ("sudo /usr/local/sbin/alcasar-mysql.sh --import $destination");
226
			}
230
			}
227
		}
231
		}
228
	}
232
	}
229
if ($link)
233
if ($link)
230
	{
234
	{
231
	$res = @da_sql_query($link,$config,"SELECT GroupName FROM radusergroup GROUP BY GroupName");
235
	$res = @da_sql_query($link,$config,"SELECT GroupName FROM radusergroup GROUP BY GroupName");
232
	if ($res)
236
	if ($res)
233
		{
237
		{
234
		$nb_group = @da_sql_num_rows($res,$config);
238
		$nb_group = @da_sql_num_rows($res,$config);
235
		echo $nb_group;
239
		echo $nb_group;
236
		}
240
		}
237
	}
241
	}
238
echo ", $l_number_of_users = ";
242
echo ", $l_number_of_users = ";
239
if ($link)
243
if ($link)
240
	{
244
	{
241
	$res = @da_sql_query($link,$config,"SELECT UserName FROM userinfo");
245
	$res = @da_sql_query($link,$config,"SELECT UserName FROM userinfo");
242
	if ($res)
246
	if ($res)
243
		{
247
		{
244
		$nb_user = @da_sql_num_rows($res,$config);
248
		$nb_user = @da_sql_num_rows($res,$config);
245
		echo "$nb_user";
249
		echo "$nb_user";
246
		}
250
		}
247
	}
251
	}
248
echo "</td></tr><tr><td>";
252
echo "</td></tr><tr><td>";
249
echo "<TABLE width=\"100%\" border=0 cellspacing=0 cellpadding=1>";
253
echo "<TABLE width=\"100%\" border=0 cellspacing=0 cellpadding=1>";
250
echo "<tr><td valign=\"middle\" align=\"left\" colspan=\"2\">";
254
echo "<tr><td valign=\"middle\" align=\"left\" colspan=\"2\">";
251
echo "<CENTER><H3>$l_text_import</H3></CENTER></td></tr>";
255
echo "<CENTER><H3>$l_text_import</H3></CENTER></td></tr>";
252
echo "<tr><td valign=\"middle\" align=\"left\">";
256
echo "<tr><td valign=\"middle\" align=\"left\">";
253
echo "$l_text_import_help<br>";
257
echo "$l_text_import_help<br>";
254
echo "<tr><td valign=\"middle\" align=\"left\">";
258
echo "<tr><td valign=\"middle\" align=\"left\">";
255
echo "<br><FORM action='$_SERVER[PHP_SELF]' method=POST ENCTYPE=\"multipart/form-data\">";
259
echo "<br><FORM action='$_SERVER[PHP_SELF]' method=POST ENCTYPE=\"multipart/form-data\">";
256
echo "$l_file (.txt) : <input type=\"file\" name=\"import-users\"><br>";
260
echo "$l_file (.txt) : <input type=\"file\" name=\"import-users\"><br>";
257
echo "$l_users_service : <input type=\"input\" name=\"service\" value=\"\"><br>";
261
echo "$l_users_service : <input type=\"input\" name=\"service\" value=\"\"><br>";
258
echo "$l_users_group : ";
262
echo "$l_users_group : ";
259
require("../lib/defaults.php");
263
require("../lib/defaults.php");
260
include_once("../lib/$config[general_lib_type]/group_info.php");
264
include_once("../lib/$config[general_lib_type]/group_info.php");
261
if (isset($existing_groups)){
265
if (isset($existing_groups)){
262
	echo "<select name=\"groupe\">";
266
	echo "<select name=\"groupe\">";
263
	echo "<option value=\"\" selected>";
267
	echo "<option value=\"\" selected>";
264
	foreach ($member_groups as $group)
268
	foreach ($member_groups as $group)
265
		echo "<option value=\"$group\">$group\n";
269
		echo "<option value=\"$group\">$group\n";
266
	echo " </select>";
270
	echo " </select>";
267
	}
271
	}
268
else echo "$l_group_empty";
272
else echo "$l_group_empty";
269
echo "<br>";
273
echo "<br>";
270
echo "<input type='hidden' name='choix' value='csv'>";
274
echo "<input type='hidden' name='choix' value='csv'>";
271
if (($choix == "csv") && isset($result)) echo "<b>".$result."</b><BR>";
275
if (($choix == "csv") && isset($result)) echo "<b>".$result."</b><BR>";
272
echo "<input type=\"submit\" value=\"$l_send\">";
276
echo "<input type=\"submit\" value=\"$l_send\">";
273
echo "</FORM></td>";
277
echo "</FORM></td>";
274
echo "<td>";
278
echo "<td>";
275
$ImportFileList = getImportFileList();
279
$ImportFileList = getImportFileList();
276
if (count($ImportFileList) > 0){
280
if (count($ImportFileList) > 0){
277
	echo "$l_imported_files";
281
	echo "$l_imported_files";
278
	echo "<ul>";
282
	echo "<ul>";
279
	foreach ( $ImportFileList as $ImportFile ) //on parcours le tableau 
283
	foreach ( $ImportFileList as $ImportFile ) //on parcours le tableau 
280
	{
284
	{
281
	echo "<li>".$ImportFile." ( <a href=\"import_file.php?file=$ImportFile\">txt</a> - <a href=\"import_file.php?file=$ImportFile&format=pdf\">pdf</a> )</li>";
285
	echo "<li>".$ImportFile." ( <a href=\"import_file.php?file=$ImportFile\">txt</a> - <a href=\"import_file.php?file=$ImportFile&format=pdf\">pdf</a> )</li>";
282
	} 
286
	} 
283
	echo "</ul>";
287
	echo "</ul>";
284
} else {
288
} else {
285
	echo "<br>";
289
	echo "<br>";
286
}
290
}
287
echo "</td></tr></table>";
291
echo "</td></tr></table>";
288
echo "<tr><td valign=\"middle\" align=\"left\">";
292
echo "<tr><td valign=\"middle\" align=\"left\">";
289
echo "<H3><CENTER>$l_db_import</CENTER></H3>";
293
echo "<H3><CENTER>$l_db_import</CENTER></H3>";
290
echo "$l_db_import_help <br><br>";
294
echo "$l_db_import_help <br><br>";
291
echo "<FORM action='$_SERVER[PHP_SELF]' method=POST ENCTYPE=\"multipart/form-data\">";
295
echo "<FORM action='$_SERVER[PHP_SELF]' method=POST ENCTYPE=\"multipart/form-data\">";
292
echo "$l_file (.sql) : <input type=\"file\" name=\"import-users\"><br>";
296
echo "$l_file (.sql) : <input type=\"file\" name=\"import-users\"><br>";
293
echo "<input type='hidden' name='choix' value='bdd'>";
297
echo "<input type='hidden' name='choix' value='bdd'>";
294
if (($choix == "bdd") && isset($result)) echo "<b>".$result."</b><BR>";
298
if (($choix == "bdd") && isset($result)) echo "<b>".$result."</b><BR>";
295
echo "<input type=\"submit\" value=\"$l_send\">";
299
echo "<input type=\"submit\" value=\"$l_send\">";
296
echo "</FORM>";
300
echo "</FORM>";
297
echo "</td></tr>";
301
echo "</td></tr>";
298
echo "<tr><td valign=\"middle\" align=\"left\">";
302
echo "<tr><td valign=\"middle\" align=\"left\">";
299
echo "<H3><CENTER>$l_db_reset</CENTER></H3>";
303
echo "<H3><CENTER>$l_db_reset</CENTER></H3>";
300
echo "$l_db_import_help<br><br>";
304
echo "$l_db_import_help<br><br>";
301
echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
305
echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
302
echo "<input type='hidden' name='choix' value='raz'>";
306
echo "<input type='hidden' name='choix' value='raz'>";
303
echo "<input type=\"submit\" value=\"$l_send\">";
307
echo "<input type=\"submit\" value=\"$l_send\">";
304
echo "</FORM>";
308
echo "</FORM>";
305
echo "</TD></TR></TABLE>";
309
echo "</TD></TR></TABLE>";
306
?>
310
?>
307
</BODY>
311
</BODY>
308
</HTML>
312
</HTML>
309
<?php
313
<?php
310
 
314