deerly Posted May 31, 2009 Share Posted May 31, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/160414-dont-display-for-specific-userip-is-not-displaying-for-anyone/ Share on other sites More sharing options...
fenway Posted June 6, 2009 Share Posted June 6, 2009 You have order-of-operations issues... precedence and paren placement matters. And why not use !=? Quote Link to comment https://forums.phpfreaks.com/topic/160414-dont-display-for-specific-userip-is-not-displaying-for-anyone/#findComment-850489 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.