I have a simple login screen where I want the user upon entering the correct userid/password , for his userid to be inserted into a table in a database so to keep track who visited his web page.

My ISP is supposedly has created a DS named "win5_zjconstructioninc_com"

but the code below is failing to insert a record to the database.
Can you experienced programmers be kind to take a look at the code below and suggest a course of action and that if I should take the issue up with my ISP.

Thanks in advance

J.


<%@ Language=VBScript %>
<%
Dim DB_CONNECTIONSTRING
DB_CONNECTIONSTRING = "Provider=SQLOLEDB;Data Source=sql.fastbighost.com;" _
& "Initial Catalog=win5_zjconstructioninc_com;UserId=win5_zjconstructioninc_com;Password=JFjwori8;" _
& "Connect Timeout=15;Network Library=dbmssocn;"
%>
<%
If request.form("login")="kal" and request.form("password")="walthers" then

session("userlogin") = "OK"
session("pass") = "OK"
Dim I
Dim iRecordToUpdate ' Id of deleted record
Dim strSQL ' String variable for building our query
Dim objRecordset
Set objRecordset = Server.CreateObject("ADODB.Recordset")
iRecordToUpdate = Request.QueryString("id")
iRecordToUpdate = Replace(iRecordToUpdate, "'", "''")

If IsNumeric(iRecordToUpdate) Then
iRecordToUpdate = CLng(iRecordToUpdate)
Else
iRecordToUpdate = 0
End If

strSQL = "SELECT * FROM userlogin WHERE id=" & iRecordToUpdate & ";"
objRecordset.Open strSQL, DB_CONNECTIONSTRING, adOpenKeyset, adLockPessimistic, adCmdText
If Not objRecordset.EOF Then
objRecordset.MoveFirst
objRecordset.Fields("text_field") = request.form("login")
objRecordset.Fields("integer_field") = CInt(Day(Now()))
objRecordset.Fields("date_time_field") = Now()
objRecordset.Update

End If
objRecordset.Close
Set objRecordset = Nothing
response.redirect "default2.asp"
End If
%>
<html>
<head>
<title>Mr. & Mrs. Kal Walther's Login Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../style.css" type="text/css">
</head>
<body text="#000000" bgcolor="#CED3D7" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="763" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" align="center">
<tr>
<td>
<table border="0" width="763" cellspacing="0" cellpadding="0" height="65" bgcolor="#E1E7EB">
</table>
</td>
</tr>
<tr>
<td align="center"><b><span class="headersmblue">California Dream <br><br>

&nbsp;Secure Login Area</span></b></td>
</tr>
<tr>
<td><br><br>

<table border="0" cellspacing="0" cellpadding="0" align="center" width="302">
<tr>
<td class="plaintext" width="302">
<form action="login.asp" method="post">
<table width="90%" border="0" cellspacing="3" cellpadding="0">
<tr>
<td colspan=2>&nbsp;</td>
</tr>
<tr>
<td class="plaintext">Login</td>
<td>
<input type="text" name="login">
</td>
</tr>
<tr>
<td class="plaintext">Password</td>
<td>
<input type="password" name="password">
</td>
</tr>
<tr>
<td colspan=2 align="center">
<input type="submit" name="Submit" value="Submit">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>

</td>
</tr>
</table>
</body>
</html>

First, u didnt add in a form. you cant submit without a form.

Second, after u add in form, u need to add action="URL?login=kal&password=walthers"
If request.form("login")="kal" and
request.form("password")="walthers" then

i didnt check ur asp code, u try ist...
but i notice something wrong in ur asp code.
anywhere u try to add in form ist


This article has been dead for over six months. Start a new discussion instead.