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
More Complex Reputations System
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2.08 Mods Completed

Unknown User
2013-03-09 18:37:25
With this system you can give or subtract reputation points, once a week if it is the same member (but of course you can change this value).

The member at which you give or or subtract one point of reputation will receive a PM with the reason (you must to write it) for this action.









Run into yor database:



CREATE TABLE IF NOT EXISTS `simpaty` (

 `id` int(10) unsigned NOT NULL auto_increment,

 `touserid` int(10) unsigned NOT NULL default '0',

 `fromuserid` int(10) unsigned NOT NULL default '0',

 `fromusername` varchar(40) NOT NULL default '',

 `bad` tinyint(1) unsigned NOT NULL default '0',

 `good` tinyint(1) unsigned NOT NULL default '0',

 `type` varchar(60) NOT NULL default '',

 `respect_time` datetime NOT NULL default '0000-00-00 00:00:00',

 `description` varchar(500) NOT NULL,

 PRIMARY KEY  (`id`),

 KEY `touserid` (`touserid`),

 KEY `fromuserid` (`fromuserid`),

 KEY `fromusername` (`fromusername`)

) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;



ALTER TABLE users ADD reputation varchar(6) NOT NULL default '0';

Create a new file called simpaty.php and upload it in your root:




<?

require_once("backend/functions.php");

dbconn();

loggedinonly();



   $return = $_SERVER['HTTP_REFERER'];

   $valid_actions = array('add');

   $action = ( in_array($_GET['action'], $valid_actions) ? $_GET['action'] : '');



   $tar = SQL_Query_exec("SELECT id, username, reputation FROM users WHERE id=".$_GET['targetid']);

   $user = mysql_fetch_array($tar);



   if ($action == 'add') {

       $current_time = get_date_time();

       $targetid = intval($_GET['targetid']);

       $resp_type = (isset($_GET['good'])?1:0);

       $type = $_GET['type'];



       $r = SQL_Query_exec('SELECT id FROM simpaty WHERE touserid=' . $targetid . ' AND type = ' . sqlesc($type) . ' AND fromuserid = ' . $CURUSER['id']);



       if (mysql_num_rows($r) == 1) {

           show_error_msg ("Error","<div style='margin-top:10px; margin-bottom:10px' align=center>You have already changed the Reputation of this member! &nbsp; [<a href='account-details.php?id=$targetid'>Go Back</a>]</div>", 1);

       }



       if ($CURUSER["warned"] == 'yes') {

           show_error_msg("Error", "<div style='margin-top:10px; margin-bottom:10px' align=center>You're warned and you cannot modify the reputation to other members! &nbsp; [<a href='account-details.php?id=$targetid'>Go Back</a>]</div>", 1);

       }



       if (!is_valid_id($targetid)) {

           show_error_msg("Error", "<div style='margin-top:10px; margin-bottom:10px' align=center>Incorrect ID: $targetid &nbsp; [<a href='account-details.php?id=$targetid'>Go Back</a>]</div>", 1);

       }



       if ($CURUSER["id"] == $targetid) {

           show_error_msg("Error","<div style='margin-top:10px; margin-bottom:10px' align=center>You cannot increases or subtracts your own reputation! &nbsp; [<a href='account-details.php?id=$targetid'>Go Back</a>]</div>", 1);

       }



       if (isset($_POST["description"]) && trim($_POST["description"]) == '') {

           show_error_msg("Error", "<div style='margin-top:10px; margin-bottom:10px' align=center>The message cannot be empty! &nbsp; [<a href='account-details.php?id=$targetid'>Go Back</a>]</div>", 1);

       }



       if (!isset($_POST["description"])) {

           show_error_msg(($resp_type == 1?"Give":"Subtract")." one point of Reputation","<div style='margin-top:20px; margin-bottom:20px' align=center>

           <div style='margin-bottom:10px'>Write the Reason for which you want to ".($resp_type == 1?"give reputation to":"subtract reputation from")." <a href='account-details.php?id=$targetid'>".class_user($user[username])."</a> <i>(a PM will be send)</i></div>

           <form action="" . $_SERVER["PHP_SELF"] . "?action=add&" . ($resp_type == 1?'good':'bad') . "&type=$type&targetid=$targetid" method="post">

           <div style='margin-bottom:2px'><textarea cols=80 rows=4 name=description></textarea></div>"."

           <div style='margin-bottom:12px'>n <i>".sprintf(T_("MAX_CHARS"), 500)." " . T_("HTML_NOT_ALLOWED") . "</i></div>

           <input type=submit value=".($resp_type == 1?"Give&nbsp;Reputation":"Subtract&nbsp;Reputation")."></form></div>", 1);

       }



       SQL_Query_exec ('INSERT INTO simpaty VALUES (0, ' . $targetid . ', ' . $CURUSER['id'] . ', ' . sqlesc($CURUSER['username']) . ', ' . ($resp_type==0?1:0) . ', ' . ($resp_type==1?1:0) . ', ' . sqlesc($type) . ', ' . sqlesc($current_time) . ', ' . sqlesc($_POST["description"]) . ')');



       if ($resp_type == 1) {

           SQL_Query_exec('UPDATE users SET reputation = reputation + 1 WHERE id = ' . $targetid);

       } else {

           SQL_Query_exec('UPDATE users SET reputation = reputation - 1 WHERE id = ' . $targetid);

       }

       $msg = sqlesc("[url=".%24site_config%5B"]."/account-details.php?id=".$CURUSER['id']."]".$CURUSER['username']."[/url] has " . ($resp_type == 1?'added one point to':'subtracted one point from') . " your reputation with the following message:nn
Quote:
".$_POST["description"]."
");



       SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster, subject) VALUES (0, $targetid, NOW(), $msg, 0, "Has been made a change in your reputation!")");



       stdhead(($resp_type == 1?"Good":"Bad") . " Reputation it is added");

       autolink("account-details.php?id=$targetid", "<div style='margin-top:10px; margin-bottom:10px' align=center>You have successfully ".($resp_type == 1?"gave one point of reputation to":"subtracted one point of reputation from")." ".class_user($user[username])."</div>");

   }



