How to retrieve username pasword from database?

Questions about SQLite database.

How to retrieve username pasword from database?

Postby Ilian » Thu May 04, 2017 11:29 am

I have made a database with username and pasword but It seems not to work since in the database I put 3 users in and the page doesnt even connect to it
nore checks it
. I just want that the login and pasword comes from the database and is valid.. Users are already defined with a list and has to match them.
Does anyone know where it is wrong?

!DOCTYPE html>
<title>Log In</title>
<script src=""></script>
<script src="logiin.js"></script>
<link href="style/Logiin.css" rel="stylesheet" />
<link rel="icon" href="Images/icon.png">
<meta charset="utf-8" />
<script src="logiin.js"></script>
<form name ="myform" action="/Default1.aspx">
<div class="imgcontainer">

<img src="Images/logo.png" alt="Avatar" class="avatar" />

<div class="container">
<input type="text" id ="txtuserName" placeholder="Geef gebruikersnaam" name="uname" required>

<input type="password" id="txtPassword" placeholder="Geef wachtwoord" name="psw" required>

<button type="submit" value="button name" onclick="Validate">Login</button>

<input type="checkbox" checked="checked"> Onthou mij

<div class="container" style="background-color:#f1f1f1">



var connection = mysql.createConnection({
host: 'localhost:49974',
user: 'gebruikersnaam',
password: 'null',
database: 'user.http://localhost:49974/App_Data/user.db'

var count = 2;
function validate() {
var uname = document.myform.uname.value;
var psw = document.myform.psw.value;
var valid = false;
var unameArray = ["username1", "username2", "username3", "username4"];
var pswArray = ["password1", "password2", "password3", "password4"];
for (var i = 0; i < unameArray.length; i++) {
if ((uname == unameArray[i]) && (psw == pswArray[i])) {
valid = true;
if (valid) {
alert ("Login was sucessvol");
window.location = "" ;
return false;
var t = " tries";
if (count == 1) {t = " try"}
if (count >= 1) {
alert ("Onjuist gebruikersnaam en/of paswoord. U heeft " + count + t + " over.");
document.myform.uname.value = "";
document.myform.psw.value = "";
setTimeout("document.myform.uname.focus()", 25);
setTimeout("", 25);
count --;
sendRequest(uname, psw);
else {
alert ("Steeds incorrect! U heeft geen pogingen meer over!");
document.myform.uname.value = "Geen pogingen meer mogelijk!";
document.myform.psw.value = "";
document.myform.psw.disabled = true;
document.myform.psw.disabled = true;
return false;

function sendRequest(uname, psw){
var crd = {
pass: psw
var json = JSON.stringify(crd);

type: "POST",
url: "../Ajax/LogIn.ashx",
data: json,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(response){
error: function(error){
Posts: 1
Joined: Thu May 04, 2017 11:24 am

Re: How to retrieve username pasword from database?

Postby Googie » Thu May 04, 2017 1:36 pm

You are asking about MySQL. This subforum is about SQLite. You should ask this at either MySQL forums, or JavaScript forums, or StackOverflow.
Site Admin
Posts: 790
Joined: Wed Jul 27, 2011 8:04 pm

Return to SQLite database

Who is online

Users browsing this forum: No registered users and 1 guest