This is a like button i have made it is fully working but doesn't show names of members who have thanked yet. Ive tried a join query with no luck so if any one can help would be very appreciated.
I havent tested this on v3 but it is fine on mine so any issues let me know and ill look at the query's
Its just like button on torrents for now but im going to add to forum as well here is the db structure
$id = table id
$lid = like id/ type so we can add others thanks, love etc like is type 1
$uid = user id
$pid = post id, this will be torrent id, shoutbox comment id, forumpost id, comment id etc
In torrent-details.php find
above add
sql

I havent tested this on v3 but it is fine on mine so any issues let me know and ill look at the query's
Its just like button on torrents for now but im going to add to forum as well here is the db structure
$id = table id
$lid = like id/ type so we can add others thanks, love etc like is type 1
$uid = user id
$pid = post id, this will be torrent id, shoutbox comment id, forumpost id, comment id etc
In torrent-details.php find
echo "</table></fieldset><br /><br />";
// $srating IS RATING VARIABLEabove add
// like mod
if(isset($_POST['like'])) {
SQL_Query_exec("INSERT INTO likes (lid, uid, pid) VALUES (1, $CURUSER['id'], $row['id']));
header('Location: '.$_SERVER['REQUEST_URI']);
exit;
} elseif (isset($_POST['unlike'])) {
SQL_Query_exec("DELETE FROM likes WHERE lid=1 AND uid=$CURUSER['id'] AND pid= $row['id']");
header('Location: '.$_SERVER['REQUEST_URI']);
exit;
}
/* Check Database */
$res2 = SQL_Query_exec("SELECT * FROM likes WHERE lid=1 AND uid=$CURUSER['id'] AND pid= $row['id']");
$row = mysqli_fetch_row($re2);
$likes = $row[0];
if (!$likes) {
/* If No Result Like */
print("<tr><td align='left'><b>Likes</b></td><td><form action='' method='post'>
<input type='submit' name='like' value='Like' />
</form></br></td></tr>");
} else {
/* If Result UnLike */
print("<tr><td align='left'><b>Likes</b></td><td><form action='' method='post'>
<input type='submit' name='unlike' value='Unlike' />
</form></br></td></tr>");
}
sql
CREATE TABLE IF NOT EXISTS `likes` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`lid` int(10) NOT NULL DEFAULT 0,
`uid` int(10) NOT NULL DEFAULT 0,
`pid` int(10) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

