Subversion Repositories ALCASAR

Rev

Details | Last modification | View Log

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