menu_bgservdownloadthemesdirforumhome
Smf عربى



عرض المشاركات

هنا يمكنك مشاهدة جميع المشاركات التى كتبها هذا العضو . لاحظ انه يمكنك فقط مشاهدة المشاركات التى كتبها فى الاقسام التى يسمح لك بدخولها فقط .


مواضيع - Mr. Anaboussi

صفحات: [1]
1
قسم الدعم الخاص بالنسخة (Smf (1.1.X / error in karma.php
« في: 13 , يوليو, 2009 - 01:28:42 مسائاً »
اكتير جربت بمود الكارمات المحدودة  بس شكلو ما رح يظبط دائما عم يعطي خطأ رغم اني عدلت يدويا عليه بس ماعم يظبط

بتمنى حدا اجربلي ياه وشفلي المشكلة وين

./
Sources/Karma.php
Find:
شفرة: [اختيار]
// The user ID _must_ be a number, no matter what.
$_REQUEST['uid'] = (int) $_REQUEST['uid'];

Add Before:
شفرة: [اختيار]
// Get the PM or Post that we have to record that this Karma has been given to...
if(!empty($_REQUEST['m'])
&& LimitKarma_message_exists((int) $_REQUEST['m'], 'm'))
{
$message_id = (int) $_REQUEST['m'];
$type = 'm';
}
elseif(!empty($_REQUEST['pm'])
&& LimitKarma_message_exists((int) $_REQUEST['pm'], 'pm'))
{
$message_id = (int) $_REQUEST['pm'];
$type = 'pm';
}
// Otherwise, show an error message.
else
fatal_lang_error('LimitKarma_error2', false);



Find:
شفرة: [اختيار]
// They haven't, not before now, anyhow.
if (empty($action) || empty($modSettings['karmaWaitTime']))
{
// Put it in the log.
db_query("
REPLACE INTO {$db_prefix}log_karma
(action, ID_TARGET, ID_EXECUTOR, logTime)
VALUES ($dir, $_REQUEST[uid], $ID_MEMBER, " . time() . ')', __FILE__, __LINE__);

// Change by one.
updateMemberData($_REQUEST['uid'], array($dir == 1 ? 'karmaGood' : 'karmaBad' => '+'));
}
else
{
// If you are gonna try to repeat.... don't allow it.
if ($action == $dir)
fatal_error($txt['smf62'] . ' ' . $modSettings['karmaWaitTime'] . ' ' . $txt[578] . '.', false);

// You decided to go back on your previous choice?
db_query("
UPDATE {$db_prefix}log_karma
SET action = $dir, logTime = " . time() . "
WHERE ID_TARGET = $_REQUEST[uid]
AND ID_EXECUTOR = $ID_MEMBER
LIMIT 1", __FILE__, __LINE__);

// It was recently changed the OTHER way... so... reverse it!
if ($dir == 1)
updateMemberData($_REQUEST['uid'], array('karmaGood' => '+', 'karmaBad' => '-'));
else
updateMemberData($_REQUEST['uid'], array('karmaBad' => '+', 'karmaGood' => '-'));
}

Replace With:
شفرة: [اختيار]
// Is the user not limited by the Limit Karma Mod?
if(!is_LimitedByKarma($message_id, $type))
{
// They haven't, not before now, anyhow.
if (empty($action) || empty($modSettings['karmaWaitTime']))
{
// Put it in the log.
db_query("
REPLACE INTO {$db_prefix}log_karma
(action, ID_TARGET, ID_EXECUTOR, logTime)
VALUES ($dir, $_REQUEST[uid], $ID_MEMBER, " . time() . ')', __FILE__, __LINE__);

// Change by one.
updateMemberData($_REQUEST['uid'], array($dir == 1 ? 'karmaGood' : 'karmaBad' => '+'));
}
else
{
// If you are gonna try to repeat.... don't allow it.
if ($action == $dir)
fatal_error($txt['smf62'] . ' ' . $modSettings['karmaWaitTime'] . ' ' . $txt[578] . '.', false);

// You decided to go back on your previous choice?
db_query("
UPDATE {$db_prefix}log_karma
SET action = $dir, logTime = " . time() . "
WHERE ID_TARGET = $_REQUEST[uid]
AND ID_EXECUTOR = $ID_MEMBER
LIMIT 1", __FILE__, __LINE__);

// It was recently changed the OTHER way... so... reverse it!
if ($dir == 1)
updateMemberData($_REQUEST['uid'], array('karmaGood' => '+', 'karmaBad' => '-'));
else
updateMemberData($_REQUEST['uid'], array('karmaBad' => '+', 'karmaGood' => '-'));
}
// Finally, increment the karma count.
increment_LimitKarmaCount($message_id, $type);
}
// Well, if they are limited then show the user an error message.
else
fatal_lang_error('LimitKarma_error', false);


Find (at the end of the file):

شفرة: [اختيار]
?>Add Before:
شفرة: [اختيار]

// Function to work out, if the current user can give karma to a specific PM or Post.
// Assume that they are allowed to give karma normally, just find out if they are restricted by the Limit Karma Mod or not.
function is_LimitedByKarma($id, $type)
{
global $db_prefix, $user_info, $ID_MEMBER, $modSettings, $user_settings;

$max_count = 0;
// Go through and check this users membergroups for a higher max count.
foreach($user_info['groups'] as $group_id)
{
// Do we have a supergroup? With no max limit? And a valid group?
if(empty($modSettings['LimitKarma_'.$group_id]) && !(!empty($user_settings['ID_POST_GROUP']) && ($group_id == $user_settings['ID_POST_GROUP']) && empty($modSettings['permission_enable_postgroups'])))
return false;
// Otherwise, check to see if this group has a higher max limit, then previous groups.
elseif(!empty($modSettings['LimitKarma_'.$group_id])
&& ($modSettings['LimitKarma_'.$group_id] > $max_count))
$max_count = $modSettings['LimitKarma_'.$group_id];
}

$count = 0;
// Try to work out the current count of the karma for this post.
$request = db_query("
SELECT count
FROM {$db_prefix}limit_karma
WHERE ID_MSG = $id
AND ID_EXECUTOR = '$ID_MEMBER'
AND type = '$type'
LIMIT 1", __FILE__, __LINE__);

if (mysql_num_rows($request) > 0)
list ($count) = mysql_fetch_row($request);

// Don't forget to free the db request!
mysql_free_result($request);

// Is our count value more than our max count value? If so, then return true.
if($count >= $max_count)
return true;

// Otherwise, we have just let them add some more karma.
return false;
}

// Function to increment the count of Karma for a particular PM/Post.
function increment_LimitKarmaCount($id, $type)
{
global $db_prefix, $ID_MEMBER;

// Try to find an already existing value;
$request = db_query("
SELECT count
FROM {$db_prefix}limit_karma
WHERE ID_EXECUTOR = '$ID_MEMBER'
AND ID_MSG = '$id'
AND type = '$type'
LIMIT 1", __FILE__, __LINE__);

// Try to get the count value.
if (mysql_num_rows($request) > 0)
list ($count) = mysql_fetch_row($request);

// Don't forget to free the db request!
mysql_free_result($request);

// If we have no count value, then assume its 1.
if(empty($count))
$count = 1;
// Otherwise, we can increment the count value.
else
$count++;

// Finally save the new count value, and be happy!!! :D
db_query("
REPLACE INTO {$db_prefix}limit_karma
(ID_EXECUTOR, ID_MSG, count, type)
VALUES
('$ID_MEMBER', '$id', '$count', '$type')", __FILE__, __LINE__);
}
// Function to check if this message actually exists.
function LimitKarma_message_exists($msg_id, $type)
{
global $db_prefix;

if($type == 'pm')
{
$select_var = 'ID_PM';
$table = 'pm_recipients';
}
else
{
$select_var = 'ID_MSG';
$table = 'messages';
}

// Try to find an already existing value;
$request = db_query("
SELECT $select_var
FROM {$db_prefix}$table
WHERE $select_var = '$msg_id'", __FILE__, __LINE__);

// Try to get the count value.
if (mysql_num_rows($request) > 0)
list ($return) = mysql_fetch_row($request);

// Don't forget to free the db request!
mysql_free_result($request);

// If we have a valid message ID.
if(!empty($return))
return true;
// Otherwise, return false.
return false;
}


3
كيف يمكن ان تحمي منتداك من هجمات القراصنة

المئات من المواقع تسقط يوميا حول العالم بسبب هجمات الهكرز او الكراكرز فماذا علينا أن نفعل لحماية مواقعنا ومنتدياتنا من عبث هؤلاء ...

أهم الخطوات التي يجب علينا أتباعها لحماية منتدياتنا من اختراقات الهكرز والكراكرز ؟؟

الخطوة الأولى :

يجب علينا أن نكون على اطلاع على أخر التحديثات والاصدارات بما يخص السكريبت الذي تتعامل معه
  على سبيل المثال سكريبت المنتديات المجاني والمفتوح المصدر من نوع SMF
رابط الموقع الرسمي
http://www.simplemachines.org
ويمكنك الاطلاع على أخر الاصدارات والتحديثات من خلال هذا الرابط
http://download.simplemachines.org

الخطوة الثانية :

يجب علينا ايضاً أن نكون على اطلاع دائم على أخر الثغرات الأمنية التي يتم العثور عليها وكيفية سد هذه الثغرات من خلال متابعة اخر الأخبار  والباتشات
رابط منتديات الدعم الرسمي لمنتديات SMF
http://www.simplemachines.org/community/index.php
رابط منتدى الدعم العربي الرسمي لمنتديات SMF
http://www.simplemachines.org/community/index.php?board=71.0
المنتدى العربي الأول المختص بمناقشة كل مايخص منتديات SMF من قريب او بعيد
http://www.smfarabic.com/index.php

اضافة الى ما سبق هناك بعض التدابير الهامة التي يجب اتباعها ايضا لحماية منتداك من هجمات القراصنة
::: تفيير كلمات السر بشكل دائم ومستمر مع التأكيد على استخدام كلمات سر مختلفة لكل من

بروتوكول نقل الملفات (FTP)
قاعدة البيانات ( DATABASE )
PhpMyAdmin
حساب الأدمن ضمن المنتدى

أن تكون كلمة السر المستخدمة صعبة التخمين ومؤلفة من احرف صغيرة وكبيرة وارقام وحتى رموز وأن تكون على الأقل 8 محارف
أحفظ كلمات السر في مكان أمن ويفضل أن لا تكون على جهاز الحاسب الخاص بك

::: يجب أخذ صورة (backup)عن قاعدة البيانات وملفات الـ FTP بشكل دائم ومستمر (على الأقل بشكل اسبوعي)
::: حذف الملفات المؤقتة مثال
 install.php, converters, recovery tools, etc
::: حذف الدخول الفاشل للمدير الى المنتدى من سجل الأخطاء في لوحة تحكم المدير (error log)
::: منع الضيوف من رفع اي شيء على المنتدى
::: منع رفع ملفات الفلاش والملفات التنفيذية (exe) أو عرضها

هذه النشرة متاحة للجميع فأرجو من كل مستفيد من هذه المعلومات أن يقوم بنشرها لكي يستفيد منها كل مدير جديد في عالم المواقع والمنتديات ولحماية الشبكة العربية من الأختراقات 

جميع الحقوق محفوظه smf عربى © 2009
 

صفحات: [1]