This is only a problem in the MySQL version and you can fix it like this:
On line 146 of useradmin.php add the following line:
$users = getUsers();
Then add the following function to the authentication.php file:
//----------------------------------- getUsers
//-- return an array of user arrays
function getUsers() {
global $TBLPREFIX;
$sql = "SELECT * FROM ".$TBLPREFIX."users";
$res = dbquery($sql);
$users = array();
if ($res) {
while($user_row = mysql_fetch_array($res)) {
$user = array();
$user["username"]=$user_row["u_username"];
$user["fullname"]=$user_row["u_fullname"];
$user["password"]=$user_row["u_password"];
if ($user_row["u_canadmin"]=='Y') $user["canadmin"]=true;
else $user["canadmin"]=false;
if ($user_row["u_canedit"]=='Y') $user["canedit"]=true;
else $user["canedit"]=false;
$users[$user_row["u_username"]] = $user;
}
}
return $users;
}
Sorry about this error.
--John
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2003-06-20
Worked like a charm - thanks for the GREAT support.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am getting
Warning: Invalid argument supplied for foreach() in /home/rf/phpGedView/useradmin.php on line 147
when I access the Admin/User Adminstration page and no users show in the list. I can add a user and the login works properly.
This is only a problem in the MySQL version and you can fix it like this:
On line 146 of useradmin.php add the following line:
$users = getUsers();
Then add the following function to the authentication.php file:
//----------------------------------- getUsers
//-- return an array of user arrays
function getUsers() {
global $TBLPREFIX;
$sql = "SELECT * FROM ".$TBLPREFIX."users";
$res = dbquery($sql);
$users = array();
if ($res) {
while($user_row = mysql_fetch_array($res)) {
$user = array();
$user["username"]=$user_row["u_username"];
$user["fullname"]=$user_row["u_fullname"];
$user["password"]=$user_row["u_password"];
if ($user_row["u_canadmin"]=='Y') $user["canadmin"]=true;
else $user["canadmin"]=false;
if ($user_row["u_canedit"]=='Y') $user["canedit"]=true;
else $user["canedit"]=false;
$users[$user_row["u_username"]] = $user;
}
}
return $users;
}
Sorry about this error.
--John
Worked like a charm - thanks for the GREAT support.