Jump to content

Don't display for specific user/ip is not displaying for anyone?


Recommended Posts

Hi there!

 

I am trying to utilize a flag/block feature that allows someone to flag or block a posted bookmark and then only that person won't have to see it anymore.

 

So there is a blocked_users table and when you block a user it records your customer_id if logged in and also your IP address.

 

For the display bookmarks function, I added this to the select statement:

 

      AND (bl.blocked_customer_id IS NULL OR

                !(bl.customer_id='".addslashes($customer_id)."' OR bl.ip_address='"

                .addslashes($ip_address)."'))

 

I thought it worked perfectly until I noticed that when other people would visit the site from completely different IPs/computers they could not see bookmarks posted by users who I blocked.

 

More code:

$ip_address = getenv("REMOTE_ADDR");

$command = "SELECT SQL_CALC_FOUND_ROWS (.....)

FROM customer_logins as cl, customer_bookmarks cb

                INNER JOIN bookmark_urls bu ON cb.bookmark_id=bu.bookmark_id   

                LEFT OUTER JOIN blocked_users bl ON cb.customer_id = bl.blocked_customer_id

                WHERE

                (.....)

                AND (bl.blocked_customer_id IS NULL OR

                !(bl.customer_id='".addslashes($customer_id)."' OR bl.ip_address='"

                .addslashes($ip_address)."'))

              (.............)

 

Where $customer_id is a variable passed to the function of the logged in user's ID

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.