comparing stored ip address

a8le

Well-known member
Joined
Oct 27, 2005
Messages
75
Programming Experience
5-10
hi all, what is the best way to compare stored ip addresses with the current "request.userhostaddress" ipaddress.

i am trying to ensure that users don't do something more than once... prevent abuse.

WHAT I HAVE TRIED SO FAR....

my SQL logic...

1)pass in 2 params, 1-myContentID & 2-currentUserIP

2)Count * FROM myTable Where dbContentID = myContentID AND dbcurrentUserIP = currentUserIP

my Scripting logic...

1)pass out the 2 params and get returned count

2)if myCount > 0 then do WHATEVER else do OTHER

----------------------------------------------------------------------

i think my problem is the comparisions of IP Addresses, because it is stored as a string instead of an integer, so i can't do...

dbcurrentUserIP = currentUserIP

instead i have to do something like....

dbcurrentUserIP LIKE '%' + currentUserIP + '%'

-----------------------------------------------------------------------

still nothing works,
i would appreciate any advice,
thank you in advance,
- a8le
 
shoomy

hi shoomy,

i actually got everything to work... i can't get the code right now to display it here, but thnx. by the way, each column has data. so if i used "contains" wouldn't this always give me a count of 1 or more?

-a8le
 
in the syntax i used it it is acting as if you were using the "Like" statement.

your saying where field2 is contained anywhere in field one.
 
wow, that is advanced... by the way... i am using a like statement on my site (keyword search) and the results are horrible, but works... can i use that to search for one word out of a string or is it just for "1 to 1" matching?

-a8le
 
Back
Top