please check my asp code

please check my asp code

am 17.12.2006 09:08:57 von iskofajardo

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:


sample search


<%
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")
%>


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 %>



Re: please check my asp code

am 17.12.2006 10:43:09 von exjxw.hannivoort

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
> 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

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,
> 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...
>
[..]
>
> <%
> 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")
> %>
>


> 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
> loop
> rs.Close
> set rs=Nothing %>
>

>
>
>

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
%>


Username

.....
==============================

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

Re: please check my asp code

am 17.12.2006 11:27:55 von iskofajardo

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...

Evertjan. wrote:
> 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
> > 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
>
> 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,
> > 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...
> >
> [..]
> >
> > <%
> > 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")
> > %>
> >
> > 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
> > loop
> > rs.Close
> > set rs=Nothing %>
> >
> >
> >
> >
>
> 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
> %>
>
>


> Username
>
> ....
> ==============================
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)

Re: please check my asp code

am 17.12.2006 11:38:27 von exjxw.hannivoort

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.

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

Re: please check my asp code

am 19.12.2006 11:19:31 von iskofajardo

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...

Evertjan. wrote:
> 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.
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)

"the delete-update method in ADO" was Re: please check my asp code

am 19.12.2006 11:29:05 von exjxw.hannivoort

wrote on 19 dec 2006 in microsoft.public.inetserver.asp.db:
> Evertjan. wrote:
>> 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.

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.

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