Subversion Repositories ALCASAR

Rev

Go to most recent revision | Details | Last modification | View Log

Rev Author Line No. Line
1 root 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.form1.passwd.value=pass
65
  document.form1.pwdgene.value=pass
66
}
67
</script>
68
</head>
69
<body>
70
 
71
<?php
72
include("password_generator.jsc");
73
echo "<TABLE width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
74
echo "<tr><th>$l_frame_top</th></tr>";
75
?>
76
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" 
77
height="2"></td></tr>
78
</TABLE>
79
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
80
	<tr bgcolor="#666666"><td>
81
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
82
		<tr><td valign="middle" align="left">
83
<center>
84
<table border=0 width=550 cellpadding=1 cellspacing=1>
85
<tr valign=top>
86
<td width=340></td>
87
<td bgcolor="black" width=200>
88
	<table border=0 width=100% cellpadding=2 cellspacing=0>
89
	<tr bgcolor="#907030" align=right valign=top><th>
90
	<font color="white"><? echo "$l_frame"; ?></font>
91
	</th></tr>
92
	</table>
93
</td></tr>
94
<tr bgcolor="black" valign=top><td colspan=2>
95
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
96
	<tr><td>
97
 
98
<?php
99
if ($create == 1){
100
	if (is_file("../lib/$config[general_lib_type]/user_info.php"))
101
		include("../lib/$config[general_lib_type]/user_info.php");
102
	if ($user_exists != "no"){
103
		echo <<<EOM
104
<b><i>$login</i> $l_user_exist</b>
105
EOM;
106
	}
107
	else{
108
		if (is_file("../lib/$config[general_lib_type]/create_user.php"))
109
			include("../lib/$config[general_lib_type]/create_user.php");
110
		require("../lib/defaults.php");
111
		if (is_file("../lib/$config[general_lib_type]/user_info.php"))
112
			include("../lib/$config[general_lib_type]/user_info.php");
113
	}
114
}
115
?>
116
   <form name="form1" method=post>
117
      <input type=hidden name=create value="0">
118
      <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>
120
<?php
121
	echo <<<EOM
122
	<tr>
123
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
124
		$l_login
125
		</td><td>
126
		<input type=text name="login" value="$login" size=35>
127
		</td>
128
	</tr>
129
	<tr>
130
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
131
		$l_password
132
		</td><td>
133
		<input type=password name="passwd" size=35>
134
		<br /><input type="button" value="$l_passwd_gen" onclick="password(8)">
135
		<input type="text" value="" name="pwdgene" size=20 readonly>
136
		</td>
137
	</tr>
138
EOM;
139
	if ($config[general_lib_type] == 'sql'){
140
		if (isset($member_groups))
141
			$selected[$member_groups[0]] = 'selected';
142
		echo <<<EOM
143
	<tr>
144
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
145
		$l_group
146
		</td><td>
147
EOM;
148
		include_once("../lib/$config[general_lib_type]/group_info.php");
149
		if (isset($existing_groups)){
150
			echo "	<select name=\"Fgroup\">";
151
			foreach ($member_groups as $group)
152
				echo "<option value=\"$group\" $selected[$group]>$group\n";
153
			echo " </select>";
154
			}
155
		else echo "$l_group_empty";
156
	echo "</td></tr>";
157
	}
158
	if ($config[general_lib_type] == 'ldap' ||
159
	($config[general_lib_type] == 'sql' && $config[sql_use_user_info_table] == 'true')){
160
		echo <<<EOM
161
	<tr>
162
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
163
		$l_name
164
		</td><td>
165
		<input type=text name="Fcn" value="$cn" size=35>
166
		</td>
167
	</tr>
168
	<tr>
169
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
170
		$l_email
171
		</td><td>
172
		<input type=text name="Fmail" value="$mail" size=35>
173
		</td>
174
	</tr>
175
	<tr>
176
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
177
		Service
178
		</td><td>
179
		<input type=text name="Fou" value="$ou" size=35>
180
		</td>
181
	</tr>
182
	<tr>
183
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
184
		Nro TPH personnel
185
		</td><td>
186
		<input type=text name="Fhomephone" value="$homephone" size=35>
187
		</td>
188
	</tr>
189
	<tr>
190
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
191
		Nro TPH bureau
192
		</td><td>
193
		<input type=text name="Ftelephonenumber" value="$telephonenumber" size=35>
194
		</td>
195
	</tr>
196
	<tr>
197
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
198
		Nro TPH mobile
199
		</td><td>
200
		<input type=text name="Fmobile" value="$mobile" size=35>
201
		</td>
202
	</tr>
203
EOM;
204
	}
205
	foreach($show_attrs as $key => $desc){
206
		$name = $attrmap["$key"];
207
		if ($name == 'none')
208
			continue;
209
		$oper_name = $name . '_op';
210
		$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0];
211
		print <<<EOM
212
<tr>
213
<td align=right bgcolor="#d0ddb0">
214
$desc
215
</td>
216
EOM;
217
 
218
		if ($show_ops){
219
				switch ($key)
220
					{
221
					case 'Simultaneous-Use' : 
222
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
223
						break;
224
					case 'Login-Time' : 
225
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
226
						break;
227
					case 'Expiration' :
228
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
229
						break;
230
					case 'Session-Timeout' :
231
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
232
						break;
233
					case 'Max-Daily-Session' :
234
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
235
						break;
236
					case 'Max-Weekly-Session' :
237
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
238
						break;
239
					case 'Max-Monthly-Session' :
240
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
241
						break;
242
					default :
243
						print <<<EOM
244
<td>
245
<select name=$oper_name>
246
<option $selected[$op_eq] value="=">=
247
<option $selected[$op_set] value=":=">:=
248
<option $selected[$op_add] value="+=">+=
249
<option $selected[$op_eq2] value="==">==
250
<option $selected[$op_ne] value="!=">!=
251
<option $selected[$op_gt] value=">">&gt;
252
<option $selected[$op_ge] value=">=">&gt;=
253
<option $selected[$op_lt] value="<">&lt;
254
<option $selected[$op_le] value="<=">&lt;=
255
<option $selected[$op_regeq] value="=~">=~
256
<option $selected[$op_regne] value="!~">!~
257
<option $selected[$op_exst] value="=*">=*
258
<option $selected[$op_nexst] value="!*">!*
259
</select>
260
</td>
261
EOM;
262
						break;
263
					}
264
		}
265
		print <<<EOM
266
<td>
267
<input type=text name="$name" value="$val" size=35>
268
</td>
269
</tr>
270
EOM;
271
	}
272
echo "</table><BR>";
273
if ($create == 1)
274
	echo "<input type=submit class=button value=\"Afficher le profil de l'utilisateur\" OnClick=\"this.form.show.value=1\">";
275
	else{
276
	echo "<input type=submit class=button value=\"Cr&eacute;er\" OnClick=\"this.form.create.value=1\">";}
277
?>
278
</form>
279
	</td></tr>
280
</table>
281
</tr>
282
</table>
283
</TD></TR>
284
</TABLE>
285
</td></tr>
286
</TABLE>
287
</body>
288
</html>