oceandeep
Posts: 17
|
Posted: 07/10/2014, 10:12 PM |
|
Hi.
I'm trying to find a way to show a message in a popup window/dialog when a user, who belongs in a restricted group, tries to enter a restricted page instead of redirecting to an Access Denied Page as CC does, or the login page. The message should explain that current user does not posses permission to see the page. I know this window can be done easily with JavaScript, with 'alert();' so I tried putting a custom code in the Before Initialize event of the restricted page:
global $group;
global $db;
$db=new clsDBCon1();
$us= CCGetUserLogin();
$group=CCDLookup("group_id","users","user_login='$us'",$db);
if ($group != 1000){
echo"<script languaje='JavaScript'>alert('You can't access this page.')</script>";
header("Location:Emp_List.php");
}
$db->close();
However, it doesn't work so well. It doesn't allow for such users to access the page (this is the good part) but it's not showing the small window with the message (the bad part). I took out the 'header' part and the window shows but it also allows the restricted page to be loaded. I've also set Restricted property to 'No' because otherwise CC ignores my code and returns me to the login page.
Any advice would be very much appreciated!
Cheers.
|