Example #1
0
function cm_check_login($username, $password)
{
    global $cmdb;
    $userdata = get_userdatabyusername($username);
    if ($userdata->password == md5($password) && !empty($password)) {
        return $userdata->ID;
    }
    return false;
}
 function CM_User($id, $name = '')
 {
     if (empty($id) && empty($name)) {
         return;
     }
     if (!is_numeric($id)) {
         $name = $id;
         $id = 0;
     }
     if (!empty($id)) {
         $this->data = get_userdata($id);
     } else {
         $this->data = get_userdatabyusername($name);
     }
     if (empty($this->data->ID)) {
         return;
     }
     foreach (get_object_vars($this->data) as $key => $value) {
         $this->{$key} = $value;
     }
     $this->id = $this->ID;
     $this->init();
 }