Subversion Repositories ALCASAR

Rev

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

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