Subversion Repositories ALCASAR

Rev

Rev 40 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 40 Rev 113
1
<?php
1
<?php
2
# Choice of language
2
# Choice of language
3
$Language = 'en';
3
$Language = 'en';
4
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
4
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
5
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
5
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
6
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
6
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
7
if($Language == 'fr'){
7
if($Language == 'fr'){
8
  $l_title = "Cr&eacute;ation d'un usager";
8
  $l_title = "Cr&eacute;ation d'un usager";
9
  $l_frame_top = "Gestion des usagers";
9
  $l_frame_top = "Gestion des usagers";
10
  $l_frame = "Cr&eacute;ation d'un usager";
10
  $l_frame = "Cr&eacute;ation d'un usager";
11
  $l_user_exist = "existe d&eacute;j&agrave;";
11
  $l_user_exist = "existe d&eacute;j&agrave;";
12
  $l_login = "Identifiant";
12
  $l_login = "Identifiant";
13
  $l_password = "Mot de passe";
13
  $l_password = "Mot de passe";
14
  $l_passwd_gen = "g&eacute;n&eacute;rer";
14
  $l_passwd_gen = "g&eacute;n&eacute;rer";
15
  $l_group = "Groupe";
15
  $l_group = "Groupe";
16
  $l_group_empty = "La liste des groupes est vide";
16
  $l_group_empty = "La liste des groupes est vide";
17
  $l_name = "Nom et pr&eacute;nom";
17
  $l_name = "Nom et pr&eacute;nom";
18
  $l_email = "Adresse de couriel";
18
  $l_email = "Adresse de couriel";
19
}
19
}
20
else {
20
else {
21
  $l_title = "Create a user";
21
  $l_title = "Create a user";
22
  $l_frame_top = "Users admin";
22
  $l_frame_top = "Users admin";
23
  $l_frame = "Create a user";
23
  $l_frame = "Create a user";
24
  $l_user_exist = "already exist";
24
  $l_user_exist = "already exist";
25
  $l_login = "Login";
25
  $l_login = "Login";
26
  $l_password = "Password";
26
  $l_password = "Password";
27
  $l_passwd_gen = "generate";
27
  $l_passwd_gen = "generate";
28
  $l_group = "Group";
28
  $l_group = "Group";
29
  $l_group_empty = "The group list is empty";
29
  $l_group_empty = "The group list is empty";
30
  $l_name = "Surname and name";
30
  $l_name = "Surname and name";
31
  $l_email = "Email Address";
31
  $l_email = "Email Address";
32
}
32
}
33
 
33
 
34
 
34
 
35
require('/etc/freeradius-web/config.php');
35
require('/etc/freeradius-web/config.php');
36
if ($show == 1){
36
if ($show == 1){
37
	header("Location: user_admin.php?login=$login");
37
	header("Location: user_admin.php?login=$login");
38
	exit;
38
	exit;
39
}
39
}
40
require('../lib/attrshow.php');
40
require('../lib/attrshow.php');
41
require('../lib/defaults.php');
41
require('../lib/defaults.php');
42
 
42
 
43
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){
43
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){
44
	$colspan=2;
44
	$colspan=2;
45
	$show_ops=1;
45
	$show_ops=1;
46
}else{
46
}else{
47
	$show_ops = 0;
47
	$show_ops = 0;
48
	$colspan=1;
48
	$colspan=1;
49
}
49
}
50
echo "<html><head><title>$l_title</title>";
50
echo "<html><head><title>$l_title</title>";
51
?>
51
?>
52
 
52
 
