با درود دوستان گرامی
با استفاده از این هک میتوانید سیستم امتیاز دهی به مطالب را به صورت منفی یا مثبت در بیارید . به این صورت که بازدید کنندگان به مطالب شما رای مثبت یا منفی میدهند و این رای ها همانجا به نمایش در میاید . یعنی اگر 10 نفر به مطلب شما رای مثبت و 3 نفر رای منفی بدهند عددی که نمایش داده میشه 7 است . که در بعضی جاها خیلی بهتر از سیستم فعلی امتیاز دهی است .
ابتدا فایل زیر را دانلود کنید و فایلها را در محل خودش کپی کنید
download
حال فایل /engine/ajax/rating.php را باز کنید و به دنبال کد زیر بگردید
if ($go_rate > 5 OR $go_rate < 1) $go_rate = 0;
if (!$go_rate OR !$news_id) die ("Hacking attempt!");
if (!$go_rate OR !$news_id) die ("Hacking attempt!");
کدی را که پیدا کردید کاملا پاک کنید
در همین فایل به دنبال کد زیر بگردید
if (!$is_logged) $member_id['user_group'] = 5;
if (!$user_group[$member_id['user_group']]['allow_rating']) die ("Hacking attempt!");
$_IP = $db->safesql($_SERVER['REMOTE_ADDR']);
if ($is_logged) $where = "member = '{$member_id['name']}'";
else $where = "ip ='{$_IP}'";
$row = $db->super_query("SELECT news_id FROM " . PREFIX . "_logs where news_id ='$news_id' AND {$where}");
if (!$row['news_id']){
$db->query("UPDATE " . PREFIX . "_post set rating=rating+'$go_rate', vote_num=vote_num+1 where id ='$news_id'");
if ($is_logged) $user_name = $member_id['name'];
else $user_name = "noname";
$db->query("INSERT INTO " . PREFIX . "_logs (news_id, ip, member) values ('$news_id', '$_IP', '$user_name')");
}
$row = $db->super_query("SELECT id, rating, vote_num FROM " . PREFIX . "_post where id ='$news_id'");
if ($_REQUEST['mode'] == "short") {
$buffer = ShortRating ($row['id'], $row['rating'], $row['vote_num'], false);
} else {
$buffer = ShowRating ($row['id'], $row['rating'], $row['vote_num'], false);
}
$db->close();
@header("Content-type: text/css; charset=".$config['charset']);
echo $buffer;
if (!$user_group[$member_id['user_group']]['allow_rating']) die ("Hacking attempt!");
$_IP = $db->safesql($_SERVER['REMOTE_ADDR']);
if ($is_logged) $where = "member = '{$member_id['name']}'";
else $where = "ip ='{$_IP}'";
$row = $db->super_query("SELECT news_id FROM " . PREFIX . "_logs where news_id ='$news_id' AND {$where}");
if (!$row['news_id']){
$db->query("UPDATE " . PREFIX . "_post set rating=rating+'$go_rate', vote_num=vote_num+1 where id ='$news_id'");
if ($is_logged) $user_name = $member_id['name'];
else $user_name = "noname";
$db->query("INSERT INTO " . PREFIX . "_logs (news_id, ip, member) values ('$news_id', '$_IP', '$user_name')");
}
$row = $db->super_query("SELECT id, rating, vote_num FROM " . PREFIX . "_post where id ='$news_id'");
if ($_REQUEST['mode'] == "short") {
$buffer = ShortRating ($row['id'], $row['rating'], $row['vote_num'], false);
} else {
$buffer = ShowRating ($row['id'], $row['rating'], $row['vote_num'], false);
}
$db->close();
@header("Content-type: text/css; charset=".$config['charset']);
echo $buffer;
حالا تمام کدهای زیر به جای کد بالایی قرار دهید .
/* P30-World Team Rating Start */
check_xss ();
if ( !is_numeric( $_REQUEST['go_rate'] ) OR !is_numeric ( $_REQUEST['news_id'] ))
{
die ( "error" );
}
check_xss ();
if ( !is_numeric( $_REQUEST['go_rate'] ) OR !is_numeric ( $_REQUEST['news_id'] ))
{
die ( "error" );
}
$go_rate = intval($_REQUEST['go_rate']);
$news_id = intval($_REQUEST['news_id']);
if ( $go_rate > 1 OR $go_rate < -1 OR $go_rate == 0 )
{
die ( "error" );
}
if (!$go_rate OR !$news_id) die ("error");
$_IP = $db->safesql($_SERVER['REMOTE_ADDR']);
if ($is_logged) $where = "member = '{$member_id['name']}'";
else $where = "ip ='{$_IP}'";
$row = $db->super_query("SELECT news_id FROM " . PREFIX . "_logs where news_id ='$news_id' AND {$where}");
if (!$row['news_id']){
$db->query("UPDATE " . PREFIX . "_post set rating=rating+'$go_rate', vote_num=vote_num+1 where id ='$news_id'");
if ($is_logged) $user_name = $member_id['name'];
else $user_name = "noname";
$db->query("INSERT INTO " . PREFIX . "_logs (news_id, ip, member) values ('$news_id', '$_IP', '$user_name')");
}
$row = $db->super_query("SELECT id, rating, vote_num FROM " . PREFIX . "_post where id ='$news_id'");
if ($_REQUEST['mode'] == "short") {
$buffer = ShortRating ($row['id'], $row['rating'], $row['vote_num'], false);
} else {
$buffer = ShowRating ($row['id'], $row['rating'], $row['vote_num'], false);
}
@header("HTTP/1.0 200 OK");
@header("HTTP/1.1 200 OK");
@header("Cache-Control: no-cache, must-revalidate, max-age=0");
@header("Expires: 0");
@header("Pragma: no-cache");
@header("Content-type: text/css; charset=".$config['charset']);
echo $buffer;
/* P30-World Team Rating End */
check_xss ();
if ( !is_numeric( $_REQUEST['go_rate'] ) OR !is_numeric ( $_REQUEST['news_id'] ))
{
die ( "error" );
}
check_xss ();
if ( !is_numeric( $_REQUEST['go_rate'] ) OR !is_numeric ( $_REQUEST['news_id'] ))
{
die ( "error" );
}
$go_rate = intval($_REQUEST['go_rate']);
$news_id = intval($_REQUEST['news_id']);
if ( $go_rate > 1 OR $go_rate < -1 OR $go_rate == 0 )
{
die ( "error" );
}
if (!$go_rate OR !$news_id) die ("error");
$_IP = $db->safesql($_SERVER['REMOTE_ADDR']);
if ($is_logged) $where = "member = '{$member_id['name']}'";
else $where = "ip ='{$_IP}'";
$row = $db->super_query("SELECT news_id FROM " . PREFIX . "_logs where news_id ='$news_id' AND {$where}");
if (!$row['news_id']){
$db->query("UPDATE " . PREFIX . "_post set rating=rating+'$go_rate', vote_num=vote_num+1 where id ='$news_id'");
if ($is_logged) $user_name = $member_id['name'];
else $user_name = "noname";
$db->query("INSERT INTO " . PREFIX . "_logs (news_id, ip, member) values ('$news_id', '$_IP', '$user_name')");
}
$row = $db->super_query("SELECT id, rating, vote_num FROM " . PREFIX . "_post where id ='$news_id'");
if ($_REQUEST['mode'] == "short") {
$buffer = ShortRating ($row['id'], $row['rating'], $row['vote_num'], false);
} else {
$buffer = ShowRating ($row['id'], $row['rating'], $row['vote_num'], false);
}
@header("HTTP/1.0 200 OK");
@header("HTTP/1.1 200 OK");
@header("Cache-Control: no-cache, must-revalidate, max-age=0");
@header("Expires: 0");
@header("Pragma: no-cache");
@header("Content-type: text/css; charset=".$config['charset']);
echo $buffer;
/* P30-World Team Rating End */
حالا فایل /engine/modules/functions.php را باز کنید و به دنبال کد زیر بگردید
function ShowRating ($id, $rating, $vote_num, $allow = true){
global $lang;
if ($rating) $rating = round(($rating / $vote_num), 0); else $rating = 0;
$rating = $rating * 17;
if (!$allow) {
$rated = <<<HTML
<div class="rating" style="float:right;">
<ul class="unit-rating">
<li class="current-rating" style="width:{$rating}px;">{$rating}</li>
</ul>
</div><div class="rating" style="float:right; padding-top:2px;"> ({$lang['voten']} {$vote_num})</div>
HTML;
return $rated;
}
$rated .= <<<HTML
<div id='ratig-layer'><div class="rating" style="float:right;">
<ul class="unit-rating">
<li class="current-rating" style="width:{$rating}px;">{$rating}</li>
<li><a href="#" title="{$lang['useless']}" class="r1-unit" onclick="doRate('1', '{$id}'); return false;">1</a></li>
<li><a href="#" title="{$lang['poor']}" class="r2-unit" onclick="doRate('2', '{$id}'); return false;">2</a></li>
<li><a href="#" title="{$lang['fair']}" class="r3-unit" onclick="doRate('3', '{$id}'); return false;">3</a></li>
<li><a href="#" title="{$lang['good']}" class="r4-unit" onclick="doRate('4', '{$id}'); return false;">4</a></li>
<li><a href="#" title="{$lang['excellent']}" class="r5-unit" onclick="doRate('5', '{$id}'); return false;">5</a></li>
</ul>
</div><div class="rating" style="float:right; padding-top:2px;"> ({$lang['voten']} {$vote_num})</div></div>
HTML;
return $rated;
}
global $lang;
if ($rating) $rating = round(($rating / $vote_num), 0); else $rating = 0;
$rating = $rating * 17;
if (!$allow) {
$rated = <<<HTML
<div class="rating" style="float:right;">
<ul class="unit-rating">
<li class="current-rating" style="width:{$rating}px;">{$rating}</li>
</ul>
</div><div class="rating" style="float:right; padding-top:2px;"> ({$lang['voten']} {$vote_num})</div>
HTML;
return $rated;
}
$rated .= <<<HTML
<div id='ratig-layer'><div class="rating" style="float:right;">
<ul class="unit-rating">
<li class="current-rating" style="width:{$rating}px;">{$rating}</li>
<li><a href="#" title="{$lang['useless']}" class="r1-unit" onclick="doRate('1', '{$id}'); return false;">1</a></li>
<li><a href="#" title="{$lang['poor']}" class="r2-unit" onclick="doRate('2', '{$id}'); return false;">2</a></li>
<li><a href="#" title="{$lang['fair']}" class="r3-unit" onclick="doRate('3', '{$id}'); return false;">3</a></li>
<li><a href="#" title="{$lang['good']}" class="r4-unit" onclick="doRate('4', '{$id}'); return false;">4</a></li>
<li><a href="#" title="{$lang['excellent']}" class="r5-unit" onclick="doRate('5', '{$id}'); return false;">5</a></li>
</ul>
</div><div class="rating" style="float:right; padding-top:2px;"> ({$lang['voten']} {$vote_num})</div></div>
HTML;
return $rated;
}
سپس کد زیر را به جای کد بالایی قرار دهید
/* P30-World Team Rating Start */
function ShowRating ($id, $rating, $vote_num, $allow = true){
global $is_logged, $member_id, $config, $lang, $db;
if ($rating) $rating = round($rating, 0); else $rating = 0;
if (!$allow) {
$rated = <<<HTML
<div class="rating" style="float:left;">
<span><em><b>{$rating}</b></em></span>
</div>
HTML;
return $rated;
}
$rated .= <<<HTML
<span id='ratig-layer-{$id}'>
<div class="rating">
<div id='ratig-layer'>
<div class="plus">
<a href="#" title="+" class="r2-unit" onclick="doRate('1', '{$id}'); return false;"><em></em></a></div>
<div class="minus">
<a href="#" title="-" class="r1-unit" onclick="doRate('-1', '{$id}'); return false;"><em></em></a></div>
<span><em><b>{$rating}</b></em></span>
</div></div></span>
HTML;
return $rated;
}
/* P30-World Team Rating End */
function ShowRating ($id, $rating, $vote_num, $allow = true){
global $is_logged, $member_id, $config, $lang, $db;
if ($rating) $rating = round($rating, 0); else $rating = 0;
if (!$allow) {
$rated = <<<HTML
<div class="rating" style="float:left;">
<span><em><b>{$rating}</b></em></span>
</div>
HTML;
return $rated;
}
$rated .= <<<HTML
<span id='ratig-layer-{$id}'>
<div class="rating">
<div id='ratig-layer'>
<div class="plus">
<a href="#" title="+" class="r2-unit" onclick="doRate('1', '{$id}'); return false;"><em></em></a></div>
<div class="minus">
<a href="#" title="-" class="r1-unit" onclick="doRate('-1', '{$id}'); return false;"><em></em></a></div>
<span><em><b>{$rating}</b></em></span>
</div></div></span>
HTML;
return $rated;
}
/* P30-World Team Rating End */
در همین فایل به دنبال کد زیر بگردید
function ShortRating ($id, $rating, $vote_num, $allow = true){
global $lang;
if ($rating) $rating = round(($rating / $vote_num), 0); else $rating = 0;
$rating = $rating * 17;
if (!$allow) {
$rated = <<<HTML
<div class="rating" style="float:right;">
<ul class="unit-rating">
<li class="current-rating" style="width:{$rating}px;">{$rating}</li>
</ul>
</div>
HTML;
return $rated;
}
$rated = "<span id='ratig-layer-".$id."'>";
$rated .= <<<HTML
<div class="rating" style="float:right;">
<ul class="unit-rating">
<li class="current-rating" style="width:{$rating}px;">{$rating}</li>
<li><a href="#" title="{$lang['useless']}" class="r1-unit" onclick="dleRate('1', '{$id}'); return false;">1</a></li>
<li><a href="#" title="{$lang['poor']}" class="r2-unit" onclick="dleRate('2', '{$id}'); return false;">2</a></li>
<li><a href="#" title="{$lang['fair']}" class="r3-unit" onclick="dleRate('3', '{$id}'); return false;">3</a></li>
<li><a href="#" title="{$lang['good']}" class="r4-unit" onclick="dleRate('4', '{$id}'); return false;">4</a></li>
<li><a href="#" title="{$lang['excellent']}" class="r5-unit" onclick="dleRate('5', '{$id}'); return false;">5</a></li>
</ul>
</div>
HTML;
$rated .= "</span>";
return $rated;
}
global $lang;
if ($rating) $rating = round(($rating / $vote_num), 0); else $rating = 0;
$rating = $rating * 17;
if (!$allow) {
$rated = <<<HTML
<div class="rating" style="float:right;">
<ul class="unit-rating">
<li class="current-rating" style="width:{$rating}px;">{$rating}</li>
</ul>
</div>
HTML;
return $rated;
}
$rated = "<span id='ratig-layer-".$id."'>";
$rated .= <<<HTML
<div class="rating" style="float:right;">
<ul class="unit-rating">
<li class="current-rating" style="width:{$rating}px;">{$rating}</li>
<li><a href="#" title="{$lang['useless']}" class="r1-unit" onclick="dleRate('1', '{$id}'); return false;">1</a></li>
<li><a href="#" title="{$lang['poor']}" class="r2-unit" onclick="dleRate('2', '{$id}'); return false;">2</a></li>
<li><a href="#" title="{$lang['fair']}" class="r3-unit" onclick="dleRate('3', '{$id}'); return false;">3</a></li>
<li><a href="#" title="{$lang['good']}" class="r4-unit" onclick="dleRate('4', '{$id}'); return false;">4</a></li>
<li><a href="#" title="{$lang['excellent']}" class="r5-unit" onclick="dleRate('5', '{$id}'); return false;">5</a></li>
</ul>
</div>
HTML;
$rated .= "</span>";
return $rated;
}
این کد را با کد زیر جایگزین کنید
/* P30-World Team Rating Start */
function ShortRating ($id, $rating, $vote_num, $allow = true){
global $config, $lang;
if ($rating) $rating = round($rating, 0); else $rating = 0;
if (!$allow) {
$rated = <<<HTML
<div class="rating" style="float:left;">
<span><em><b>{$rating}</b></em></span>
</div>
HTML;
return $rated;
}
$rated = "<span id='ratig-layer-".$id."'>";
$rated .= <<<HTML
<div class="rating">
<div class="plus">
<a href="#" title="+" class="r2-unit" onclick="dleRate('1', '{$id}'); return false;"><em></em></a></div>
<div class="minus">
<a href="#" title="-" class="r1-unit" onclick="dleRate('-1', '{$id}'); return false;"><em></em></a></div>
<span><em><b>{$rating}</b></em></span>
</div>
HTML;
$rated .= "</span>";
return $rated;
}
/* P30-World Team Rating End */
function ShortRating ($id, $rating, $vote_num, $allow = true){
global $config, $lang;
if ($rating) $rating = round($rating, 0); else $rating = 0;
if (!$allow) {
$rated = <<<HTML
<div class="rating" style="float:left;">
<span><em><b>{$rating}</b></em></span>
</div>
HTML;
return $rated;
}
$rated = "<span id='ratig-layer-".$id."'>";
$rated .= <<<HTML
<div class="rating">
<div class="plus">
<a href="#" title="+" class="r2-unit" onclick="dleRate('1', '{$id}'); return false;"><em></em></a></div>
<div class="minus">
<a href="#" title="-" class="r1-unit" onclick="dleRate('-1', '{$id}'); return false;"><em></em></a></div>
<span><em><b>{$rating}</b></em></span>
</div>
HTML;
$rated .= "</span>";
return $rated;
}
/* P30-World Team Rating End */
حالا فایل /templates/Default/css/style.css را باز کرده و کد زیر را در اخر فایل اضافه کنید
/* P30-World Team Rating Start */
.plus a {
display:block;
float:right;
margin-right:5px;
width:31px;
height:16px;
cursor:pointer;
cursor:hand;
text-decoration:none;
color:#cecece !important;
background:url(../dleimages/positive-1.png) no-repeat 0 0;
margin-top:31px;
}
.plus a:hover {
color:#666 !important;
background-image:url(../dleimages/positive-2.png);
}
.rating em {
display:block;
top:50%;
margin-top:-0.6em;
text-align:center;
font-style:normal;
font-weight:normal;
position:relative;
line-height:120%;
}
.rating span {
display:block;
top:50%;
width:68px;
height:47px;
overflow:hidden;
text-align:center;
color:#9c9c9c;
background:url(../dleimages/rating.png) no-repeat 0 0;
margin:0;
height:47px;
cursor:default;
}
.minus a {
display:block;
float:right;
margin-right:5px;
width:31px;
height:16px;
cursor:pointer;
cursor:hand;
text-decoration:none;
color:#cecece !important;
background:url(../dleimages/negative-1.png) no-repeat 0 0;
margin-top:31px;
}
.minus a:hover {
color:#666 !important;
background-image:url(../dleimages/negative-2.png);
}
/* P30-World Team Rating End */
.plus a {
display:block;
float:right;
margin-right:5px;
width:31px;
height:16px;
cursor:pointer;
cursor:hand;
text-decoration:none;
color:#cecece !important;
background:url(../dleimages/positive-1.png) no-repeat 0 0;
margin-top:31px;
}
.plus a:hover {
color:#666 !important;
background-image:url(../dleimages/positive-2.png);
}
.rating em {
display:block;
top:50%;
margin-top:-0.6em;
text-align:center;
font-style:normal;
font-weight:normal;
position:relative;
line-height:120%;
}
.rating span {
display:block;
top:50%;
width:68px;
height:47px;
overflow:hidden;
text-align:center;
color:#9c9c9c;
background:url(../dleimages/rating.png) no-repeat 0 0;
margin:0;
height:47px;
cursor:default;
}
.minus a {
display:block;
float:right;
margin-right:5px;
width:31px;
height:16px;
cursor:pointer;
cursor:hand;
text-decoration:none;
color:#cecece !important;
background:url(../dleimages/negative-1.png) no-repeat 0 0;
margin-top:31px;
}
.minus a:hover {
color:#666 !important;
background-image:url(../dleimages/negative-2.png);
}
/* P30-World Team Rating End */
سپس فایل /templates/Default/css/engine.css را باز کرده و به دنبال کد زیر بگردید
.rating {
color: #757575;
font-size: 11px; /* ! */
font-family: tahoma; /* ! */
width: 85px;
height: 16px;
}
.unit-rating {
list-style: none;
margin: 0px;
padding: 0px;
width: 85px;
height: 16px;
position: relative;
background-image: url(../dleimages/rating.gif);
background-position: top left;
background-repeat: repeat-x;
}
.unit-rating li {
text-indent: -90000px;
padding: 0px;
margin: 0px;
float: left;
}
.unit-rating li a {
display: block;
width: 17px;
height: 16px;
text-decoration: none;
text-indent: -9000px;
z-index: 17;
position: absolute;
padding: 0px;
}
.unit-rating li a:hover {
background-image: url(../dleimages/rating.gif);
background-position: left center;
z-index: 2;
left: 0px;
}
.unit-rating a.r1-unit { left: 0px; }
.unit-rating a.r1-unit:hover { width: 17px; }
.unit-rating a.r2-unit { left: 17px; }
.unit-rating a.r2-unit:hover { width: 34px; }
.unit-rating a.r3-unit { left: 34px; }
.unit-rating a.r3-unit:hover { width: 51px; }
.unit-rating a.r4-unit { left: 51px; }
.unit-rating a.r4-unit:hover { width: 68px; }
.unit-rating a.r5-unit { left: 68px; }
.unit-rating a.r5-unit:hover { width: 85px; }
.unit-rating li.current-rating {
background-image: url(../dleimages/rating.gif);
background-position: left bottom;
position: absolute;
height: 16px;
display: block;
text-indent: -9000px;
z-index: 1;
}
color: #757575;
font-size: 11px; /* ! */
font-family: tahoma; /* ! */
width: 85px;
height: 16px;
}
.unit-rating {
list-style: none;
margin: 0px;
padding: 0px;
width: 85px;
height: 16px;
position: relative;
background-image: url(../dleimages/rating.gif);
background-position: top left;
background-repeat: repeat-x;
}
.unit-rating li {
text-indent: -90000px;
padding: 0px;
margin: 0px;
float: left;
}
.unit-rating li a {
display: block;
width: 17px;
height: 16px;
text-decoration: none;
text-indent: -9000px;
z-index: 17;
position: absolute;
padding: 0px;
}
.unit-rating li a:hover {
background-image: url(../dleimages/rating.gif);
background-position: left center;
z-index: 2;
left: 0px;
}
.unit-rating a.r1-unit { left: 0px; }
.unit-rating a.r1-unit:hover { width: 17px; }
.unit-rating a.r2-unit { left: 17px; }
.unit-rating a.r2-unit:hover { width: 34px; }
.unit-rating a.r3-unit { left: 34px; }
.unit-rating a.r3-unit:hover { width: 51px; }
.unit-rating a.r4-unit { left: 51px; }
.unit-rating a.r4-unit:hover { width: 68px; }
.unit-rating a.r5-unit { left: 68px; }
.unit-rating a.r5-unit:hover { width: 85px; }
.unit-rating li.current-rating {
background-image: url(../dleimages/rating.gif);
background-position: left bottom;
position: absolute;
height: 16px;
display: block;
text-indent: -9000px;
z-index: 1;
}
کد زیر را به جای کد بالایی قرار دهید
/* P30-World Team Rating Start */
.rating {
color: #757575;
font-size: 11px; /* ! */
font-family: tahoma; /* ! */
width: 150px;
height: 50px;
}
/* P30-World Team Rating End */
.rating {
color: #757575;
font-size: 11px; /* ! */
font-family: tahoma; /* ! */
width: 150px;
height: 50px;
}
/* P30-World Team Rating End */
نصب هک تمام شد . اگر مشکلی داشتید در خدمتم