• Using IP Address as Query Filter (2002)

    Home » Forums » Developers, developers, developers » Web design and development » Using IP Address as Query Filter (2002)

    Author
    Topic
    #444018

    Hi,

    I’m building a website that has a form that saves data to a database. The purpose of the form is for the user to select photo’s that they will want copies of. Whan the form is saved to the database, the IP address is saved as well. This will be the unique identifier for the user’s selections. I plan to have a form that will be based on a query and will show the choices the user made. I need to be able to filter the query based on the IP address. My problem is I don’t want to have the user have to enter their own IP (as most won’t know it) and I want the page, as it opens, to query the database. Is this even possible and if so, how would I determine the IP to use in the query?

    Thanks,
    Leesha

    Viewing 1 reply thread
    Author
    Replies
    • #1072590

      I don’t do web development, so I cannot answer your question, but are you sure that the IP address is a good identifier? Although most people nowadays have (A)DSL or cable where the IP address remains the same for an extended period of time, there are still many people on dial-up where the IP address is assigned dynamically by the ISP. And people might browse from different PCs. You could ask people to register a username, or use their e-mail address.

      • #1072599

        Hi Hans,

        As always you’ve given me food for thought. The reason I picked the IP address is that it seemed to be the only common thread between the pages when they are saved to the database. I’d do have a page for them to enter user name, email etc. and that page also has the IP address. This is sooooooooooooooo different than programming in Access but I’m too stubborn to let it beat me! And I thought Access was hard to “get”. This is like pulling teeth since I keep “seeing” how I’d do it in Access and it just doesn’t work that way in Frontpage.

        Leesha

    • #1091019

      Sorry for the delay in replying, but you really shouldn’t use the IP address to identify something with a web user.

      Instead, create a user id and set it as a cookie. Have each page check to see if a session object ‘exists’. If it does, that object is the user’s ‘id’. If not, check for a cookie (you can set and read web users local cookies for your sight) value.

      Now, this is a stripped down version of actually having user accounts, where a user has a username and password. (using the cookies will work, but if someone wipes out their cookies, they’d get a ‘new’ account the next time.

      • #1091025

        Hi Drew,

        It must be fate, i’ve just been starting back at this yet again. And to think I thought Access was hard to tackle. I can “see” what I want to do but creating it………………OMG. OK so at the risk of sounding like a total newbie at this (I’ve really tackled a lot in the past months) how do I set a user id as a cookie?

        Thanks,
        Leesha

        • #1091041

          google for request.cookie and response.cookie. The first ‘reads’ cookies from the web user, the other writes.

          I started with Access 97, taught myself how to write VBA code, and about 2 years later decided to give asp a whack…haven’t turned back since. I love web interfaces, they have some distinct advantages over anything else (with only a few drawbacks).

          If you have the MSDN installed, take a look at the ASP Built in Objects reference card. Pretty handy.

          • #1091061

            I just bought an ASP book and hope to start digging in to it. Jerry gave me a link to a site he likes as well with tutorials etc. Keep you fingers crossed!!

            Thanks,
            Leesha

            • #1091131

              Cool, well if you have any specific questions, give me a holler.

              Have you ever made an asp page?

            • #1098296

              Hi Drew!

              I’m taking you up on your offer for a hand with asp. I’ve been working at this for days and more hours than I can count. I’ve have a registration page that submits information to an access database. The asp code has been generated by FP. I have set the database fields to not allow duplicates in the email field. This is working fine in that when the user submits their information, if the email address is already there, the row is not duplicated. My problem is that the confirmation page automatically populates making it look like the data was entered (when it was in fact blocked as it should be) and there is no error stating that the database wouldn’t accept the new record. I tired doctoring up the code generated by FP to look to see if the email address is already present and if it is to give an error but it didn’t work. Would you look at my code and see what I’m missing. I’m surrounded by .asp books but obviously am missing something. The code I added is in bold, red, itallics. The rest of the code is the code generated by FP.

              Thanks!
              Leesha

            • #1098298

              Ok, I’m a little busy at the moment, trying to get a project for work done, so I don’t have the time to modify the code for you. But here’s what you should do. Where it is opening the recordset, change that line to open a SQL statement that queries for that email address…then check for EOF/BOF. (Stay away from filters in a recordset….). If there is a record, close the recordset, and create the HTML you want to display, otherwise, close the recordset, reopen it (like the original line) add the record and display whatever you want for that.

              To display different data to the user, use conditional formatting:

              This text is displayed to the user if x=something, it’s HTML, so
              would display to the end user as a line break

              This is displayed if x doesn’t equal something

              Within conditional formatting, you can ‘place’ variables into the html with like this:

              Hello

              hope this helps.

            • #1098300

              Thanks, I’ll give it another shot.

              Leesha

    Viewing 1 reply thread
    Reply To: Using IP Address as Query Filter (2002)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: