Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Error come
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Support

2021-11-02 20:55:45
Error comments torrent...

hello guys i have a mistake i can correct and i would love to have your support to fix it if it is possible !?
As soon as I make a comment and I do an update the message doubles and goes on!

possible that once updating the comment this double, triple, etc ...?

Thanks !  :giggle
Last edited by spiritblue on 2021-11-03 08:08:18
2021-11-03 21:52:13
did this error appear recently ?

do you get same error with news comments - check if this is correct link when updating, so we know where to look
comments.php?type=torrent&edit=1

check admincp logs - does it say spirtblue has edited comment: ID:xx two times

has sql version or mod been added that could effect it

2021-11-07 13:10:20
thank you M-jay, you put the chip in my ear and I tested the update file on V3 (github) and everything is fine again.

resolved!  :thumb
2021-11-07 13:30:21
I try to do the redirect after editing a message and he does not want to do this?

edit:

if($save){
$text = sqlesc($_POST['text']);

$query="UPDATE comments SET text=$text WHERE id=$id";
$result=SQL_Query_exec($query);
write_log("<a href=account-details.php?id=".$CURUSER['id']."><b>".$CURUSER['username']."</a></b> ID a été édité pour se commentaire: <b>$id</b> from torrent: [<a href=torrents-details.php?id=$idback><b>$idback</b></a>]");
autolink("torrents-details.php?id=$idback", "Commentaire a été modifiée avec succès.");
#write_log($CURUSER['username']." a modifié le commentaire: ID:$id");
#show_error_msg(T_("COMPLETE"), "Commentaire Modifié !",1);
}


deleted:

SQL_Query_exec("DELETE FROM comments WHERE id = $id");
write_log("<a href=account-details.php?id=".$CURUSER['id']."><b>".$CURUSER['username']."</a></b> a supprimé le ID du commentaires: <b>$id</b> Nouvelles du ID: [<a href=comments.php?type=news&id=$idback><b>$idback</b></a>]");
autolink("comments.php?type=news&id=$idback", "Commentaire a été supprimé avec succès.");
#write_log($CURUSER['username']." has deleted comment: ID: $id");
#show_error_msg(T_("COMPLETE"), "Comment deleted OK", 1);
}

]
Last edited by spiritblue on 2021-11-07 13:35:17
2021-11-07 13:55:53
See if it works without back  in url $idback
autolink("torrents-details.php?id=$id", "Commentaire a été modifiée avec succès.");
die();
Last edited by M-jay warn on 2021-11-07 14:28:38
2021-11-07 16:09:48
thanks  :thumb , but my id changes and returns me to invalid id error

Thank you for your help

comments.php:
<?php
require_once("backend/functions.php");
require_once("backend/bbcode.php");
dbconn();

if ($site_config["MEMBERSONLY"]) {
   loggedinonly();
}


$id = (int)$_GET["id"];
$type = $_GET["type"];
$edit = (int)$_GET["edit"];
$delete = (int)$_GET["delete"];
$dossier = $CURUSER['bbcode'];

if ($edit == 1 || $delete == 1 || $_GET["takecomment"] == 'yes') loggedinonly();

if (!isset($id) || !$id || ($type != "torrent" && $type != "news"))
show_error_msg(T_("ERROR"), T_("ERROR"), 1);

