Wrox Programmer Forums
|
Classic ASP XML Using ASP 3 and XML. See also the XML category for more XML discussions not relating to ASP. NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 12th, 2003, 09:33 PM
Authorized User
 
Join Date: Nov 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default help xml login

Author: craig
Date: 11/12/2003 8:28:28 PM
Subject: need help searching for two values
Message: i am tryin 2 create a login page where the user enters a username and a password and an asp script checks these values and allows them 2 login. I have successfully created the script where it checks the username value, but i have not got a clue in order 2 amend the script to check for the password value
my xml tree is
<records>
       <details>
               <username></username>
               <password></password>
      <details>
</records>
the asp script so far is
<%@ Language="VBScript" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?xml version="1.0" encoding="iso-8859-1"?>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
</head>

<body>
<%
Dim xmlDocument, path, nodes
set xmlDocument = CreateObject("MSXML2.FreeThreadedDOMDocument")
xmlDocument.async = "false"
xmlDocument.load(Server.MapPath("/speirsy/db/user.xml"))
xmlDocument.setProperty "SelectionLanguage", "XPath"

path = "/records/details[username='" & Request.Form("userQuery") & "']"
set nodes = xmlDocument.selectNodes(path)

If nodes.length = 0 Then
   Response.write("No Match")
End If

For Each Node In nodes
   For Each Node1 In Node.childNodes
    If Node1.nodeName = "username" Then
        If Node1.text = Request.Form("userQuery") Then
Response.Write(" Welcome " & Request.Form("userQuery"))
        End If
      End If
   Next
Next
%>




any help would be much appreciated


thanks



 
Old November 13th, 2003, 12:20 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Modify your XPath query to include criteria for the password:

path = "/records/details[username='" & Request.Form("userQuery") & "' and password='" & Request.Form("passwordQuery") & "' ]"

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old November 13th, 2003, 06:04 AM
Authorized User
 
Join Date: Nov 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for the reply, but how would i check the nodes for username and password?
ma code so far is
For Each Node In nodes
   For Each Node1 In Node.childNodes
    If Node1.nodeName = "username" Then
         If Node1.text = Request.Form("userQuery") Then
Response.Write(" Welcome " & Request.Form("userQuery"))
         End If
      End If
   Next
Next






Similar Threads
Thread Thread Starter Forum Replies Last Post
how to authenticate (login) from xml file rapraj XML 4 January 8th, 2008 06:55 AM
Newbie Help. Login to unique login page per user Kainan Classic ASP Professional 10 May 3rd, 2005 07:47 AM
login failed for user nt authority\anonymous login rj1406 Classic ASP Databases 1 October 24th, 2004 09:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.