53
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>">
53
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>">
54
<link rel="stylesheet" href="/css/style.css">
54
<link rel="stylesheet" href="/css/style.css">
55
<script language="javascript" type="text/javascript">
55
<script language="javascript" type="text/javascript">
56
var chars='0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ'
56
var chars='0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ'
57
function password(size)
57
function password(size)
58
  {
58
  {
59
  var pass=''
59
  var pass=''
60
  while(pass.length < size)
60
  while(pass.length < size)
61
  {
61
  {
62
    pass+=chars.charAt(Math.round(Math.random() * (chars.length)))
62
    pass+=chars.charAt(Math.round(Math.random() * (chars.length)))
63
  }
63
  }
64
  document.form1.passwd.value=pass
64
  document.newuser.passwd.value=pass
65
  document.form1.pwdgene.value=pass
65
  document.newuser.pwdgene.value=pass
-
 
66
}
-
 
67
function formControl(){
-
 
68
	var myregex = /[\S]+/gi; //un ou plusieurs caractères non blanc" (tous les caractères sauf espace, retour chariot, tabulation, saut de ligne, saut de page).
-
 
69
	if (myregex.test(document.newuser.login.value)){
-
 
70
		document.newuser.create.value=1;
-
 
71
		return true;
-
 
72
	} else {
-
 
73
		alert("Votre identifiant est invalide.");//non internationnalisé
-
 
74
		return false;
-
 
75
	}
66
}
76
}
67
</script>
77
</script>
68
</head>
78
</head>
69
<body>
79
<body>
70
 
80
 
71
<?php
81
<?php
72
include("password_generator.jsc");
82
include("password_generator.jsc");
73
echo "<TABLE width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
83
echo "<TABLE width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
74
echo "<tr><th>$l_frame_top</th></tr>";
84
echo "<tr><th>$l_frame_top</th></tr>";
75
?>
85
?>
76
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" 
86
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" 
77
height="2"></td></tr>
87
height="2"></td></tr>
78
</TABLE>
88
</TABLE>
79
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
89
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
80
	<tr bgcolor="#666666"><td>
90
	<tr bgcolor="#666666"><td>
81
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
91
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
82
		<tr><td valign="middle" align="left">
92
		<tr><td valign="middle" align="left">
83
<center>
93
<center>
84
<table border=0 width=550 cellpadding=1 cellspacing=1>
94
<table border=0 width=550 cellpadding=1 cellspacing=1>
85
<tr valign=top>
95
<tr valign=top>
86
<td width=340></td>
96
<td width=340></td>
87
<td bgcolor="black" width=200>
97
<td bgcolor="black" width=200>
88
	<table border=0 width=100% cellpadding=2 cellspacing=0>
98
	<table border=0 width=100% cellpadding=2 cellspacing=0>
89
	<tr bgcolor="#907030" align=right valign=top><th>
99
	<tr bgcolor="#907030" align=right valign=top><th>
90
	<font color="white"><? echo "$l_frame"; ?></font>
100
	<font color="white"><? echo "$l_frame"; ?></font>
91
	</th></tr>
101
	</th></tr>
92
	</table>
102
	</table>
93
</td></tr>
103
</td></tr>
94
<tr bgcolor="black" valign=top><td colspan=2>
104
<tr bgcolor="black" valign=top><td colspan=2>
95
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
105
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
96
	<tr><td>
106
	<tr><td>
97
   
107
   
98
<?php
108
<?php
99
if ($create == 1){
109
if ($create == 1){
100
	if (is_file("../lib/$config[general_lib_type]/user_info.php"))
110
	if (is_file("../lib/$config[general_lib_type]/user_info.php"))
101
		include("../lib/$config[general_lib_type]/user_info.php");
111
		include("../lib/$config[general_lib_type]/user_info.php");
102
	if ($user_exists != "no"){
112
	if ($user_exists != "no"){
103
		echo <<<EOM
113
		echo <<<EOM
104
<b><i>$login</i> $l_user_exist</b>
114
<b><i>$login</i> $l_user_exist</b>
105
EOM;
115
EOM;
106
	}
116
	}
107
	else{
117
	else{
108
		if (is_file("../lib/$config[general_lib_type]/create_user.php"))
118
		if (is_file("../lib/$config[general_lib_type]/create_user.php"))
109
			include("../lib/$config[general_lib_type]/create_user.php");
119
			include("../lib/$config[general_lib_type]/create_user.php");
110
		require("../lib/defaults.php");
120
		require("../lib/defaults.php");
111
		if (is_file("../lib/$config[general_lib_type]/user_info.php"))
121
		if (is_file("../lib/$config[general_lib_type]/user_info.php"))
112
			include("../lib/$config[general_lib_type]/user_info.php");
122
			include("../lib/$config[general_lib_type]/user_info.php");
113
	}
123
	}
114
}
124
}
115
?>
125
?>
116
   <form name="form1" method=post>
