<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2002 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | hide@address.com so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Byrne Reese <byrne at majordojo dot com |
// +----------------------------------------------------------------------+
//
// $Id: processlogin.php,v 1.2 2003/06/06 05:32:11 byrnereese Exp $
require_once("users.inc");
connect_to_users_db();
$sql = sprintf("
SELECT userId,status,seclev
FROM $USERS_DB.Users
WHERE email='%s'
AND password='%s'",
$_POST['email'],
$_POST['password']);
$query = mysql_query($sql) or die("Error in query ($sql) - " . mysql_error());
if ($query && (mysql_num_rows($query) > 0)) {
list($uid,$status,$seclev) = mysql_fetch_row($query);
if ($status == "unconfirmed") {
Header("Location: reconfirm.php?email=".$_POST['email']);
exit;
}
$user = new User;
$user->id = $uid;
$user->email = $email;
$user->seclev = $seclev;
$user->set_user_cookie();
$returnto = $_REQUEST['returnto'];
if (!isset($returnto) || $returnto == "") { $returnto = "/"; }
Header("Location: $returnto");
exit;
} else {
?>
<p>
The email and password you entered did not match anything we have on record. Try again.
<!--<pre><tt>$sql</tt></pre>-->
</p>
<?php
}
return;
?>