link restriction help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Untested.... (Assuming you know what the post id is which is viewed now, and what it is in the DB....

Code: Select all

$uid = $_SESSION['userID'];

$query = "SELECT userID from users WHERE postID='$thisPost' LIMIT 1";

if ($result = mysql_query($query)) {
    if (mysql_result($result, 0, 'userID') == $uid) {
        echo '<a href="reportedit.php" class="under">EDIT</a>';
    } else {
        NULL;
    }
}
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post by pleigh »

also....not working.... :(
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

[SOLVED]link restriction help

Post by pleigh »

hey guys, i solved my problem now....in my query, i did this

Code: Select all

$query = &quote;SELECT userID FROM posts WHERE userID='$uid' AND postID='$id'&quote;;
instead of selecting userID, postID, i just selected userID with a conditions tha userID='$currentsession' and postID='$currentpost
Post Reply