Jump to content

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


deerly

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

Archived

This topic is now archived and is closed to further replies.

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