hello... can somebody tell what is the error of my codings? coz i want
to create a search control... this is suppose to be the flow, at first
run i declare a ServerVariable which is ("Remote_Addr") to detect the
ipaddress... i also have a textfield in my form which must show the
"CompName"
then i have a 2tables inside my database.. (1)ipAdd and (2)CompName.. i
already input the datas needed. my condition is like this, if
ServerVariable("Remote_Addr") = ipAdd then,
i want to show the field of CompName inside the textfield as its
corresponding value...
what can i do? please check and correct me coz i always experience
error...
my codings is like this:
<html><title>sample search</title>
<body>
<%
dim ip
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("users.mdb"))
set rs=Server.CreateObject("ADODB.recordset")
sql="SELECT DISTINCT ipAdd FROM com"
rs.Open sql,conn
username=request.form("username")
ip=request.ServerVariables("REMOTE_ADDR")
%>
<form method="post">
Username <input type="text" name="username"
value="<%=rs.Fields("CompName")%>">
<% do until rs.EOF
if rs.fields("ipAdd")=ip then
username=response.Write(rs.fields("CompName"))
end if
rs.MoveNext
loop
rs.Close
set rs=Nothing %>
</form>
</body>
</html>
wrote on 17 dec 2006 in microsoft.public.inetserver.asp.db:
> hello... can somebody tell what is the error of my codings? coz i want
> to create a search control... this is suppose to be the flow, at first
[quoted text clipped - 3 lines]
>
> then i have a 2tables inside my database.. (1)ipAdd and (2)CompName.. i
I think you have one table "con" with two fields "ipAdd" and "CompName"
> already input the datas needed. my condition is like this, if
> ServerVariable("Remote_Addr") = ipAdd then,
[quoted text clipped - 3 lines]
> what can i do? please check and correct me coz i always experience
> error...
[..]
> <%
> dim ip
[quoted text clipped - 13 lines]
> Username <input type="text" name="username"
> value="<%=rs.Fields("CompName")%>">
Is just a random record's field, from any IP stored, ok?
Because only now you go looking for the right one,
and incorrectly coded:
> <% do until rs.EOF
>
> if rs.fields("ipAdd")=ip then
> username=response.Write(rs.fields("CompName"))
response.Write() does not return a value
> end if
> rs.MoveNext
[quoted text clipped - 5 lines]
> </body>
> </html>
I think it is a strange way of doing things.
You do not need a record set for this.
[in fact record sets are seldom realy "needed"]
Why not have the jet engine look for the right IP?
Expecting one username per ip is a wrong, if you do this on internet,
where some ip's are shared among thousands, and users change IP's or even
locations frequently.
However if you are on an intranet, and users do not work on eachothers
line, why not [not tested]:
============================
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
Server.MapPath("users.mdb") & ";"
sql="SELECT ipAdd,CompName FROM com WHERE ipAdd = " &
request.ServerVariables("REMOTE_ADDR")
set mD = conn.Execute(sql)
if not mD.EOF then
username = mD("CompName")
''' Just takes the first one with the right IP,
''' that comes up, if not unique.
else
username = ""
end if
%>
<form method="post">
Username
<input name="username" value="<% = username %>">
....
==============================

Signature
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
iskofajardo@yahoo.com - 17 Dec 2006 10:27 GMT
who can help me? i need to get the computer name of the user.. please?
can anybody know how can make it possible? give me some pointers and
codes as well... i want the idea...
> wrote on 17 dec 2006 in microsoft.public.inetserver.asp.db:
>
[quoted text clipped - 99 lines]
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
Evertjan. - 17 Dec 2006 10:38 GMT
wrote on 17 dec 2006 in microsoft.public.inetserver.asp.db:
> who can help me? i need to get the computer name of the user.. please?
> can anybody know how can make it possible? give me some pointers and
> codes as well... i want the idea...
1 [Please do not toppost on usenet]
2 This is a new question, should have a new thread and new subject
3 What about my advice, did you try it?
4 Users do not have computer names on an internet web browser,
however you could politely ask the user for it, and that is not an ASP
serverside code matter. Automatic identification of the user under normal
internet web security is not possible. Try perhaps password and cookies.

Signature
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
iskofajardo@yahoo.com - 19 Dec 2006 10:19 GMT
yes i try your advice and it really work... thank you soo much... now
my login project almost done, just a "Change Password" left... i try
the delete-update method in ADO... the delete was working, but the add
and updates get me confuse... coz it add a record which is outside the
row of my table... i mean the new password saved to the next line of my
table.... i hope you can help me again...
again thank you very much... it really works...
> wrote on 17 dec 2006 in microsoft.public.inetserver.asp.db:
>
[quoted text clipped - 17 lines]
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
Evertjan. - 19 Dec 2006 10:29 GMT
wrote on 19 dec 2006 in microsoft.public.inetserver.asp.db:
>> wrote on 17 dec 2006 in microsoft.public.inetserver.asp.db:
>>
[quoted text clipped - 13 lines]
>> under normal internet web security is not possible. Try perhaps
>> password and cookies.
AGAIN: [Please do not toppost on usenet, this is not email]
> yes i try your advice and it really work... thank you soo much... now
> my login project almost done, just a "Change Password" left... i try
> the delete-update method in ADO... the delete was working, but the add
> and updates get me confuse... coz it add a record which is outside the
> row of my table... i mean the new password saved to the next line of
> my table.... i hope you can help me again...
Sorry, I cannot follow you here, perhaps show some code.
[And please use the shift key where appropriate, this is not SMS]
And please start a new thread when you have a new question,
and give it a subject line that indicates the question.

Signature
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)