johanafm;10992006 wrote:I am assuming you require the user to login as to authenticate themselves. After this point, you should allready have the user's id in $_SESSION and use it to keep track of which user is which.
Wether you pass stuff around in URL or POST data doesn't matter. It's just slightly easier to modify an existing url than creating your own post request, but not by much.
So pass the friend id around any way you like. Just make sure that the one claiming to be friends with that person is logged in and that their user_id has such a friend.
johanafm;10992006 wrote:I am assuming you require the user to login as to authenticate themselves. After this point, you should allready have the user's id in $_SESSION and use it to keep track of which user is which.
Yes I have a code that I run at the top of every php page of my site:
<?php
include_once("scripts/checkuserlog.php");
?>
This code checks to see if
[CODE]
isset($_SESSION['id']
If so, then its sets some options that run across the top of every page, such as user's Name, Home, Logout, Account Settings etc.
THen on pages where I have a logged in member looking at someone eles profile or friends page, I also add this (to grab the other users ID):
if ($_GET['id']) {
$id = $_GET['id'];
}
And then I have another mysql query to check a table in the database to see if both members are "friends."
Is this sufficient or overkill?