126
   <form name="newuser" method=post>
117
      <input type=hidden name=create value="0">
127
      <input type=hidden name=create value="0">
118
      <input type=hidden name=show value="0">
128
      <input type=hidden name=show value="0">
119
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
129
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
120
<?php
130
<?php
121
	echo <<<EOM
131
	echo <<<EOM
122
	<tr>
132
	<tr>
123
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
133
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
124
		$l_login
134
		$l_login
125
		</td><td>
135
		</td><td>
126
		<input type=text name="login" value="$login" size=35>
136
		<input type=text name="login" value="$login" size=35>
127
		</td>
137
		</td>
128
	</tr>
138
	</tr>
129
	<tr>
139
	<tr>
130
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
140
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
131
		$l_password
141
		$l_password
132
		</td><td>
142
		</td><td>
133
		<input type=password name="passwd" size=35>
143
		<input type=password name="passwd" size=35>
134
		<br /><input type="button" value="$l_passwd_gen" onclick="password(8)">
144
		<br /><input type="button" value="$l_passwd_gen" onclick="password(8)">
135
		<input type="text" value="" name="pwdgene" size=20 readonly>
145
		<input type="text" value="" name="pwdgene" size=20 readonly>
136
		</td>
146
		</td>
137
	</tr>
147
	</tr>
138
EOM;
148
EOM;
139
	if ($config[general_lib_type] == 'sql'){
149
	if ($config[general_lib_type] == 'sql'){
140
		if (isset($member_groups))
150
		if (isset($member_groups))
141
			$selected[$member_groups[0]] = 'selected';
151
			$selected[$member_groups[0]] = 'selected';
142
		echo <<<EOM
152
		echo <<<EOM
143
	<tr>
153
	<tr>
144
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
154
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
145
		$l_group
155
		$l_group
146
		</td><td>
156
		</td><td>
147
EOM;
157
EOM;
148
		include_once("../lib/$config[general_lib_type]/group_info.php");
158
		include_once("../lib/$config[general_lib_type]/group_info.php");
149
		if (isset($existing_groups)){
159
		if (isset($existing_groups)){
150
			echo "	<select name=\"Fgroup\">";
160
			echo "	<select name=\"Fgroup\">";
151
			foreach ($member_groups as $group)
161
			foreach ($member_groups as $group)
152
				echo "<option value=\"$group\" $selected[$group]>$group\n";
162
				echo "<option value=\"$group\" $selected[$group]>$group\n";
153
			echo " </select>";
163
			echo " </select>";
154
			}
164
			}
155
		else echo "$l_group_empty";
165
		else echo "$l_group_empty";
156
	echo "</td></tr>";
166
	echo "</td></tr>";
157
	}
167
	}