stdfoot();

?>

[/code]


If you don't have class_user function replace: ".class_user($user[username])." with ".$user[username]." otherwise you will get a error.



Into account-details.php after this line:




Forum Posts: <?php echo number_format($numforumposts); ?><br />




Copy the following code:




   <!--| Start Reputation Points |-->

   <table cellpadding="4">

     <tr class="f-border comment">

       <? #---| config

       $width = "16";

       $height = "16";

       $textsize = "2";

       $picthumbsgood = "images/reputation/good.png";

       $picthumbsbad = "images/reputation/bad.png";

       if ($user[reputation] == "0") { $color = "#2B2525"; }

       elseif ($user[reputation] > "0") { $color = "#209200"; }

       elseif ($user[reputation] < "0") { $color = "#B50000"; }

       ?>

       <td>Reputatation:</td>

       <?php if ($user["id"] != $CURUSER['id']) { ?>

         <td width="20" align="center"><a href="simpaty.php?action=add&good&targetid=<?=$user["id"];?>"><img src="<?=$picthumbsgood;?>" width="<?=$width;?>" height="<?=$height;?>" border="0" title="Give one point"></a></td>

       <?php } ?>

       <td bgcolor="<?=$color;?>" height="16" align="center"><font size="<?=$textsize;?>" color="#FEFEFE"><b>&nbsp; <?=$user[reputation];?> &nbsp;</b></font></td>

       <?php if ($user["id"] != $CURUSER['id']) { ?>

         <td width="20" align="center"><a href="simpaty.php?action=add&bad&targetid=<?=$user["id"];?>"><img src="<?=$picthumbsbad;?>" width="<?=$width;?>" height="<?=$height;?>" border="0" title="Subtract one point"></a></td>

       <?php } ?>

     </tr>

   </table>

   <!--| End Reputation Points |-->






Into torrents-details.php before this line:




echo "<fieldset class='download'><legend><b>Details</b></legend>";




Copy this code:




//===| Start Reputation Points |===//

$rep = SQL_Query_exec("SELECT id,reputation FROM users WHERE id=".$row["owner"]);

$user = mysql_fetch_array($rep);

   if ($user["id"] != $CURUSER['id'] && $row["anon"] != "yes") {

     #---| config

     $width = "16";

     $height = "16";

     $textsize = "2";

     $picthumbsgood = "images/reputation/good.png";

     if ($user[reputation] == "0") { $color = "#2B2525"; }

     elseif ($user[reputation] > "0") { $color = "#209200"; }

     elseif ($user[reputation] < "0") { $color = "#B50000"; }

     ?>

     <table cellpadding="4" align="center">

       <tr class="f-border comment">

         <td>Uploader Reputatation:</td>

         <td bgcolor="<?=$color;?>" height="16" align="center"><font size="<?=$textsize;?>" color="#FEFEFE"><b>&nbsp; <?=$user[reputation];?> &nbsp;</b></font></td>

         <td>Say <b>Thanks</b> with one point of reputation:</td>

         <td width="20" align="center"><a href="simpaty.php?action=add&good&targetid=<?=$user["id"];?>"><img src="<?=$picthumbsgood;?>" width="<?=$width;?>" height="<?=$height;?>" border="0" title="Give one point"></a></td>

       </tr>

       <tr><td height="5"></td></tr><!--| 5px space here! |-->

     </table>

     <?php

   }

//===| End Reputation Points |===//






