your access rule uses the $_SESSION['groupid'] variable, so the first thing I would want to know for troubleshooting, is what is the value being stored in the groupid variable on login.
to find this out, add the following code to the login page after the login form:
<pre><?php if(!session_id()) session_start(); ?><?php var_dump($_SESSION); ?></pre>
post back the results of this code after trying to login, this will help us begin to troubleshoot the problem.