Creating a custom login system by developing a new module
You don't need any other modules, to just show a form. Your code is not correct in some points, though, and that needs to be corrected.

A form validation handler doesn't return TRUE nor FALSE; it just calls form_set_error() in case the submitted data doesn't pass the validation.

A form submission handler doesn't validate the submitted data; that is the task of the form validation handlers. The purpose of the form submission handlers is to take the necessary actions (e.g. loading data from the database, saving data to the database), but they don't return anything.

You don't inject values entered from user directly in the query, as you do with db_query(). That is the perfect way of given a malicious user access to the user #1 access, for example, and without the user knowing the user #1 account.
Always use placeholders for input obtained from users, when you are using it in a query. See what user_login_authenticate_validate() does.

$account = db_query("SELECT * FROM {users} WHERE name = :name AND status = 1", array(':name' =&gt; $form_state['values']['name']))-&gt;fetchObject();


The correct way to show a message to the user is using drupal_set_message(). In the specific case, showing a message with a logout link is not much helpful, since the users will not see it anymore after moving to a different page. In any case, you don't use echo() to print anything on a Drupal page from a form submission (or validation) handler.