0,0 → 1,318 |
<?php |
# Choice of language |
$Language = 'en'; |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){ |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']); |
$Language = strtolower(substr(chop($Langue[0]),0,2)); } |
if($Language == 'fr'){ |
$l_title = "Création d'un usager"; |
$l_frame_top = "Gestion des usagers"; |
$l_frame = "Création d'un usager"; |
$l_user_exist = "existe déjà"; |
$l_login = "Identifiant"; |
$l_password = "Mot de passe"; |
$l_passwd_gen = "générer"; |
$l_group = "Groupe"; |
$l_group_empty = "La liste des groupes est vide"; |
$l_name = "Nom et prénom"; |
$l_email = "Adresse de couriel"; |
} |
else { |
$l_title = "Create a user"; |
$l_frame_top = "Users admin"; |
$l_frame = "Create a user"; |
$l_user_exist = "already exist"; |
$l_login = "Login"; |
$l_password = "Password"; |
$l_passwd_gen = "generate"; |
$l_group = "Group"; |
$l_group_empty = "The group list is empty"; |
$l_name = "Surname and name"; |
$l_email = "Email Address"; |
} |
|
|
require('/etc/freeradius-web/config.php'); |
if ($show == 1){ |
header("Location: user_admin.php?login=$login"); |
exit; |
} |
require('../lib/attrshow.php'); |
require('../lib/defaults.php'); |
|
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){ |
$colspan=2; |
$show_ops=1; |
}else{ |
$show_ops = 0; |
$colspan=1; |
} |
echo "<html><head><title>$l_title</title>"; |
?> |
|
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>"> |
<link rel="stylesheet" href="/css/style.css"> |
<script language="javascript" type="text/javascript"> |
var chars='0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ' |
function password(size) |
{ |
var pass='' |
while(pass.length < size) |
{ |
pass+=chars.charAt(Math.round(Math.random() * (chars.length))) |
} |
document.newuser.passwd.value=pass |
document.newuser.pwdgene.value=pass |
} |
function formControl(){ |
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). |
if (myregex.test(document.newuser.login.value)){ |
document.newuser.create.value=1; |
return true; |
} else { |
alert("Votre identifiant est invalide.");//non internationnalis� |
return false; |
} |
} |
</script> |
</head> |
<body> |
|
<?php |
include("password_generator.jsc"); |
echo "<TABLE width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; |
echo "<tr><th>$l_frame_top</th></tr>"; |
?> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
height="2"></td></tr> |
</TABLE> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1> |
<tr bgcolor="#666666"><td> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=2> |
<tr><td valign="middle" align="left"> |
<center> |
<table border=0 width=550 cellpadding=1 cellspacing=1> |
<tr valign=top> |
<td width=340></td> |
<td bgcolor="black" width=200> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white"><? echo "$l_frame"; ?></font> |
</th></tr> |
</table> |
</td></tr> |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
|
<?php |
if ($create == 1){ |
if (is_file("../lib/$config[general_lib_type]/user_info.php")) |
include("../lib/$config[general_lib_type]/user_info.php"); |
if ($user_exists != "no"){ |
echo <<<EOM |
<b><i>$login</i> $l_user_exist</b> |
EOM; |
} |
else{ |
if (is_file("../lib/$config[general_lib_type]/create_user.php")) |
include("../lib/$config[general_lib_type]/create_user.php"); |
require("../lib/defaults.php"); |
if (is_file("../lib/$config[general_lib_type]/user_info.php")) |
include("../lib/$config[general_lib_type]/user_info.php"); |
} |
} |
?> |
<form name="newuser" method=post> |
<input type=hidden name=create value="0"> |
<input type=hidden name=show value="0"> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<?php |
echo <<<EOM |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
$l_login |
</td><td> |
<input type=text name="login" value="$login" size=35> |
</td> |
</tr> |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
$l_password |
</td><td> |
<input type=password name="passwd" size=35> |
<br /><input type="button" value="$l_passwd_gen" onclick="password(8)"> |
<input type="text" value="" name="pwdgene" size=20 readonly> |
</td> |
</tr> |
EOM; |
if ($config[general_lib_type] == 'sql'){ |
if (isset($member_groups)) |
$selected[$member_groups[0]] = 'selected'; |
echo <<<EOM |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
$l_group |
</td><td> |
EOM; |
include_once("../lib/$config[general_lib_type]/group_info.php"); |
if (isset($existing_groups)){ |
echo "<select name=\"Fgroup\">"; |
echo "<option value=\"\">"; |
foreach ($member_groups as $group) |
echo "<option value=\"$group\" $selected[$group]>$group\n"; |
echo " </select>"; |
} |
else echo "$l_group_empty"; |
echo "</td></tr>"; |
} |
if ($config[general_lib_type] == 'ldap' || |
($config[general_lib_type] == 'sql' && $config[sql_use_user_info_table] == 'true')){ |
echo <<<EOM |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
$l_name |
</td><td> |
<input type=text name="Fcn" value="$cn" size=35> |
</td> |
</tr> |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
$l_email |
</td><td> |
<input type=text name="Fmail" value="$mail" size=35> |
</td> |
</tr> |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
Service |
</td><td> |
<input type=text name="Fou" value="$ou" size=35> |
</td> |
</tr> |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
Nro TPH personnel |
</td><td> |
<input type=text name="Fhomephone" value="$homephone" size=35> |
</td> |
</tr> |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
Nro TPH bureau |
</td><td> |
<input type=text name="Ftelephonenumber" value="$telephonenumber" size=35> |
</td> |
</tr> |
<tr> |
<td align=right colspan=$colspan bgcolor="#d0ddb0"> |
Nro TPH mobile |
</td><td> |
<input type=text name="Fmobile" value="$mobile" size=35> |
</td> |
</tr> |
EOM; |
} |
foreach($show_attrs as $key => $desc){ |
$name = $attrmap["$key"]; |
if ($name == 'none') |
continue; |
$oper_name = $name . '_op'; |
$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0]; |
print <<<EOM |
<tr> |
<td align=right bgcolor="#d0ddb0"> |
$desc |
</td> |
EOM; |
|
if ($show_ops){ |
switch ($key) |
{ |
case 'Simultaneous-Use' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
case 'Login-Time' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
case 'Expiration' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
case 'Session-Timeout' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
case 'Max-Daily-Session' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
case 'Max-Weekly-Session' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
case 'Max-Monthly-Session' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:="; |
break; |
case 'ChilliSpot-Max-Input-Octets' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
case 'ChilliSpot-Max-Output-Octets' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
case 'ChilliSpot-Max-Total-Octets' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
case 'ChilliSpot-Bandwidth-Max-Up' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
case 'ChilliSpot-Bandwidth-Max-Down' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
case 'WISPr-Redirection-URL' : |
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">="; |
break; |
default : |
print <<<EOM |
<td> |
<select name=$oper_name> |
<option $selected[$op_eq] value="=">= |
<option $selected[$op_set] value=":=">:= |
<option $selected[$op_add] value="+=">+= |
<option $selected[$op_eq2] value="==">== |
<option $selected[$op_ne] value="!=">!= |
<option $selected[$op_gt] value=">">> |
<option $selected[$op_ge] value=">=">>= |
<option $selected[$op_lt] value="<">< |
<option $selected[$op_le] value="<="><= |
<option $selected[$op_regeq] value="=~">=~ |
<option $selected[$op_regne] value="!~">!~ |
<option $selected[$op_exst] value="=*">=* |
<option $selected[$op_nexst] value="!*">!* |
</select> |
</td> |
EOM; |
break; |
} |
} |
print <<<EOM |
<td> |
<input type=text name="$name" value="$val" size=35> |
</td> |
</tr> |
EOM; |
} |
echo "</table><BR>"; |
if ($create == 1) |
echo "<input type=submit class=button value=\"Afficher le profil de l'utilisateur\" OnClick=\"this.form.show.value=1\">"; |
else{ |
//echo "<input type=submit class=button value=\"Créer\" OnClick=\"this.form.create.value=1\">";} |
echo "<input type=submit class=button value=\"Créer\" OnClick=\"return formControl();\">";} |
?> |
</form> |
</td></tr> |
</table> |
</tr> |
</table> |
</TD></TR> |
</TABLE> |
</td></tr> |
</TABLE> |
</body> |
</html> |