QUOTE(Michael P @ Aug 26 2006, 06:06 PM)

It's rough round the edges, but should do what you want. I have been working on a newer version - but client work has to prioritise.
http://forums.invisionpower.com/index.php?...=175366&hl=I read some of your code and it looks like you are using a manual system of some kind to authenticate.
For my Admin IP Filter mod I used IPB's in-built Converge system, which is better as you can keep your fingers clean of hashes and such nasties. In my example the variable $username must hold the username entered from the form, and the variable $password must hold the plaintext password (as entered).
CODE
// Fire up Converge
require '/path/to/init.php';
require KERNEL_PATH.'class_converge.php';
require ROOT_PATH.'sources/ipsclass.php';
$ipsclass = new ipsclass();
$ipsclass->vars = $INFO;
$ipsclass->init_db_connection();
$ipsclass->converge = new class_converge($ipsclass->DB);
// Look up member
$ipsclass->DB->query ("SELECT m.*, g.* FROM ibf_members m, ibf_groups g WHERE LOWER(name) = '".strtolower($username)."' AND m.mgroup = g.g_id");
$member = $ipsclass->DB->fetch_row();
// Check they actually exist
if (!$ipsclass->DB->get_num_rows()) echo 'doesn't exist';
// Load the member into Converge
$ipsclass->converge->converge_load_member ($member['email']);
That loads the member. Then:
CODE
$ipsclass->converge->converge_authenticate_member(md5($password))
can be used to authenticate them (returns true on success, false on failure).
If they get authenticated you just set their cookies up:
CODE
setcookie ('member_id', $member['id'], time() + 10800, $path);
setcookie ('pass_hash', $member['member_login_key'], time() + 10800, $path);
and next time they come around you just look in the DB and see if the cookies match:
CODE
$mid = intval($_COOKIE['member_id']);
// Look up member
$result = mysql_query("SELECT id, members_display_name, member_login_key FROM ibf_members WHERE id = $mid");
$member = mysql_fetch_array($result);
// Authenticate
if (($member['id'] == $mid) and ($member['member_login_key'] == $_COOKIE['pass_hash']))
{
echo 'you are logged in';
}
Hope that helped...vaguely..