SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need for speed with MySQL

    If I have a list of IPs in a MySQL that I want to not display certain content (AdSense ads), what would be the fastest way to do that? Put them in a text file via a cron job and check if it contains the IP, do a MySQL look up every time a page is loaded and index the IP column or what?

    I'm going to need whatever I do to display on every page, or possible just store a session or something, but there will need to be some type of lookup.

    Thanks for any advice.

  2. #2
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    how big is the list? if it's less than 100, i would say a simple flat text file searched via php. more than 5000? a memory-based table in mysql. in between, i would benchmark it.

  3. #3
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It may grow above 5,000 one day, right now it's about 150. But the list is 2 days old.

    Should I store like the value in a $_SESSION once I get it?

    Thanks.

  4. #4
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by hdpt00
    Should I store like the value in a $_SESSION once I get it?
    huh? why would you store the IP list as a session variable?

  5. #5
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, do a lookup to see if their IP is in the list then store a variable like $_SESSION['allowviews'] and set it to 1 or 0 instead of doing a lookup again.

  6. #6
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    ah, yes. that is a good idea.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •