Joomla 2.5从外部脚本获取用户

时间:2014-03-15 15:28:50

标签: joomla joomla2.5

我需要从joomla 2.5 db获取一些数据。我制作的脚本似乎使用旧帐户,但我重置密码它不再工作。 我需要改变检查用户名和密码的方法吗? 我正在使用的脚本是:

//Check username and password
$rCUSRNAM = mysql_real_escape_string($username);
$rCPASSWO = mysql_real_escape_string($password);

//Query db to inspect user
$query_jom = "SELECT * FROM jh23m_users WHERE username ='".$rCUSRNAM."'";
$result_jom = mysql_query($query_jom);
$row_jom = mysql_fetch_assoc($result_jom);

//Check password - joomla based
$part = explode(":", $row_jom['password']);
$salt = $part[1];
$encrypted_password = md5($rCPASSWO.$salt).":".$salt;

//Check authentication
if(!($encrypted_password == $row_jom['password'])){
echo "Invalid login details";
exit;
}

//Check user lock - joomla based
if($row_jom['block'] <> 0){
echo "Account locked, contact support";
exit;
}
$user_id = $row_jom['id'];
$username = $row_jom['username'];
$email = $row_jom['email'];

0 个答案:

没有答案