158
	if ($config[general_lib_type] == 'ldap' ||
168
	if ($config[general_lib_type] == 'ldap' ||
159
	($config[general_lib_type] == 'sql' && $config[sql_use_user_info_table] == 'true')){
169
	($config[general_lib_type] == 'sql' && $config[sql_use_user_info_table] == 'true')){
160
		echo <<<EOM
170
		echo <<<EOM
161
	<tr>
171
	<tr>
162
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
172
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
163
		$l_name
173
		$l_name
164
		</td><td>
174
		</td><td>
165
		<input type=text name="Fcn" value="$cn" size=35>
175
		<input type=text name="Fcn" value="$cn" size=35>
166
		</td>
176
		</td>
167
	</tr>
177
	</tr>
168
	<tr>
178
	<tr>
169
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
179
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
170
		$l_email
180
		$l_email
171
		</td><td>
181
		</td><td>
172
		<input type=text name="Fmail" value="$mail" size=35>
182
		<input type=text name="Fmail" value="$mail" size=35>
173
		</td>
183
		</td>
174
	</tr>
184
	</tr>
175
	<tr>
185
	<tr>
176
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
186
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
177
		Service
187
		Service
178
		</td><td>
188
		</td><td>
179
		<input type=text name="Fou" value="$ou" size=35>
189
		<input type=text name="Fou" value="$ou" size=35>
180
		</td>
190
		</td>
181
	</tr>
191
	</tr>
182
	<tr>
192
	<tr>
183
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
193
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
184
		Nro TPH personnel
194
		Nro TPH personnel
185
		</td><td>
195
		</td><td>
186
		<input type=text name="Fhomephone" value="$homephone" size=35>
196
		<input type=text name="Fhomephone" value="$homephone" size=35>
187
		</td>
197
		</td>
188
	</tr>
198
	</tr>
189
	<tr>
199
	<tr>
190
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
200
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
191
		Nro TPH bureau
201
		Nro TPH bureau
192
		</td><td>
202
		</td><td>
193
		<input type=text name="Ftelephonenumber" value="$telephonenumber" size=35>
203
		<input type=text name="Ftelephonenumber" value="$telephonenumber" size=35>
194
		</td>
204
		</td>
195
	</tr>
205
	</tr>
196
	<tr>
206
	<tr>
197
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
207
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
198
		Nro TPH mobile
208
		Nro TPH mobile
199
		</td><td>
209
		</td><td>
200
		<input type=text name="Fmobile" value="$mobile" size=35>
210
		<input type=text name="Fmobile" value="$mobile" size=35>
201
		</td>
211
		</td>
202
	</tr>
212
	</tr>
203
EOM;
213
EOM;
204
	}
214
	}
205
	foreach($show_attrs as $key => $desc){
215
	foreach($show_attrs as $key => $desc){
206
		$name = $attrmap["$key"];
216
		$name = $attrmap["$key"];
207
		if ($name == 'none')
217
		if ($name == 'none')
208
			continue;
218
			continue;
209
		$oper_name = $name . '_op';
219
		$oper_name = $name . '_op';
210
		$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0];
220
		$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0];
211
		print <<<EOM
221
		print <<<EOM
212
<tr>
222
<tr>
213
<td align=right bgcolor="#d0ddb0">
223
<td align=right bgcolor="#d0ddb0">
214
$desc
224
$desc
215
</td>
225
</td>
216
EOM;
226
EOM;
217
 
227
 
