serjufa
05.06.2008, 16:09
в таблице nuke_users есть поле points. как узнать - сколько очков у юзера?
для чего это надо? юзер заходит на интрапортал. видит все новости, доступные зарегенным. некоторым юзерам должна быть доступна инфа, которую могут видеть только они.
я руками ввожу очки этим юзерам, напр., 5000. у остальных - 0. в файле /modules/Topics/index.php я хочу вставить кусок, определяющий - сколько у вошедшего очков. думаю, вставить этот кусок надо
if (!defined('MODULE_FILE')) {
die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
$pagetitle = "- "._ACTIVETOPICS."";
include("header.php");
OpenTable();
global $db, $prefix, $tipath;
$ThemeSel = get_theme();
// Patched for MySQL >=5.00
тут
//$sql = "SELECT t.topicid, t.topicimage, t.topictext, count(s.sid) AS stories, SUM(s.counter) AS reads FROM ".$prefix."_topics t LEFT JOIN ".$prefix."_stories s ON (s.topic = t.topicid) GROUP BY t.topicid, t.topicimage, t.topictext ORDER BY t.topictext";
$sql = "SELECT t.topicid, t.topicimage, t.topictext, count(s.sid) AS stories, SUM(s.counter) AS reades FROM ".$prefix."_topics t LEFT JOIN ".$prefix."_stories s ON (s.topic = t.topicid) GROUP BY t.topicid, t.topicimage, t.topictext ORDER BY t.topictext";
$result = $db->sql_query($sql);
if ($db->sql_numrows($result) > 0) { .....
я ставлю if ... then... В результате выборка будет контекстной от очков юзера.
для чего это надо? юзер заходит на интрапортал. видит все новости, доступные зарегенным. некоторым юзерам должна быть доступна инфа, которую могут видеть только они.
я руками ввожу очки этим юзерам, напр., 5000. у остальных - 0. в файле /modules/Topics/index.php я хочу вставить кусок, определяющий - сколько у вошедшего очков. думаю, вставить этот кусок надо
if (!defined('MODULE_FILE')) {
die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
$pagetitle = "- "._ACTIVETOPICS."";
include("header.php");
OpenTable();
global $db, $prefix, $tipath;
$ThemeSel = get_theme();
// Patched for MySQL >=5.00
тут
//$sql = "SELECT t.topicid, t.topicimage, t.topictext, count(s.sid) AS stories, SUM(s.counter) AS reads FROM ".$prefix."_topics t LEFT JOIN ".$prefix."_stories s ON (s.topic = t.topicid) GROUP BY t.topicid, t.topicimage, t.topictext ORDER BY t.topictext";
$sql = "SELECT t.topicid, t.topicimage, t.topictext, count(s.sid) AS stories, SUM(s.counter) AS reades FROM ".$prefix."_topics t LEFT JOIN ".$prefix."_stories s ON (s.topic = t.topicid) GROUP BY t.topicid, t.topicimage, t.topictext ORDER BY t.topictext";
$result = $db->sql_query($sql);
if ($db->sql_numrows($result) > 0) { .....
я ставлю if ... then... В результате выборка будет контекстной от очков юзера.