if ($edit=='1'){
$row = mysqli_fetch_assoc(SQL_Query_exec("SELECT user FROM comments WHERE id=$id"));

   if (($type == "torrent" && $CURUSER["edit_torrents"] == "no" || $type == "news" && $CURUSER["edit_news"] == "no") && $CURUSER['id'] != $row['user'])  
show_error_msg(T_("ERROR"),T_("ERR_YOU_CANT_DO_THIS"),1);

$save = (int)$_GET["save"];

if($save){
$text = sqlesc($_POST['text']);

$query="UPDATE comments SET text=$text WHERE id=$id";
$result=SQL_Query_exec($query);
write_log("<a href=account-details.php?id=".$CURUSER['id']."><b>".$CURUSER['username']."</a></b> ID a été édité pour se commentaire: <b>$id</b> du torrent: [<a href=torrents-details.php?id=$id><b>$id</b></a>]");
           autolink("torrents-details.php?id=$id", "Commentaire a été modifiée avec succès.");
           die();
#write_log($CURUSER['username']." a modifié le commentaire: ID:$id");
#show_error_msg(T_("COMPLETE"), "Commentaire Modifié !",1);
}

stdhead("Edit Comment");

$res = SQL_Query_exec("SELECT * FROM comments WHERE id=$id");
$arr = mysqli_fetch_array($res);

       begin_frame(T_("EDITCOMMENT"));
       print("<center><b>".T_("EDITCOMMENT")." </b><p>\n");
       print("<form method=\"post\" name=\"comment\" action=\"comments.php?type=$type&edit=1&save=1&id=$id\">\n");
       print textbbcode("comment","text",$dossier, htmlspecialchars($arr["text"]));
       print("<center><p><input type=\"submit\" value=\"Soumettre les modifications\" /></p></center></form></center>\n");
       end_frame();
       stdfoot();
       die();
#begin_frame(T_("EDITCOMMENT"));
#print("<center><b> ".T_("EDITCOMMENT")." </b><p>\n");
#print("<form method=\"post\" name=\"comment\" action=\"comments.php?type=$type&edit=1&save=1&id=$id\">\n");
#print textbbcode("comment","text", htmlspecialchars($arr["text"]));
#print("<p><input type=\"submit\" value=\"Submit Changes\" /></p></form></center>\n");
#end_frame();
#stdfoot();
#die();
}

if ($delete=='1'){
if ($CURUSER["delete_news"] == "no" && $type == "news" || $CURUSER["delete_torrents"] == "no" && $type == "torrent")  
show_error_msg(T_("ERROR"),T_("ERR_YOU_CANT_DO_THIS"),1);

if ($type == "torrent") {
$res = SQL_Query_exec("SELECT torrent FROM comments WHERE id=$id");
$row = mysqli_fetch_assoc($res);
if ($row["torrent"] > 0) {
SQL_Query_exec("UPDATE torrents SET comments = comments - 1 WHERE id = $row[torrent]");
}
}

SQL_Query_exec("DELETE FROM comments WHERE id = $id");
write_log("<a href=account-details.php?id=".$CURUSER['id']."><b>".$CURUSER['username']."</a></b> a supprimé le ID du commentaires: <b>$id</b> Nouvelles du ID: [<a href=comments.php?type=news&id=$idback><b>$idback</b></a>]");
   autolink("comments.php?type=news&id=$id", "Commentaire a été supprimé avec succès.");
   #autolink("comments.php?type=news&id=$idback", "Commentaire a été supprimé avec succès.");
#write_log($CURUSER['username']." has deleted comment: ID: $id");
#show_error_msg(T_("COMPLETE"), "Comment deleted OK", 1);
}


stdhead(T_("COMMENTS"));


//take comment add
if ($_GET["takecomment"] == 'yes'){
$body = $_POST['body'];

if (!$body)
show_error_msg(T_("ERROR"), T_("YOU_DID_NOT_ENTER_ANYTHING"), 1);

if ($type =="torrent"){
SQL_Query_exec("UPDATE torrents SET comments = comments + 1 WHERE id = $id");
}

SQL_Query_exec("INSERT INTO comments (user, ".$type.", added, text) VALUES (".$CURUSER["id"].", ".$id.", '" .get_date_time(). "', " . sqlesc($body).")");

if (mysqli_affected_rows($GLOBALS["DBconnector"]) == 1)
show_error_msg(T_("COMPLETED"), "Votre commentaire a été ajouté avec succès.", 0);
else
show_error_msg(T_("ERROR"), T_("UNABLE_TO_ADD_COMMENT"), 0);
}//end insert comment

