So here is my solution. Create a new user variable called _REMOTE_HOST. When someone is viewing a page from the book, check to see if they are logged in. If they are, check the remote host and save it. On the next page load from that user, compare the remote host to the saved host. If they are different, then log them out. Here is the code.
Code
if(pnUserLoggedIn()){
$remote_host = pnServerGetVar('REMOTE_ADDR');
$current_host = pnUserGetVar("_REMOTE_HOST");
if ($current_host == ""){
pnUserSetVar('_REMOTE_HOST', $remote_host);
} else {
if($current_host != $remote_host){
pnUserLogOut();
}
}
}
$remote_host = pnServerGetVar('REMOTE_ADDR');
$current_host = pnUserGetVar("_REMOTE_HOST");
if ($current_host == ""){
pnUserSetVar('_REMOTE_HOST', $remote_host);
} else {
if($current_host != $remote_host){
pnUserLogOut();
}
}
}
This solution makes me a bit uneasy because it is so simple, but it seems to work. One annoyance, If a legitimate user enters from another computer, on the first page load, they are logged out and will have to log in again. I can fix this by wiping out the remote host upon log in, but it seems to do this I will have to make changes to pnUser.php. Is there a better solution? Can people see potential problems with this approach?
BTW, I do know how to spell solution, really.
edited by: Paustian, Dec 31, 2006 - 04:20 PM
