1

Topic: Àäìèíèñòðàòîðû ïðîòèâ ìîäåðàòîðîâ

Ñêàæèò, ïîæàëóéñòà, ÷òî íóæíî â ñêðèïòå äîáàâèòü/ïîäðåäàêòèðîâàòü, ÷òîáû ìîäåðàòîðû íå ìîãëè áàíèòü àäìèíîâ è ÷òîáû àäìèíîâ íåëüçÿ áûëî óäàëèòü (ïî êðàéíåé ìåðå ïåðåä óäàëåíèåì àäìèíà, ïîíèçèòü åãî â çâàíèè).



(1.0.1)

If you want a Job done right, you do it yourself!

2

Re: Àäìèíèñòðàòîðû ïðîòèâ ìîäåðàòîðîâ

×óþ, îïÿòü ìíå îòâå÷àòü... ;-)

Xan wrote:

Ñêàæèò, ïîæàëóéñòà, ÷òî íóæíî â ñêðèïòå äîáàâèòü/ïîäðåäàêòèðîâàòü, ÷òîáû ìîäåðàòîðû íå ìîãëè áàíèòü àäìèíîâ

Èùåøü â admin_bans.php, âíóòðè áëîêà if (isset($_REQUEST['add_ban'])) ... (îí â ñàìîì íà÷àëå)

$result = $db->query('SELECT username, email FROM '.$db->prefix.'users

çàìåíÿåøü íà:

$result = $db->query('SELECT username, email, status FROM '.$db->prefix.'users

íèæå èùåøü:

list($ban_user, $ban_email) = $db->fetch_row($result);

çàìåíÿåøü íà:

list($ban_user, $ban_email, $status) = $db->fetch_row($result);

è íèæå ñòàâèøü ïðîâåðêó:

if ($status < 2)
    message($lang_common['No permission']);

Òàêèõ èçìåíåíèé íóæíî ñäåëàòü äâà. ×óòü íèæå ïîäîáíûé áëîê, ñ íåáîëüøèìè îòëè÷èÿìè, òàì ïðèìåðíî òî æå ñàìîå äåëàåøü.

è ÷òîáû àäìèíîâ íåëüçÿ áûëî óäàëèòü (ïî êðàéíåé ìåðå ïåðåä óäàëåíèåì àäìèíà, ïîíèçèòü åãî â çâàíèè).

Îòêðûâàåøü profile.php, èäåøü â áëîê if (isset($_POST['update_status'])) ...
 íåãî äîáàâëÿåøü ïîñëå ïðîâåðêè ñòàòóñà cur_user:

$result = $db->query('SELECT status FROM '.$db->prefix.'users WHERE id='.$id) or error('Unable to fetch user status', __FILE__, __LINE__, $db->error());        
list($status) = $db->fetch_row($result);

if ($status == 2)
    message($lang_common['No permission']);

Ñóäÿ ïî òâîèì çàïðîñàì, ó òåáÿ òàì íåõèëàÿ âîéíóøêà íà ôîðóìå... :-)

Big Brother is not watching you, Big Brother is testing you

3 (edited by Xan 2005-12-02 06:56)

Re: Àäìèíèñòðàòîðû ïðîòèâ ìîäåðàòîðîâ

wink wink wink äà, ñïàñèáî åù¸ ðàç áîëüøîå, nyuk !!! smile smile wink

P.S. òû ïèñàë ïðî òî, ÷òî "÷óòü íèæå ïîäîáíûé áëîê, ñ íåáîëüøèìè îòëè÷èÿìè, òàì ïðèìåðíî òî æå ñàìîå äåëàåøü", îí íå íàìíîãî íèæå?

If you want a Job done right, you do it yourself!

Re: Àäìèíèñòðàòîðû ïðîòèâ ìîäåðàòîðîâ

Xan
Òàê à ÷òî ó òåáÿ çà âåðñèÿ äâèæêà ñòîèò? Ó ìåíÿ è òàê âñåãî ýòîãî äåëàòü íåëüçÿ...

ERROR - MIRROR

5

Re: Àäìèíèñòðàòîðû ïðîòèâ ìîäåðàòîðîâ

Äà, ó ìåíÿ âòîðîé ïîäîáíûé áëîê èäåò ñðàçó ïîñëå ïåðâîãî. ß ñìîòðåë íå âíèìàòåëüíî, âðîäå áû â çàâèñèìîñòè îò òîãî, îòêóäà âûçûâàåòñÿ ñêðèïò, îòðàáàòûâàåò îäèí èëè äðóãîé áëîê.

Big Brother is not watching you, Big Brother is testing you

6 (edited by Xan 2005-12-29 15:30)

Re: Àäìèíèñòðàòîðû ïðîòèâ ìîäåðàòîðîâ

Nyuk, òû ïèñàë: "...íèæå ñòàâèøü ïðîâåðêó

if ($status < 2)
message($lang_common['No permission']);

À ïîñëå êîòîðîãî èìåííî áëîêà å¸ íàäî ñòàâèòü. È ñëåäóåò ëè ñâåðõó èëè ñíèçó ýòîé ïðîâåðêè "if ($status < 2)
message($lang_common['No permission']);" ñòàâèòü "}", "{".?

íàïðèìåð:

{
if ($status < 2)
message($lang_common['No permission']);

èëè

}
if ($status < 2)
message($lang_common['No permission']);

èëè

if ($status < 2)
message($lang_common['No permission']);
}

if ($status < 2)
message($lang_common['No permission']);
{

???

If you want a Job done right, you do it yourself!

7

Re: Àäìèíèñòðàòîðû ïðîòèâ ìîäåðàòîðîâ

Ñèñòåìà ïðîñòàÿ: êîëè÷åñòâî îòêðûâàþùèõ ôèãóðíûõ ñêîáîê â ñêðèïòå äîëæíî áûòü ðàâíî êîëè÷åñòâó çàêðûâàþùèõ. :-)
Ïðîäâèíóòûå PHP-ðåäàêòîðû ñàìè çà ýòèì ñëåäÿò.

 òîì ñëó÷àå ñêîáîê äîáàâëÿòü íå íàäî.
Ïðîâåðêó ñòàòóñà äåëàòü ñðàçó ïîñëå ïîëó÷åíèÿ ñòàòóñà, ò.å. ïîñëå ñòðî÷êè:

list($ban_user, $ban_email, $status) = $db->fetch_row($result);

Big Brother is not watching you, Big Brother is testing you