//NEWS
if ($type =="news"){
$res = SQL_Query_exec("SELECT * FROM news WHERE id = $id");
$row = mysqli_fetch_array($res);

if (!$row){
show_error_msg(T_("ERROR"), "Nouvelles Id invalide", 0);
stdfoot();
}

begin_frame(T_("NEWS"));
echo htmlspecialchars($row['title']) . "<br /><br />".format_comment($row['body'])."<br />";
end_frame();

}

//TORRENT
if ($type =="torrent"){
$res = SQL_Query_exec("SELECT id, name FROM torrents WHERE id = $id");
$row = mysqli_fetch_array($res);

if (!$row){
show_error_msg(T_("ERROR"), "Nouveau Id invalide", 0);
stdfoot();
}
   echo "<center><table><tr><td width=50% height=50% class=ttable_head colspan=2 align=center style=line-height:100px;padding-top:14px;vertical-align:middle;font-size:20px;><b>".T_("COMMENTSFOR").":</b> <a href='torrents-details.php?id=".$row['id']."'>".htmlspecialchars($row['name'])."</a></td></tr></table></center><br />";
#echo "<center><b>".T_("COMMENTSFOR")."</b> <a href='torrents-details.php?id=".$row['id']."'>".htmlspecialchars($row['name'])."</a></center><br />";
}

begin_frame(T_("COMMENTS"));

$subres = SQL_Query_exec("SELECT COUNT(*) FROM comments WHERE $type = $id");
$subrow = mysqli_fetch_array($subres);
$commcount = $subrow[0];

if ($commcount) {
list($pagertop, $pagerbottom, $limit) = pager(10, $commcount, "comments.php?id=$id&type=$type&");
$commquery = "SELECT comments.id, text, user, comments.added, avatar, signature, username, title, class, uploaded, downloaded, privacy, donated FROM comments LEFT JOIN users ON comments.user = users.id WHERE $type = $id ORDER BY comments.id $limit";
$commres = SQL_Query_exec($commquery);
}else{
unset($commres);
}

if ($commcount) {
print($pagertop);
commenttable($commres, $type);
print($pagerbottom);
}else {
print("<br /><b>" .T_("NOCOMMENTS"). "</b><br />\n");
}

echo "<center>";
echo "<form name=\"comment\" method=\"post\" action=\"comments.php?type=$type&id=$id&takecomment=yes\">";
#echo textbbcode("comment","body")."<br />";
echo textbbcode("comment","body","$dossier")."<br />";
echo "<input type=\"submit\"  value=\"".T_("ADDCOMMENT")."\" />";
echo "</form></center>";

end_frame();

stdfoot();
?>

Last edited by spiritblue on 2021-11-07 16:10:41
2021-11-07 16:52:09
my mistake $id is comment id  :unsure

try replace these in comments.php

replace
print("<form method=\"post\" name=\"comment\" action=\"comments.php?type=$type&edit=1&save=1&id=$id\">\n");


with
print("<form method=\"post\" name=\"comment\" action=\"comments.php?tid=$tid&type=$type&edit=1&save=1&id=$id\">\n");


find
$id = (int)$_GET["id"];


below add
$tid = (int)$_GET["tid"];


find
autolink("torrents-details.php?id=$id", "Commentaire a été modifiée avec succès.");


replace with
autolink("torrents-details.php?id=$tid", "Commentaire a été modifiée avec succès.");


in torrents detail
find
commenttable($commres, 'torrent');


replace
commenttable($commres, 'torrent', $id);


