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:
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:
Copy the following code:
Into torrents-details.php before this line:
Copy this code:
Into backend/cleanup.php in the most bottom place and before ?> copy this code:
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]
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! [<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! [<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 [<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! [<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! [<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 Reputation":"Subtract 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> <?=$user[reputation];?> </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> <?=$user[reputation];?> </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]