I am wanting to create a user block I have the button
<a type="button" value="1" name="block" Cursor="pointer" href="blockuser.php?uid='. $data['id'].'">Block</a>
But I’m wanting to know how best to do this with PHP, Ajax and either the users table or a separate blockuser table. So when I click on block I cansend the value 1 to the database with the users id and stop them from veiwing my whole profile with a switch and visa versa.
I will then go on to creating a block list with the ability to unblock this user at any given point, if users so wish.
Privacy is a must! Thanks for any help given.
The only real question in your question is whether to create a new table for this or not, as the rest is a group of very straight-forward tasks for the technologies you mentioned.
Personally, I would opt for simply adding a column to the current users table and filling it with a comma delimited list of User IDs which you could simply search for a user ID within. This has the advantage that you’ll only need to run one query vs. the two which would be required to check the block list and then get the viewed user’s info in the two-table scheme.
Adding users to the blocklist is trivial (append a user id and perhaps a comma), and dropping the user from the blocklist would simply require splitting the blocklist, removing the proper user ID, then rebuilding the list by joining with a comma.
Also, this is only useful to implement if you require authentication to view a profile, and even then one could circumvent such a system by simply creating a new account.