Example #1
0
function load_alluser()
{
    global $userauth_config_file;
    global $xml_database_comname;
    if (!file_exists($userauth_config_file)) {
        return false;
    }
    $filename = encode_utf8($userauth_config_file);
    $xml = new COM($xml_database_comname, NULL, CP_UTF8) or die("create com instance error");
    $xml->ReadDB($filename);
    $xml->ResetPos();
    $xml->FindElem("database");
    $xml->IntoElem();
    if ($xml->FindElem("user")) {
        $xml->IntoElem();
        while ($xml->FindElem("item")) {
            unset($userinfo);
            $xml->ResetChildPos();
            while ($xml->FindChildElem("")) {
                $strTagName = strtolower($xml->GetChildTagName());
                $strTagValue = $xml->GetChildData();
                $userinfo[$strTagName] = $strTagValue;
                if ($strTagName == 'accoutstatus') {
                    $userinfo['accountstatus'] = $strTagValue;
                }
            }
            $userList[] = $userinfo;
        }
    }
    return $userList;
}
Example #2
0
function listLastVisit()
{
    global $xml_database_comname;
    global $userfolder;
    global $lastvisit_config_file;
    $lastvisitfile = $userfolder . $lastvisit_config_file;
    $lastvisitfile = encode_utf8($lastvisitfile);
    $xml = new COM($xml_database_comname, NULL, CP_UTF8) or die("create com instance error");
    $xml->ReadDB($lastvisitfile);
    $xml->ResetPos();
    if (!$xml->FindElem("database")) {
        return false;
    }
    $xml->IntoElem();
    if (!$xml->FindElem("lastvisit")) {
        return false;
    }
    $lastvisit = array();
    while ($xml->FindElem("item")) {
        $info = array();
        $xml->ResetChildPos();
        while ($xml->FindChildElem("")) {
            $name = $xml->GetChildTagName();
            $value = $xml->GetChildData();
            $info[strtolower($name)] = $value;
        }
        $lastvisit[] = $info;
    }
    return true;
}