That works perfectly, exactly what I wanted.
Thank you to both of you for taking the time to help me - it's really appreciated.
The third solution was throwing an error, an unexpected "{" which gave a server 500 error.
but I couldn't see an unmatched bracket so I used a mix of the solutions...
<?php
if (!defined("WHMCS"))
die("This file cannot be accessed directly");
function hook_ForceEveryoneToLogin($vars) {
$clientID = intval($_SESSION['uid']);
$adminID = intval($_SESSION['adminid']);
if ($adminID===0){
if ($vars['filename']!="login" && $vars['filename']!="dologin" && $vars['filename']!="clientarea" && $clientID===0){
header("Location: login.php");
exit;
}
}
}
add_hook("ClientAreaPage", 1, "hook_ForceEveryoneToLogin");
...I didn't include the password reset clause as I've removed that button from the login screen anyway.
thanks again guys.
-Mark