function isValidUser($type = "normal")
{
    include_once "user_backend.php";
    $bUser = new user_backend("login");
    if ($bUser->checkSession()) {
        return 1;
    }
    if ($bUser->checkLogin($_POST["username"], $_POST["password"], $type)) {
        return 2;
    }
    return false;
}
 function __construct($lang = "")
 {
     if (!session_id()) {
         session_start();
     }
     if (!$this->db) {
         $this->db = new database_backend();
         $this->db->connect();
         if (user_backend::checkSession()) {
             $language = user_backend::getUserSetting("layoutlanguage");
         }
         if ($language == "") {
             $language = "en";
         }
         $this->bLang = new lang_backend($language);
         $this->bUrl = new urls_backend();
     }
 }
 function createNewTask($pid, $title, $description)
 {
     $newid = 0;
     $now = time();
     $sorting = $this->getNextSorting($pid);
     $sql = "INSERT INTO " . config::dbprefix . "tasks SET pid='" . addslashes($pid) . "', crdate='{$now}', tstamp='{$now}', sorting='{$sorting}', title='" . addslashes($title) . "', description='" . addslashes($description) . "'";
     mysql_query($sql);
     $sql = "SELECT id FROM " . config::dbprefix . "tasks WHERE pid='" . addslashes($pid) . "' AND crdate='{$now}' AND sorting='{$sorting}' AND title='" . addslashes($title) . "'";
     $query = mysql_query($sql);
     while ($result = mysql_fetch_array($query)) {
         $newid = $result["id"];
     }
     include_once "user_backend.php";
     $userid = user_backend::checkSession();
     $sql = "INSERT INTO " . config::dbprefix . "userstasks SET userid='{$userid}', taskid='{$newid}'";
     mysql_query($sql);
     return $newid;
 }