View Single Post
  #1  
Old 25th March 2013, 15:59
Chez's Avatar
Chez Chez is offline
Senior Member
 
Join Date: Sep 2011
P2P
Posts: 278
Default Clickable thank mod

Thanks -> Clickable thank you button by be4i
posted on tbdev.net on 30 July 2005 by Angel
modded by 9bz for nzbstrike


add to SQL :
PHP Code:
CREATE TABLE `thanks` (
    `
nzbidint(5NOT NULL default '0',
    `
useridint(5NOT NULL default '0',
    
UNIQUE KEY `thanks` (`nzbid`,`userid`)

make a thanks.php with this:
PHP Code:
<?
require_once("include/bittorrent.php");
dbconn();
loggedinorreturn();
/*
parked();
*/
$userid $CURUSER["id"];
$nzbid $_POST["nzbid"];
if (isset(
$userid) && isset($nzbid))
{
$res mysql_query("INSERT INTO thanks (nzbid, userid) VALUES ($nzbid$userid)");
header("Location: $BASEURL/nzbdetails.php?id=$nzbid&thanks=1");
}
else {
header("Location: $BASEURL/nzbbrowse.php");
}
hit_end()
?>
in details.php
find :
PHP Code:
print("</table></p>\n"); 
add above:
PHP Code:
$nzbid $_GET["id"];
          
$thanks_sql mysql_query("SELECT * FROM thanks where nzbid=$nzbid");
    
$thanks_all mysql_numrows($thanks_sql);
    if (
$thanks_all) {
    while(
$rows_t mysql_fetch_array($thanks_sql)) {
    
$thanks_userid $rows_t["userid"];
    
$user_sql mysql_query("SELECT * FROM users where id=$thanks_userid");
    
$rows_a mysql_fetch_array($user_sql);
    
$username_t $rows_a["username"];
    
$thanksby =  $thanksby."<a href='userdetails.php?id=$thanks_userid'>$username_t</a>, ";
    }
    
$t_userid $CURUSER["id"];
    
$tsql mysql_query("SELECT COUNT(*) FROM thanks where nzbid=$nzbid and userid=$t_userid");
    
$trows mysql_fetch_array($tsql);
    
$t_ab $trows[0];
    if (
$t_ab == "0") {
    
$thanksby $thanksby." <form action=\"thanks.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Thanks!\">
<input type=\"hidden\" name=\"nzbid\" value=\"
$nzbid\">
</form>"
;
    }
    else {
    
$thanksby $thanksby." <form action=\"thanks.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Thanks!\" disabled>
<input type=\"hidden\" name=\"nzbid\" value=\"
$nzbid\">
</form>"
;
    }
    }
    else {
    
$thanksby "None yet 
    <form action=\"thanks.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Thanks!\">
<input type=\"hidden\" name=\"nzbid\" value=\"
$nzbid\">
</form>
    "
;
    }
        
tr("Thanks by:",$thanksby,1); 
then find :
PHP Code:
 if ($_GET["uploaded"]) {
  print(
"<h2>Successfully uploaded!</h2>\n"); 
add after
PHP Code:
 }
        elseif (
$_GET["rated"]) {
                print(
"<h2>Rating added!</h2>\n");
        }
        elseif (
$_GET["thanks"])
                print(
"<h2>Thanks added!</h2>\n"); 

see how much Thanks
Add this in userdetails.php
PHP Code:
$tnxres mysql_query("SELECT COUNT(*) FROM thanks WHERE userid = '$id'") or die(mysql_error());
$tnxarr mysql_fetch_row($tnxres);
  
$thanks $tnxarr[0];
print(
"<tr><td class=rowhead>Thanks for nzbs</td><td align=left>$thanks</td></tr>\n"); 
after

PHP Code:
print("<tr><td class=rowhead>Class</td><td align=left>" get_user_class_name($user["class"]) . "</td></tr>\n"); 
__________________
http://www.bvlist.com/images/avatars/signaturepics/sigpic16443_2.gif
Reply With Quote