218
		if ($show_ops){
228
		if ($show_ops){
219
				switch ($key)
229
				switch ($key)
220
					{
230
					{
221
					case 'Simultaneous-Use' : 
231
					case 'Simultaneous-Use' : 
222
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
232
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
223
						break;
233
						break;
224
					case 'Login-Time' : 
234
					case 'Login-Time' : 
225
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
235
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
226
						break;
236
						break;
227
					case 'Expiration' :
237
					case 'Expiration' :
228
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
238
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
229
						break;
239
						break;
230
					case 'Session-Timeout' :
240
					case 'Session-Timeout' :
231
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
241
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
232
						break;
242
						break;
233
					case 'Max-Daily-Session' :
243
					case 'Max-Daily-Session' :
234
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
244
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
235
						break;
245
						break;
236
					case 'Max-Weekly-Session' :
246
					case 'Max-Weekly-Session' :
237
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
247
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
238
						break;
248
						break;
239
					case 'Max-Monthly-Session' :
249
					case 'Max-Monthly-Session' :
240
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
250
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
241
						break;
251
						break;
-
 
252
					case 'ChilliSpot-Max-Input-Octets' :
-
 
253
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
254
						break;
-
 
255
					case 'ChilliSpot-Max-Output-Octets' :
-
 
256
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
257
						break;
-
 
258
					case 'ChilliSpot-Max-Total-Octets' :
-
 
259
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
260
						break;
-
 
261
					case 'ChilliSpot-Bandwidth-Max-Up' :
-
 
262
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
263
						break;
-
 
264
					case 'ChilliSpot-Bandwidth-Max-Down' :
-
 
265
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
266
						break;
-
 
267
					case 'WISPr-Redirection-URL' :
-
 
268
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
269
						break;
242
					default :
270
					default :
243
						print <<<EOM
271
						print <<<EOM
244
<td>
272
<td>
245
<select name=$oper_name>
273
<select name=$oper_name>
246
<option $selected[$op_eq] value="=">=
274
<option $selected[$op_eq] value="=">=
247
<option $selected[$op_set] value=":=">:=
275
<option $selected[$op_set] value=":=">:=
248
<option $selected[$op_add] value="+=">+=
276
<option $selected[$op_add] value="+=">+=
249
<option $selected[$op_eq2] value="==">==
277
<option $selected[$op_eq2] value="==">==
250
<option $selected[$op_ne] value="!=">!=
278
<option $selected[$op_ne] value="!=">!=
251
<option $selected[$op_gt] value=">">&gt;
279
<option $selected[$op_gt] value=">">&gt;
252
<option $selected[$op_ge] value=">=">&gt;=
280
<option $selected[$op_ge] value=">=">&gt;=
253
<option $selected[$op_lt] value="<">&lt;
281
<option $selected[$op_lt] value="<">&lt;
254
<option $selected[$op_le] value="<=">&lt;=
282
<option $selected[$op_le] value="<=">&lt;=
255
<option $selected[$op_regeq] value="=~">=~
283
<option $selected[$op_regeq] value="=~">=~
256
<option $selected[$op_regne] value="!~">!~
284
<option $selected[$op_regne] value="!~">!~
257
<option $selected[$op_exst] value="=*">=*
285
<option $selected[$op_exst] value="=*">=*
258
<option $selected[$op_nexst] value="!*">!*
286
<option $selected[$op_nexst] value="!*">!*
259
</select>
287
</select>
260
</td>
288
</td>
261
EOM;
289
EOM;
262
						break;
290
						break;
263
					}
291
					}
264
		}
292
		}
265
		print <<<EOM
293
		print <<<EOM
266
<td>
294
<td>
267
<input type=text name="$name" value="$val" size=35>
295
<input type=text name="$name" value="$val" size=35>
268
</td>
296
</td>
269
</tr>
297
</tr>
270
EOM;
298
EOM;
271
	}
299
	}
272
echo "</table><BR>";
300
echo "</table><BR>";
273
if ($create == 1)
301
if ($create == 1)
274
	echo "<input type=submit class=button value=\"Afficher le profil de l'utilisateur\" OnClick=\"this.form.show.value=1\">";
302
	echo "<input type=submit class=button value=\"Afficher le profil de l'utilisateur\" OnClick=\"this.form.show.value=1\">";
275
	else{
303
	else{
276
	echo "<input type=submit class=button value=\"Cr&eacute;er\" OnClick=\"this.form.create.value=1\">";}
304
	//echo "<input type=submit class=button value=\"Cr&eacute;er\" OnClick=\"this.form.create.value=1\">";}
-
 
305
	echo "<input type=submit class=button value=\"Cr&eacute;er\" OnClick=\"return formControl();\">";}
277
?>
306
?>
278
</form>
307
</form>
279
	</td></tr>
308
	</td></tr>
280
</table>
309
</table>
281
</tr>
310
</tr>
282
</table>
311
</table>
283
</TD></TR>
312
</TD></TR>
284
</TABLE>
313
</TABLE>
285
</td></tr>
314
</td></tr>
286
</TABLE>
315
</TABLE>
287
</body>
316
</body>
288
</html>
317
</html>
289
 
318