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
Thanks Button on Home Page
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2 Only Mods Complete

Unknown User
2011-11-23 10:48:23
XIII,

You are the SHIT !!!!  :)

Thanks very much

Stolla
Unknown User
2011-11-23 11:19:54
moved to mods complete
Unknown User
2011-11-23 19:51:00
is it possible to move the button like in the image i'f tried to make...PLEASE !!!....maybe be part of torrents.php and not index.php

tt.png
tt.png
Unknown User
2011-11-23 19:53:07
currently it looks like this

tt2.png
tt2.png
Unknown User
2011-11-23 20:04:23
You could try this...

$dispname = "<b>".$smallname."</b>";





change to...





$dispname = '<b>'.$smallname.'</b><form action="index.php" method="post"><input type="hidden" name="torrent" value="'.$row["id"].'" /><input type="submit" value="Thanks!" /></form>';
Unknown User
2011-11-23 20:14:31
this happens

tt3.png
tt3.png
Unknown User
2011-11-23 21:06:18
i just need to move the button  :)

pic1 is what i want

pic2 is current



tt5.png
tt5.png
tt4.png
tt4.png
Unknown User
2011-11-24 00:46:47
looks like your screen is not big enough to display the full line.. to me i would have just made another column but again i got torrent-details for an reason  :)  ;)  :)  :)  :)

Ok not that I really wanted it lol but might help some of my lazy users hehehe

in function.php remove the stuff you add and find

:)

			   case 'dl':

echo "<th class='ttable_head'>".T_("DL")."</th>";
and Before add:


			case 'thanks':

echo "<th class='ttable_head' width=10%>Thanks</td>";

break;





and then search for



			case 'dl':

print("<td class=ttable_col$x align=center><a href=\"download.php?id=$id&name=" . rawurlencode($row["filename"]) . "\"><img src=" . $site_config['SITEURL'] . "/images/icon_download.gif border=0 alt=\"Download .torrent\"></a></td>");



and before add:



			case 'thanks':

 $res_thanks = SQL_Query_exec("SELECT `thanks` FROM torrents WHERE id=".$row["id"]);

 $row_thanks = mysql_fetch_row($res_thanks);

 mysql_free_result($res_thanks);

 $your_thanks = explode(",", $row_thanks[0]);

if (!in_array($CURUSER["username"], $your_thanks)) {

 $mythank = '<form action="thanks2.php" method="post"><input type="hidden" name="torrent" value="'.$row["id"].'" /><input type="submit" value="Thanks!" /></form>';

print("<td class=ttable_col$x align=center>$mythank</td>");

} else {

print("<td class=ttable_col$x align=center>Thanks<br />Added</td>");



}

break;





now create a new file called thanks2.php with the following stuff and upload it the root of your server aka where index.php is

<?php

require_once("backend/functions.php");

dbconn(false);

loggedinonly();



$id = (int)$_POST['torrent'];



if (!is_valid_id($id)) die;



$res = mysql_query("SELECT `thanks` FROM torrents WHERE id=$id");

$row = mysql_fetch_assoc($res);

mysql_free_result($res);

if (!$row) show_error_msg("Error", "Sorry no .torrent found with this ID, it has probably been deleted.",1);



$thanksl = explode(",", $row['thanks']);



if (in_array($CURUSER['username'], $thanksl)) show_error_msg("Error", "You have already left thanks for this torrent.",1);



mysql_query(sprintf("UPDATE `torrents` SET thanks = CONCAT_WS(',', `thanks`, %s) WHERE `id`=%d", sqlesc($CURUSER['username']), $id)) or die(mysql_error());



$referring_url = $_SERVER['HTTP_REFERER'];

$requested_url = $_SERVER['REQUEST_URI'];



header("Refresh: 3;url=$referring_url");

show_error_msg("Success", "Thanks added.<BR>Redirecting...", 1);

?>



after that to get it to not show the thanks button if already thanked in index.php find



, torrents.anon



and replace it with



, torrents.anon, torrents.thanks


and if you want it on torrents.php find an replace the above stuff in that php too

You might ask why thanks2.php its because on my site I use an ajax thanks for the torrent-details page

2011_11_23_2049.png
2011_11_23_2049.png
Unknown User
2011-11-24 09:19:19
Now it works 100% and looks good....thanks everyone, all of the ideas work but this one is just easier to managed.

BTW, also had to add this part in config.php

from

$site_config["torrenttable_columns"] = "category,name,dl,uploader,comments,size,speed,seeders,leechers,completed,wai

t,added,imdb,nfo,health";
to


$site_config["torrenttable_columns"] = "category,name,dl,uploader,comments,size,speed,seeders,leechers,completed,wai

t,added,thanks,imdb,nfo,health";

tt6.png
tt6.png
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: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728