Into backend/cleanup.php in the most bottom place and before ?> copy this code:




   //===| Delete the old recordings of reputation

   //number of days after which a member can give again reputation to same user

   $delaytime = 7*86400; //days in seconds (default 7 days)

   $delayed = sqlesc(get_date_time(gmtime() - $delaytime));

   SQL_Query_exec("DELETE FROM simpaty WHERE respect_time < $delayed");

   //===| End




Extracts the attached archive and upload reputation folder into images directory.

[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6636"]reputation.zip[/url]
reputation.zip
Download
Unknown User
2013-03-10 05:07:12
i got DB error and i can't view in torrent-details.php that is the error i got





Database Error in simpaty.php on line 10: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1. Query was: SELECT id, username, reputation FROM users WHERE id=.

Unknown User
2013-03-10 05:18:40
You did something wrong somewhere, send your files and I will check them.
Unknown User
2013-03-10 05:43:54
ok i sent it i run the SQL works and i add it the code into the clean up account-details works but torrent-details nothing showing

[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6637"]account-details.php[/url]

[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6638"]simpaty.php[/url]

[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6639"]torrents-details.php[/url]
account-details.php
Download
simpaty.php
Download
torrents-details.php
Download
Unknown User
2013-03-10 06:05:11
EZEL, delete what you posted, make a zip archive with these files and attach it to your post.

This is the best way to do the job without any error...
Unknown User
2013-03-10 06:21:15
done mate i upload it above thanks for the help
Unknown User
2013-03-10 06:59:51
Ok mate, try these files and I hope that you have created the table 'simpaty' into your database...

[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6640"]rep-files.zip[/url]
rep-files.zip
Download
Unknown User
2013-03-10 08:25:03
it didn't work mate only on torrent detail its not showing what ever you have in the img on the first post
Unknown User
2013-03-10 09:27:27
Your torrents-details is heavily modified and I don't have time to find this problem...

However, I added this part as a supplement, waived to her.
Unknown User
2013-03-10 11:15:23
its really nice work and thanks for that i hope some 1 can help me with it but yeah keep up the good work :D
Unknown User
2013-03-11 08:06:14
sql query inserting messages AND autolink function are wrong, chek this :



$msg = sqlesc("[url=".%24site_config%5B"]."/account-details.php?id=".$CURUSER['id']."]".$CURUSER['username']."[/url] has " . ($resp_type == 1?'added one point to':'subtracted one point from') . " your reputation with the following message:nn
Quote:
".$_POST["description"]."
");

$subject = "Has been made a change in your reputation !";

$status = "no";

$to = "in";

SQL_Query_exec("INSERT INTO messages (sender, receiver, added, subject, msg, unread, location)

VALUES ('$CURUSER[id]', '$targetid', '".get_date_time()."', '$subject', $msg, '$status', '$to')");  

autolink("account-details.php?id=$targetid", "reputation points updated ... Redirecting you to Uploader Account ...");

[/code]

this way its working ... nice mod ;)
Unknown User
2013-03-12 08:23:32
mine it dosen't show in torrent details strange
Unknown User
2013-03-16 19:05:13
try this for torrent details

//===| Start Reputation Points |===//

$rep = SQL_Query_exec("SELECT id,reputation FROM users WHERE id=".$row["owner"]);

$user = mysql_fetch_array($rep);

   if ($user["id"] != $CURUSER['id'] && $row["anon"] != "yes") {

 #---| config

 $width = "16";

 $height = "16";

 $textsize = "2";

 $picthumbsgood = "images/reputation/good.png";

 if ($user[reputation] == "0") { $color = "#2B2525"; }

 elseif ($user[reputation] > "0") { $color = "#209200"; }

 elseif ($user[reputation] < "0") { $color = "#B50000"; }

 ?>

 <table cellpadding="4" align="center">

   <tr class="f-border comment">

 <td>Uploader Reputatation:</td>

 <td bgcolor="<?php echo $color;?>" height="16" align="center"><font size="<?php echo $textsize;?>" color="#FEFEFE"><b>&nbsp; <?php echo $user[reputation];?> &nbsp;</b></font></td>

 <td>Say <b>Thanks</b> with one point of reputation:</td>

 <td width="20" align="center"><a href="simpaty.php?action=add&good&targetid=<?php echo $user["id"];?>"><img src="<?php echo $picthumbsgood;?>" width="<?php echo $width;?>" height="<?php echo $height;?>" border="0" title="Give one point"></a></td>

   </tr>

   <tr><td height="5"></td></tr><!--| 5px space here! |-->

 </table>

 <?php

   }

//===| End Reputation Points |===//
Unknown User
2013-03-17 02:23:06
not showing not all it show only on the account details and works great but ont torrent details nothing showing there at all
Unknown User
2013-03-17 08:47:09
it does work you just cant see it yourself lol log in with another account and look again ;)
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