in functions.php (commenttable)
find
function commenttable($res, $type = null) {


replace with
function commenttable($res, $type = null, $tid = 0) {


find
        if ($type == "torrent" && $CURUSER["edit_torrents"] == "yes" || $type == "news" && $CURUSER["edit_news"] == "yes" || $CURUSER['id'] == $row['user']) 
           $edit = '[<a href="comments.php?id='.$row["id"].'&type='.$type.'&edit=1">Edit</a>] ';


replace with
        if ($type == "torrent" && $CURUSER["edit_torrents"] == "yes" || $type == "news" && $CURUSER["edit_news"] == "yes" || $CURUSER['id'] == $row['user']) 
           $edit = '[<a href="comments.php?tid=$tid&id='.$row["id"].'&type='.$type.'&edit=1">Edit</a>] ';
Last edited by M-jay warn on 2021-11-07 16:53:02
2021-11-07 20:10:53
a big thank you.

Adding a comment and redirecting it after confirmation works fine, only the edition which loses my torrent ID and its comment which does not take and the change still works at the edition but does not redirect me as you can see it. preocedure from the first frame to the last frame.








2021-11-07 20:49:20
played with v3 and it will be easier to use sql instead of passing $id about

get torrent id from comment table - add torrent
	$row = mysqli_fetch_assoc(SQL_Query_exec("SELECT user, torrent FROM comments WHERE id=$id"));
$tid = $row['torrent'];


so
if ($edit=='1'){
$row = mysqli_fetch_assoc(SQL_Query_exec("SELECT user, torrent FROM comments WHERE id=$id"));
$tid = $row['torrent'];

   if (($type == "torrent" && $CURUSER["edit_torrents"] == "no" || $type == "news" && $CURUSER["edit_news"] == "no") && $CURUSER['id'] != $row['user'])  
show_error_msg(T_("ERROR"),T_("ERR_YOU_CANT_DO_THIS"),1);

$save = (int)$_GET["save"];

if($save){
$text = sqlesc($_POST['text']);

$query="UPDATE comments SET text=$text WHERE id=$id";
$result=SQL_Query_exec($query);
write_log($CURUSER['username']." has edited comment: ID:$id");

autolink("torrents-details.php?id=$tid", 'success');
die();
2021-11-07 21:26:57
thank you M-jay the edition to work but I even have problem with the deletion

if ($delete=='1'){
if ($CURUSER["delete_news"] == "no" && $type == "news" || $CURUSER["delete_torrents"] == "no" && $type == "torrent")  
show_error_msg(T_("ERROR"),T_("ERR_YOU_CANT_DO_THIS"),1);

if ($type == "torrent") {
$res = SQL_Query_exec("SELECT torrent FROM comments WHERE id=$id");
$row = mysqli_fetch_assoc($res);
if ($row["torrent"] > 0) {
SQL_Query_exec("UPDATE torrents SET comments = comments - 1 WHERE id = $row[torrent]");
}
}

SQL_Query_exec("DELETE FROM comments WHERE id = $id");
write_log("<a href=account-details.php?id=".$CURUSER['id']."><b>".$CURUSER['username']."</a></b> a supprimé le ID du commentaires: <b>$id</b> Nouvelles du ID: [<a href=comments.php?type=news&id=$idback><b>$idback</b></a>]");
   autolink("comments.php?type=news&id=$id", "Commentaire a été supprimé avec succès.");
   #autolink("comments.php?type=news&id=$idback", "Commentaire a été supprimé avec succès.");
#write_log($CURUSER['username']." has deleted comment: ID: $id");
#show_error_msg(T_("COMPLETE"), "Comment deleted OK", 1);
}

2021-11-08 14:40:55
if this works spirtblue i would suggest removing other edits

this seems to work on torrents & news, i add //////  to help locate changes in autolink we use $tid

if ($edit=='1'){
/////
$row = mysqli_fetch_assoc(SQL_Query_exec("SELECT user, torrent, news FROM comments WHERE id=$id"));
if($row['torrent'] == 0) {
$tid = $row['news'];
} else {
$tid = $row['torrent'];
}
//////
   if (($type == "torrent" && $CURUSER["edit_torrents"] == "no" || $type == "news" && $CURUSER["edit_news"] == "no") && $CURUSER['id'] != $row['user'])  
show_error_msg(T_("ERROR"),T_("ERR_YOU_CANT_DO_THIS"),1);

$save = (int)$_GET["save"];

if($save){
$text = sqlesc($_POST['text']);

$query="UPDATE comments SET text=$text WHERE id=$id";
$result=SQL_Query_exec($query);
write_log($CURUSER['username']." has edited comment: ID:$id");
/////
if ($type == 'torrent') {
   autolink("torrents-details.php?id=$tid", 'success');
   die();
} else {
autolink("comments.php?type=news&id=$tid", 'success');
   die();
}
///////
}

stdhead("Edit Comment");

$res = SQL_Query_exec("SELECT * FROM comments WHERE id=$id");
$arr = mysqli_fetch_array($res);

begin_frame(T_("EDITCOMMENT"));
print("<center><b> ".T_("EDITCOMMENT")." </b><p>\n");
print("<form method=\"post\" name=\"comment\" action=\"comments.php?type=$type&edit=1&save=1&id=$id\">\n");
print textbbcode("comment","text", htmlspecialchars($arr["text"]));
print("<p><input type=\"submit\"  value=\"Submit Changes\" /></p></form></center>\n");
end_frame();
stdfoot();
die();
}

if ($delete=='1'){
if ($CURUSER["delete_news"] == "no" && $type == "news" || $CURUSER["delete_torrents"] == "no" && $type == "torrent")  
show_error_msg(T_("ERROR"),T_("ERR_YOU_CANT_DO_THIS"),1);
   /////////
$res = SQL_Query_exec("SELECT torrent, news FROM comments WHERE id=$id");
$row = mysqli_fetch_assoc($res);
if ($type == "torrent") {
if ($row["torrent"] > 0) {
SQL_Query_exec("UPDATE torrents SET comments = comments - 1 WHERE id = $row[torrent]");
$tid = $row['torrent'];
SQL_Query_exec("DELETE FROM comments WHERE id = $id");
       write_log($CURUSER['username']." has deleted comment: ID: $id");
       autolink("torrents-details.php?id=$tid", 'Comment deleted OK');
       die();
}
} else {
  $tid = $row['news'];
   SQL_Query_exec("DELETE FROM comments WHERE id = $id");
   write_log($CURUSER['username']." has deleted comment: ID: $id");
   autolink("comments.php?type=news&id=$tid", 'Comment deleted OK');
   die();
}
///////
}


stdhead(T_("COMMENTS"));
2021-11-08 22:57:21
:thumb m8

for The news: I corrected for the id in tid but the edition of news returns me on detail of torretn ?, it does not hold tale of the deletion of message of the news


// Delete
if ($delete=='1'){
if ($CURUSER["delete_news"] == "no" && $type == "news" || $CURUSER["delete_torrents"] == "no" && $type == "torrent")  
show_error_msg(T_("ERROR"),T_("ERR_YOU_CANT_DO_THIS"),1);

$res = SQL_Query_exec("SELECT torrent, news FROM comments WHERE id=$id");
$row = mysqli_fetch_assoc($res);
if ($type == "torrent") {
if ($row["torrent"] > 0) {
SQL_Query_exec("UPDATE torrents SET comments = comments - 1 WHERE id = $row[torrent]");
$tid = $row['torrent'];
SQL_Query_exec("DELETE FROM comments WHERE id = $id");
      write_log($CURUSER['username']." a supprimer le ID: $id du commentaire.");
      autolink("torrents-details.php?id=$tid", 'Commentaire a été supprimé avec succès.');
      die();
}
   } else {
   $tid = $row['news'];
   SQL_Query_exec("DELETE FROM comments WHERE id = $id");
   write_log($CURUSER['username']." a supprimer le ID: $id du commentaire.");
   autolink("comments.php?type=news&id=$tid", 'commentaire supprimé avec succès.');
   die();
   }

}
// End Delete

2021-11-09 15:45:42
this seems to work for me on your comments.php

<?php
require_once("backend/functions.php");
require_once("backend/bbcode.php");
dbconn();

if ($site_config["MEMBERSONLY"]) {
  loggedinonly();
}


$id = (int)$_GET["id"];
$type = $_GET["type"];
$edit = (int)$_GET["edit"];
$delete = (int)$_GET["delete"];
$dossier = $CURUSER['bbcode'];

if ($edit == 1 || $delete == 1 || $_GET["takecomment"] == 'yes') loggedinonly();

if (!isset($id) || !$id || ($type != "torrent" && $type != "news"))
show_error_msg(T_("ERROR"), T_("ERROR"), 1);

if ($edit=='1'){
$row = mysqli_fetch_assoc(SQL_Query_exec("SELECT user, torrent, news FROM comments WHERE id=$id"));
// here
if($row['torrent'] == 0) {
$tid = $row['news'];
} else {
$tid = $row['torrent'];
}
//
  if (($type == "torrent" && $CURUSER["edit_torrents"] == "no" || $type == "news" && $CURUSER["edit_news"] == "no") && $CURUSER['id'] != $row['user'])  
show_error_msg(T_("ERROR"),T_("ERR_YOU_CANT_DO_THIS"),1);

$save = (int)$_GET["save"];

if($save){
$text = sqlesc($_POST['text']);

$query="UPDATE comments SET text=$text WHERE id=$id";
$result=SQL_Query_exec($query);
write_log("<a href=account-details.php?id=".$CURUSER['id']."><b>".$CURUSER['username']."</a></b> ID a été édité pour se commentaire: <b>$id</b> du torrent: [<a href=torrents-details.php?id=$id><b>$id</b></a>]");
// here
if ($type == 'torrent') {
   autolink("torrents-details.php?id=$tid", 'success');
   die();
} else {
autolink("comments.php?type=news&id=$tid", 'success');
   die();
}           autolink("torrents-details.php?id=$id", "Commentaire a été modifiée avec succès.");
          //
#write_log($CURUSER['username']." a modifié le commentaire: ID:$id");
#show_error_msg(T_("COMPLETE"), "Commentaire Modifié !",1);
}

stdhead("Edit Comment");

$res = SQL_Query_exec("SELECT * FROM comments WHERE id=$id");
$arr = mysqli_fetch_array($res);

      begin_frame(T_("EDITCOMMENT"));
      print("<center><b>".T_("EDITCOMMENT")." </b><p>\n");
      print("<form method=\"post\" name=\"comment\" action=\"comments.php?type=$type&edit=1&save=1&id=$id\">\n");
      print textbbcode("comment","text",$dossier, htmlspecialchars($arr["text"]));
      print("<center><p><input type=\"submit\" value=\"Soumettre les modifications\" /></p></center></form></center>\n");
      end_frame();
      stdfoot();
      die();
#begin_frame(T_("EDITCOMMENT"));
#print("<center><b> ".T_("EDITCOMMENT")." </b><p>\n");
#print("<form method=\"post\" name=\"comment\" action=\"comments.php?type=$type&edit=1&save=1&id=$id\">\n");
#print textbbcode("comment","text", htmlspecialchars($arr["text"]));
#print("<p><input type=\"submit\" value=\"Submit Changes\" /></p></form></center>\n");
#end_frame();
#stdfoot();
#die();
}

if ($delete=='1'){
if ($CURUSER["delete_news"] == "no" && $type == "news" || $CURUSER["delete_torrents"] == "no" && $type == "torrent")  
show_error_msg(T_("ERROR"),T_("ERR_YOU_CANT_DO_THIS"),1);
   // here
$res = SQL_Query_exec("SELECT torrent, news FROM comments WHERE id=$id");
$row = mysqli_fetch_assoc($res);
if ($row["torrent"] == 0) {
$news_id = $row['news'];
SQL_Query_exec("DELETE FROM comments WHERE id = $id");
   write_log($CURUSER['username']." has deleted comment: ID: $id");
   autolink("comments.php?type=news&id=$news_id", 'Commentaire a été supprimé avec succès.');
   die();
} else {
$tid = $row['torrent'];
SQL_Query_exec("UPDATE torrents SET comments = comments - 1 WHERE id = $row[torrent]");
SQL_Query_exec("DELETE FROM comments WHERE id = $id");
   write_log($CURUSER['username']." has deleted comment: ID: $id");
   autolink("torrents-details.php?id=$tid", 'Commentaire a été supprimé avec succès.');
   die();
}
//
}


stdhead(T_("COMMENTS"));


//take comment add
if ($_GET["takecomment"] == 'yes'){
$body = $_POST['body'];

if (!$body)
show_error_msg(T_("ERROR"), T_("YOU_DID_NOT_ENTER_ANYTHING"), 1);

if ($type =="torrent"){
SQL_Query_exec("UPDATE torrents SET comments = comments + 1 WHERE id = $id");
}

SQL_Query_exec("INSERT INTO comments (user, ".$type.", added, text) VALUES (".$CURUSER["id"].", ".$id.", '" .get_date_time(). "', " . sqlesc($body).")");

if (mysqli_affected_rows($GLOBALS["DBconnector"]) == 1)
show_error_msg(T_("COMPLETED"), "Votre commentaire a été ajouté avec succès.", 0);
else
show_error_msg(T_("ERROR"), T_("UNABLE_TO_ADD_COMMENT"), 0);
}//end insert comment

//NEWS
if ($type =="news"){
$res = SQL_Query_exec("SELECT * FROM news WHERE id = $id");
$row = mysqli_fetch_array($res);

if (!$row){
show_error_msg(T_("ERROR"), "Nouvelles Id invalide", 0);
stdfoot();
}

begin_frame(T_("NEWS"));
echo htmlspecialchars($row['title']) . "<br /><br />".format_comment($row['body'])."<br />";
end_frame();

}

//TORRENT
if ($type =="torrent"){
$res = SQL_Query_exec("SELECT id, name FROM torrents WHERE id = $id");
$row = mysqli_fetch_array($res);

if (!$row){
show_error_msg(T_("ERROR"), "Nouveau Id invalide", 0);
stdfoot();
}
  echo "<center><table><tr><td width=50% height=50% class=ttable_head colspan=2 align=center style=line-height:100px;padding-top:14px;vertical-align:middle;font-size:20px;><b>".T_("COMMENTSFOR").":</b> <a href='torrents-details.php?id=".$row['id']."'>".htmlspecialchars($row['name'])."</a></td></tr></table></center><br />";
#echo "<center><b>".T_("COMMENTSFOR")."</b> <a href='torrents-details.php?id=".$row['id']."'>".htmlspecialchars($row['name'])."</a></center><br />";
}

begin_frame(T_("COMMENTS"));

$subres = SQL_Query_exec("SELECT COUNT(*) FROM comments WHERE $type = $id");
$subrow = mysqli_fetch_array($subres);
$commcount = $subrow[0];

if ($commcount) {
list($pagertop, $pagerbottom, $limit) = pager(10, $commcount, "comments.php?id=$id&type=$type&");
$commquery = "SELECT comments.id, text, user, comments.added, avatar, signature, username, title, class, uploaded, downloaded, privacy, donated FROM comments LEFT JOIN users ON comments.user = users.id WHERE $type = $id ORDER BY comments.id $limit";
$commres = SQL_Query_exec($commquery);
}else{
unset($commres);
}

if ($commcount) {
print($pagertop);
commenttable($commres, $type);
print($pagerbottom);
}else {
print("<br /><b>" .T_("NOCOMMENTS"). "</b><br />\n");
}

echo "<center>";
echo "<form name=\"comment\" method=\"post\" action=\"comments.php?type=$type&id=$id&takecomment=yes\">";
#echo textbbcode("comment","body")."<br />";
echo textbbcode("comment","body","$dossier")."<br />";
echo "<input type=\"submit\"  value=\"".T_("ADDCOMMENT")."\" />";
echo "</form></center>";

end_frame();

stdfoot();
?>
2021-11-09 22:50:04
M8 M-Jay  :bomb  thank you all is well now.

Merci beaucoup !  :thumb

(ps: je vous oublie pas pour vous ajouter des themes pour tt)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(ps: I will not forget you to add you themes for tt)
2021-11-12 22:25:12
yea, this works great. I was doing it a semi-garbage way, but yours is much cleaner. Thanks
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 9
  • Members: 0
  • Guests online: 9
  • Comments: 3
  • Messages: 1,728