Ok it depends on the program but I give you an idea
Say that you have a Table in a data base Table(user,password,mail,date,cathegory)
In your program create two variables
var UserId and PassWord as strings
With your program invoke this sql statement
SQL = "Select * From Table Where user = " + UserId + "password = " + PassWord
execute it
if it returns not nul rows numbers then the user is accepted else the user is rejected