1,4 → 1,4 |
<?php |
<?php |
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php")) |
include_once("../lib/sql/drivers/$config[sql_type]/functions.php"); |
else{ |
6,7 → 6,7 |
exit(); |
} |
include_once('../lib/functions.php'); |
if ($config[sql_use_operators] == 'true'){ |
if ($config['sql_use_operators'] == 'true'){ |
include_once("../lib/operators.php"); |
$text = ',op'; |
$passwd_op = ",':='"; |
13,7 → 13,7 |
} |
$da_abort=0; |
$op_val2 = ''; |
$link = @da_sql_pconnect($config); |
$link = da_sql_pconnect($config); |
if ($link){ |
if (is_file("../lib/crypt/$config[general_encryption_method].php")){ |
include_once("../lib/crypt/$config[general_encryption_method].php"); |
21,31 → 21,31 |
$passwd_imp = $passwd; |
/*Fin Ajout*/ |
$passwd = da_encrypt($passwd); |
$passwd = da_sql_escape_string($passwd); |
$res = @da_sql_query($link,$config, |
$passwd = da_sql_escape_string($link, $passwd); |
$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);"); |
if (!$res || !@da_sql_affected_rows($link,$res,$config)){ |
if (!$res || !da_sql_affected_rows($link,$res,$config)){ |
echo "<b>Unable to add user $login: " . da_sql_error($link,$config) . "</b><br>\n"; |
$da_abort=1; |
} |
if ($config[sql_use_user_info_table] == 'true' && !$da_abort){ |
$res = @da_sql_query($link,$config, |
if ($config['sql_use_user_info_table'] == 'true' && !$da_abort){ |
$res = da_sql_query($link,$config, |
"SELECT username FROM $config[sql_user_info_table] WHERE |
username = '$login';"); |
if ($res){ |
if (!@da_sql_num_rows($res,$config)){ |
$Fcn = da_sql_escape_string($Fcn); |
$Fmail = da_sql_escape_string($Fmail); |
$Fou = da_sql_escape_string($Fou); |
$Fhomephone = da_sql_escape_string($Fhomephone); |
$Fworkphone = da_sql_escape_string($Fworkphone); |
$Fmobile = da_sql_escape_string($Fmobile); |
$res = @da_sql_query($link,$config, |
if (!da_sql_num_rows($res,$config)){ |
$Fcn = (isset($Fcn)) ? da_sql_escape_string($link, $Fcn) : ''; |
$Fmail = (isset($Fmail)) ? da_sql_escape_string($link, $Fmail) : ''; |
$Fou = (isset($Fou)) ? da_sql_escape_string($link, $Fou) : ''; |
$Fhomephone = (isset($Fhomephone)) ? da_sql_escape_string($link, $Fhomephone) : ''; |
$Ftelephonenumber = (isset($Ftelephonenumber)) ? da_sql_escape_string($link, $Ftelephonenumber) : ''; |
$Fmobile = (isset($Fmobile)) ? da_sql_escape_string($link, $Fmobile) : ''; |
$res = da_sql_query($link,$config, |
"INSERT INTO $config[sql_user_info_table] |
(username,name,mail,department,homephone,workphone,mobile) VALUES |
('$login','$Fcn','$Fmail','$Fou','$Fhomephone','$Ftelephonenumber','$Fmobile');"); |
if (!$res || !@da_sql_affected_rows($link,$res,$config)) |
if (!$res || !da_sql_affected_rows($link,$res,$config)) |
echo "<b>Could not add user information in user info table: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
else |
54,17 → 54,17 |
else |
echo "<b>Could not add user information in user info table: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
if ($Fgroup != ''){ |
$Fgroup = da_sql_escape_string($Fgroup); |
$res = @da_sql_query($link,$config, |
if (isset($Fgroup) && $Fgroup != ''){ |
$Fgroup = da_sql_escape_string($link, $Fgroup); |
$res = da_sql_query($link,$config, |
"SELECT username FROM $config[sql_usergroup_table] |
WHERE username = '$login' AND groupname = '$Fgroup';"); |
if ($res){ |
if (!@da_sql_num_rows($res,$config)){ |
$res = @da_sql_query($link,$config, |
if (!da_sql_num_rows($res,$config)){ |
$res = da_sql_query($link,$config, |
"INSERT INTO $config[sql_usergroup_table] |
(username,groupname) VALUES ('$login','$Fgroup');"); |
if (!$res || !@da_sql_affected_rows($link,$res,$config)) |
if (!$res || !da_sql_affected_rows($link,$res,$config)) |
echo "<b>Could not add user to group $Fgroup. SQL Error</b><br>\n"; |
} |
else |
74,7 → 74,7 |
echo "<b>Could not add user to group $Fgroup: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
if (!$da_abort){ |
if ($Fgroup != '') |
if (isset($Fgroup) && $Fgroup != '') |
require('../lib/defaults.php'); |
foreach($show_attrs as $key => $attr){ |
if ($attrmap["$key"] == 'none') |
86,15 → 86,15 |
$attr_type["$key"] = 'replyItem'; |
$rev_attrmap["$key"] = $key; |
} |
if ($attr_type["$key"] == 'checkItem'){ |
if (isset($attr_type["$key"]) && $attr_type["$key"] == 'checkItem'){ |
$table = "$config[sql_check_table]"; |
$type = 1; |
} |
else if ($attr_type["$key"] == 'replyItem'){ |
else if (isset($attr_type["$key"]) && $attr_type["$key"] == 'replyItem'){ |
$table = "$config[sql_reply_table]"; |
$type = 2; |
} |
$val = $$attrmap["$key"]; |
$val = (isset($$attrmap["$key"])) ? $$attrmap["$key"] : ''; |
/*Ajout en vue de l'impression des données (thank's to Geoffroy MUSITELLI)*/ |
if($key == "Session-Timeout") $sto_imp = $val; |
if($key == "Max-All-Session") $mas_imp = $val; |
101,11 → 101,11 |
if($key == "Max-Daily-Session") $mds_imp = $val; |
if($key == "Max-Monthly-Session") $mms_imp = $val; |
/*Fin Ajout*/ |
$val = da_sql_escape_string($val); |
$val = da_sql_escape_string($link, $val); |
$op_name = $attrmap["$key"] . '_op'; |
$op_val = $$op_name; |
$op_val = (isset($$op_name)) ? $$op_name : ''; |
if ($op_val != ''){ |
$op_val = da_sql_escape_string($op_val); |
$op_val = da_sql_escape_string($link, $op_val); |
if (check_operator($op_val,$type) == -1){ |
echo "<b>Invalid operator ($op_val) for attribute $key</b><br>\n"; |
continue; |
112,12 → 112,13 |
} |
$op_val2 = ",'$op_val'"; |
} |
if ($val == '' || check_defaults($val,$op_val,$default_vals["$key"])) |
$chkdef = (isset($default_vals["$key"])) ? check_defaults($val,$op_val,$default_vals["$key"]) : 0; |
if ($val == '' || $chkdef) |
continue; |
$res = @da_sql_query($link,$config, |
"INSERT INTO $table (attribute,value,username $text) |
VALUES ('$attrmap[$key]','$val','$login' $op_val2);"); |
if (!$res || !@da_sql_affected_rows($link,$res,$config)) |
$sqlquery = "INSERT INTO $table (attribute,value,username $text) |
VALUES ('$attrmap[$key]','$val','$login' $op_val2);"; |
$res = da_sql_query($link,$config,$sqlquery); |
if (!$res || !da_sql_affected_rows($link,$res,$config)) |
echo "<b>Query failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n"; |
} |
} |