get_db_value($sql); if (!isset($user_id)) return 0; $_SESSION['user_id'] = $user_id; if ($this->exec_sql("UPDATE dsg_user SET logins = logins + 1 WHERE user_id = ".$user_id)) return 1; return 0; } function logout(){ session_unset(); } /** * Loob uue kasutaja ja Väljastab selle id. * @return integer $user_id * @access public */ function create_new($username, $password = '', $fullname, $email, $userlevel = 3) { $sql = "INSERT INTO dsg_user (username, pass, fullname, email, userlevel, created) VALUES '$username', '".md5($password)."', '$fullname', '$email', '$userlevel', '".date('Y-m-d H:i:s')."' "; $result = $this->exec_sql($sql); $sql = "SELECT user_id FROM dsg_user WHERE username = '$username' "; $user_id = $this->get_db_value($sql); return $user_id; } /** * Koristab andmebaasist kõik konkreetse kasutajaga seonduva? * @return boolean $result * @access public */ function remove() { //not implemented jet } } ?>