-
- 24,544 Posts
The code example for select() from the DbAPI doesn’t come close to working in Evo.
http://wiki.modxcms.com/index.php/API:DBAPI:select
The table prefix is duplicated, there’s a dot in the table name, and $id appears to be set by magic.
I tried to fix it but ran out of steam before I got anything that worked.
The same example is on modxcms.com.
function login($username, $password)
{
global $modx;
$username = $modx->db->escape($username); // this should have been done with the POST
$password = $modx->db->escape($password); // values before passing them to the function
$res = $modx->db->select("id", $modx->getFullTableName('web_users'),
"username='" . $username ."' AND password='".md5($password)."'");
if($modx->db->getRecordCount($res))
{
$id = $modx->db->getValue($res);
$_SESSION['userid'] = $id;
//other log in things...
}
else
{
//incorrect login
}
}
-
- 24,544 Posts
Thanks Susan. I replaced the example with your code in both places.