If cvextract.php uses header.php then you'll have:
Client requests cvextract.php
...server includes header.php
......server includes checkcookie.php
.........Verify that Dept==4
.........Redirect the client to cvextract.php
.........Client requests cvextract.php
............repeat [i]ad nauseum[/i]
The livehttpheaders extension for Firefox could be used here; see exactly which responses the server is sending back; I'm pretty sure it will log the start of any potentially infinite redirect loop.
I've just realised something else even more critical:
if($hrintranetCollection['Dept']=="4"){
header("Location:cvextract.php");
}else{
header("Location:login.php");
}
So if the Dept is 4, the client is redirected to cvextract.php
And if the Dept is not 4, the client is redirected to login.php
Either way, the client is redirected to another page. This probably isn't desired behaviour 🙂.
Incidentally, for reasons including security, header("Location:") calls should typically be followed by exit(); to stop further processing - no good can come of generating output and sending it to the client if the client isn't supposed to see it. Doing that with the above code highlights the problem....