Hi all..
I'm having a problem with the passing of data from my wml page >> wmlscript >> asp.
What my codes wants to do is to allow user to enter their login ID and password in the wml (
login.wml). After the user clicks on the submit link, it will go to wmlscript(
verification.wmls) to validate if the password user entered is less then 5 characters. If it's true, then it will go to the asp page (
login.asp) where it will check if the user id and password is valid from my Acceess Database. If it's true, it will re-direct the user to my mainPage (
main.wml) else, it will display an error message.
The problem i have now is I cant seem to be able to pass the UserID and password the user entered from the wmlscript to my asp. Here's my codes:
login.wml
Code:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml12.dtd">
<wml>
<card id = "index" title = "Bookstore WAP Site">
<do type="accept" label="Login">
<go href="http://localhost:8810/WMLAssignment/verification.wmls#VerifyPassword()"/>
</do>
<p align="center">
<big><b>Login Page</b></big>
<br/>
User ID: <input name = "UserID" value = ""/>
<br/>
Password: <input type="password" name = "Password" value = ""/>
</p>
</card>
</wml>
verification.wmls
Code:
extern function VerifyPassword()
{
var inputID = WMLBrowser.getVar("UserID");
var inputPwd = WMLBrowser.getVar("Password");
if((String.length(inputID) == 0) || (String.length(inputPwd) == 0))
Dialogs.alert("Please Enter Your ID and/or password!!!");
else if (String.length(inputPwd) > 5 )
Dialogs.alert("Invalid input! Password should not exceed more than 5 characters.");
else
WMLBrowser.go("http://localhost:8810/WMLAssignment/login.asp?userID=$(inputID)&password=$(inputPwd)");
}
login.asp
Code:
<%
Dim conn, rs
Dim userID, password
userID = Request.QueryString("userID")
password= Request.QueryString("password")
response.Write(userID)
response.Write(password)
Set conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
conn.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("wml.mdb") & ";"
sql = "SELECT * FROM member WHERE name='"& userID &"' AND password='"&password &"'"
Set rs = conn.Execute (sql)
if rs.EOF then
response.Write("You have entered a wrong userID/password. Please re-enter.")
else
response.redirect("main.wml")
end if
rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing
%>