A few days ago, I asked the question of how to restrict certain 'private' fields for viewing by only the log-in user and the administrator. JPDeni suggested the following:
if ($per_admin or ($rec{'Userid'} eq $db_userid )) { print qq|
[display private fields]
|;
}
I tried the above with my html_record but was not successful (my userid field is 'Userid' as set in the %db_def array). The error that I get is the following:
Error Message : fatal error: Can't locate object method "rec" via package "Userid" at ./html.pl line 270.
I decided to downsize the if(..) statement to just the following:
if ($per_admin) { print qq|
[display private fields]
|;
It works!! However, this statement only allows the administrator to view it.
As such, there seems to be a problem with the '..or ($rec{'Userid'} eq $db_userid )..' statement.
Can anyone help?
Thanks in advance!
David Tan
if ($per_admin or ($rec{'Userid'} eq $db_userid )) { print qq|
[display private fields]
|;
}
I tried the above with my html_record but was not successful (my userid field is 'Userid' as set in the %db_def array). The error that I get is the following:
Error Message : fatal error: Can't locate object method "rec" via package "Userid" at ./html.pl line 270.
I decided to downsize the if(..) statement to just the following:
if ($per_admin) { print qq|
[display private fields]
|;
It works!! However, this statement only allows the administrator to view it.
As such, there seems to be a problem with the '..or ($rec{'Userid'} eq $db_userid )..' statement.
Can anyone help?
Thanks in advance!
David Tan