Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Log in user

4 views
Skip to first unread message

Morten Meiling Olsen

unread,
Dec 7, 2001, 11:20:49 AM12/7/01
to
Why does this not work ?
the if (bruger("Password") == pass) never gets executed!


<%@language=JavaScript%>
<%
connection = Server.CreateObject("ADODB.Connection");
connection.open("Driver={Microsoft Access Driver (*.mdb)};" +
"DBQ=C:\\inetpub\\wwwroot\\tabu-tv\\tabu-tv.mdb");
%>
<%
var bnavn = Request.Form("Bnavn");
var pass = Request("password")
bruger = Server.CreateObject("ADODB.Connection")
bruger = connection.execute("SELECT * FROM Kunder WHERE
Kunder.Brugernavn='"+bnavn +"'");

if (!bruger.EOF) {

if (bruger("Password") == pass)
-------------------------------------------even though it should do this
it don't!
Response.Write("Tak, der")
}
}
Response.Write(pass)
%>


<html>
<head>
<title>Log ind</title>
</head>
</body>
</html>


Andrew Urquhart

unread,
Dec 7, 2001, 11:44:54 AM12/7/01
to
"Morten Meiling Olsen" wrote in message
news:9uqq5c$2eos$1...@news.cybercity.dk...

> Why does this not work ?
> the if (bruger("Password") == pass) never gets executed!

Comments below:

<%@ LANGUAGE="JScript" %>


<html>
<head>
<title>Log ind</title>
</head>

<body>
<%

var connection; // because you need scope outside of try block
var bnavn = Request.Form("Bnavn").Count ? Request.Form("Bnavn").Item(1) :
"";
var pass = Request.Form("password").Count ? Request.Form("password").Item(1)
: "";
var brugerSQL = "SELECT Password FROM Kunder WHERE Kunder.Brugernavn='" +
bnavn + "';";

// should do check on bnavn and pass and act on null strings. Not
implemented.

try {


connection = Server.CreateObject("ADODB.Connection");

connection.Open(Application("CONNECTION_STRING"));
bruger = connection.Execute(brugerSQL);

if (!bruger.EOF) {
// This assumes that the database is set up with
// "Kunder.Brugernavn" as the primary key:
if (pass == String(bruger("Password"))) Response.Write("Tak, der");
else Response.Write("Incorrect bnavn or password");
}
else Response.Write("User not registered, please register.");
}
catch (e) {
Response.Write("Error: " + e.number + ", " + e.description);
}
finally {
connection.Close();
}
%>
</body>
</html>


You should do a check on the result of the form querying and if the results
are one or more null strings then tell the user to input all details and
don't bother executing the performance costly database processing. Also, in
the above example I've implied that your connection string is in Application
collection object. This is because it means you can control your critical
application variables from one place - your global.asa which is nice when
you change database/server.

For future reference:
news:microsoft.public.inetsdk.programming.scripting.jscript,
news:microsoft.public.scripting.jscript
--
Andrew Urquhart
____________________
http://andrewu.co.uk
. o O (Currently seeking UK employment, see cvHTML.asp)


V

unread,
Jul 14, 2023, 9:07:58 PM7/14/23
to
anglezzzzzzz.likesyou.org/a.php⠀⠀⠀⠀⠀⠀⠀ ⠀⠀
christyansworld.atwebpages.com/a.php⠀⠀⠀⠀⠀⠀⠀
youthmeetupplace.talk4fun.net/a.php⠀⠀⠀⠀⠀⠀⠀⠀
kohtumispaik3.66ghz.com/a.php⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

Heia...........Heida pilk peale nendele............


Postita ka midagi sinna.

Siis pärast hea mul lugeda, et mu lehtedel on mõni külastaja ka !
0 new messages