function get_ranks() { global $db; if (!isset($_SESSION['rights']['admin']['ranks']) and !isset($_SESSION['rights']['superadmin'])) { echo NO_ADMIN_RIGHTS; } else { $tpl = new smarty(); if (@$_GET['ajax']) { ob_end_clean(); } $ranks = array(); $result = $db->query('SELECT rankID, rankname, iconname, abposts, fest, money FROM ' . DB_PRE . 'ecp_ranks ORDER BY fest DESC, abposts, rankname'); while ($row = mysql_fetch_assoc($result)) { $row['abposts'] = format_nr($row['abposts'], 0); $row['money'] = format_nr($row['money'], 2); $ranks[] = $row; } $tpl->assign('ranks', $ranks); ob_start(); $tpl->display(DESIGN . '/tpl/admin/ranks_overview.html'); $content = ob_get_contents(); ob_end_clean(); if (@$_GET['ajax']) { echo html_ajax_convert($content); die; } main_content(OVERVIEW, '<div id="ranks_overview">' . $content . '</div>', '', 1); } }
function gallery_gallery($id) { global $db; $gallery = $db->fetch_assoc('SELECT katename, b.access, name, images, cID, folder, userID, datum, username FROM ' . DB_PRE . 'ecp_gallery as a LEFT JOIN ' . DB_PRE . 'ecp_user ON ID=userID LEFT JOIN ' . DB_PRE . 'ecp_gallery_kate as b ON (cID = kateID) WHERE (a.access = "" OR ' . str_replace('access', 'a.access', $_SESSION['access_search']) . ') AND galleryID = ' . $id); if (isset($gallery['name']) and find_access($gallery['access'])) { $limits = get_sql_limit($gallery['images'], LIMIT_GALLERY_PICS); $pics = array(); $result = $db->query('SELECT imageID, filename, klicks, COUNT(comID) as comments FROM ' . DB_PRE . 'ecp_gallery_images as A LEFT JOIN ' . DB_PRE . 'ecp_comments ON (subID=imageID AND bereich="gallery") WHERE gID = ' . $id . ' GROUP BY imageID ORDER BY imageID ASC LIMIT ' . $limits[1] . ',' . LIMIT_GALLERY_PICS); while ($row = mysql_fetch_assoc($result)) { $row['klicks'] = format_nr($row['klicks'], 0); $pics[] = $row; } $tpl = new smarty(); if ($limits[0] > 1) { $tpl->assign('seiten', makepagelink_ajax('?section=gallery&action=gallery&id=' . $id, 'return load_gallery_page(' . $id . ', {nr});', @$_GET['page'], $limits[0])); } $tpl->assign('pics', $pics); $tpl->assign('datum', date(LONG_DATE, $gallery['datum'])); $tpl->assign('username', $gallery['username']); $tpl->assign('userID', $gallery['userID']); $tpl->assign('pfad', '<a href="?section=gallery">' . GALLERY . '</a> <img src="templates/' . DESIGN . '/images/pfeil_o.gif" alt="" /> <a href="?section=gallery&action=kate&id=' . $gallery['cID'] . '">' . $gallery['katename'] . '</a> <img src="templates/' . DESIGN . '/images/pfeil_o.gif" alt="" /> <a href="?section=gallery&action=gallery&id=' . $id . '">' . $gallery['name'] . '</a>'); $tpl->assign('folder', $gallery['folder']); ob_start(); $tpl->display(DESIGN . '/tpl/gallery/pictures.html'); $content = ob_get_contents(); ob_end_clean(); main_content(GALLERY, $content, '', 1); } else { table(ERROR, NO_ENTRIES_ID); } }
function shoutbox() { global $db, $countries; $tpl = new smarty(); $anzahl = $db->result(DB_PRE . 'ecp_comments', 'COUNT(comID)', 'bereich="shoutbox"'); if ($anzahl) { $limits = get_sql_limit($anzahl, LIMIT_SHOUTBOX); $shouts = array(); $db->query('SELECT comID, country, username, userID, author, datum, beitrag FROM ' . DB_PRE . 'ecp_comments LEFT JOIN ' . DB_PRE . 'ecp_user ON userID = ID WHERE bereich="shoutbox" ORDER BY datum DESC LIMIT ' . $limits[1] . ',' . LIMIT_SHOUTBOX); $anzahl -= $limits[1]; while ($row = $db->fetch_assoc()) { $row['nr'] = format_nr($anzahl--, 0); $row['countryname'] = @$countries[$row['country']]; $row['datum'] = date(LONG_DATE, $row['datum']); $shouts[] = $row; } $tpl->assign('shoutbox', $shouts); if ($limits[0] > 1) { $tpl->assign('seiten', makepagelink_ajax('?section=shoutbox', 'return load_shout_page({nr});', @$_GET['page'], $limits[0])); } ob_start(); $tpl->display(DESIGN . '/tpl/shoutbox/shoutbox.html'); $content = ob_get_contents(); ob_end_clean(); main_content(SHOUTBOX, '<div id="shout_overview">' . $content . '</div>', '', 1); } else { table(INFO, NO_ENTRIES); } }
$_SESSION['links'][(int) $_GET['id']] = true; $db->query('UPDATE ' . DB_PRE . 'ecp_links SET hits = hits + 1 WHERE linkID = ' . (int) $_GET['goto']); } header('Location: ' . $link); } else { table(ERROR, NO_ENTRIES_ID); } } else { $tpl = new smarty(); $anzahl = $db->result(DB_PRE . 'ecp_links', 'COUNT(linkID)', '1'); if ($anzahl) { $limits = get_sql_limit($anzahl, LIMIT_LINKS); $links = array(); $db->query('SELECT * FROM ' . DB_PRE . 'ecp_links ORDER BY name ASC LIMIT ' . $limits[1] . ',' . LIMIT_LINKS); while ($row = $db->fetch_assoc()) { $row['hits'] = format_nr($row['hits'], 0); $links[] = $row; } $tpl->assign('links', $links); if ($limits[0] > 1) { $tpl->assign('seiten', makepagelink_ajax('?section=links', 'return load_links({nr});', @$_GET['page'], $limits[0])); } ob_start(); $tpl->display(DESIGN . '/tpl/links/links.html'); $content = ob_get_contents(); ob_end_clean(); main_content(LINKS, '<div id="weblinks">' . $content . '</div>', '', 1); } else { table(INFO, NO_ENTRIES); } }
function account_stats() { global $db, $countries; $tpl = new smarty(); $user = $db->fetch_assoc('SELECT `registerdate`, rankname, `clicks`, `logins`, `comments`, a.money, iconname, `msg_s`, `msg_r`, `profilhits`, `scheine`, `2er`, `3er`, `4er`, COUNT(b.scheinID) as scheine FROM ' . DB_PRE . 'ecp_user LEFT JOIN ' . DB_PRE . 'ecp_user_stats as a ON (a.userID = ID) LEFT JOIN ' . DB_PRE . 'ecp_ranks ON (rID = rankID) LEFT JOIN ' . DB_PRE . 'ecp_lotto_scheine as b ON (b.userID = ID) WHERE ID = ' . $_SESSION['userID'] . ' GROUP BY ID'); $db->query('SELECT SUM(gewinn) as gewinn, art FROM ' . DB_PRE . 'ecp_lotto_gewinner WHERE userID = ' . $_SESSION['userID'] . ' GROUP BY art'); $user['wonmoney'] = 0; $user['2ermoney'] = 0; $user['3ermoney'] = 0; $user['4ermoney'] = 0; while ($row = $db->fetch_assoc()) { $user['wonmoney'] += $row['gewinn']; $user[$row['art'] . 'ermoney'] = $row['gewinn']; } $user['runden'] = $db->result(DB_PRE . 'ecp_lotto_scheine', 'COUNT(DISTINCT(rundenID)) as runden', 'userID = ' . $_SESSION['userID']); $user['gesamtrunden'] = mysql_result($db->query('SHOW TABLE STATUS LIKE "' . DB_PRE . 'ecp_lotto_runden"'), 0, 'Auto_increment') - 1; $user['tage'] = ceil((time() - $user['registerdate']) / 86400); $user['teilqoute'] = format_nr($user['runden'] / ($user['gesamtrunden'] == 0 ? 1 : $user['gesamtrunden']) * 100, 2); $user['scheinrunde'] = format_nr($user['scheine'] / ($user['runden'] == 0 ? 1 : $user['runden']), 2); $user['winscheine'] = format_nr($user['2er'] + $user['3er'] + $user['4er']); $user['winqoute'] = format_nr($user['winscheine'] / ($user['scheine'] == 0 ? 1 : $user['scheine']) * 100, 2); $user['registerdate'] = date(LONG_DATE, $user['registerdate']); $user['2erpro'] = format_nr($user['2er'] / ($user['winscheine'] == 0 ? 1 : $user['winscheine']) * 100, 2); $user['3erpro'] = format_nr($user['3er'] / ($user['winscheine'] == 0 ? 1 : $user['winscheine']) * 100, 2); $user['4erpro'] = format_nr($user['4er'] / ($user['winscheine'] == 0 ? 1 : $user['winscheine']) * 100, 2); $user['2ermpro'] = format_nr($user['2ermoney'] / ($user['wonmoney'] == 0 ? 1 : $user['wonmoney']) * 100, 2); $user['3ermpro'] = format_nr($user['3ermoney'] / ($user['wonmoney'] == 0 ? 1 : $user['wonmoney']) * 100, 2); $user['4ermpro'] = format_nr($user['4ermoney'] / ($user['wonmoney'] == 0 ? 1 : $user['wonmoney']) * 100, 2); foreach ($user as $key => $value) { if ($key == 'clicks' or $key == 'comments' or $key == 'gesamtrunden' or $key == 'runden' or $key == 'msg_s' or $key == 'msg_r' or $key == 'profilhits' or $key == 'scheine' or $key == '2er' or $key == '3er' or $key == '4er') { $value = format_nr($value); } if ($key == 'money' or $key == 'wonmoney' or $key == '2ermoney' or $key == '3ermoney' or $key == '4ermoney') { $value = format_nr($value, 2); } $tpl->assign($key, $value); } $db->query('SELECT `awardID`, `eventname`, `eventdatum`, `url`, `platz`, `teamID`, `gID`, `preis`, tname, icon, gamename, COUNT(comID) as comments FROM `' . DB_PRE . 'ecp_awards` LEFT JOIN ' . DB_PRE . 'ecp_teams ON tID = teamID LEFT JOIN ' . DB_PRE . 'ecp_wars_games ON gameID = gID LEFT JOIN ' . DB_PRE . 'ecp_comments ON (bereich = "awards" AND subID = awardID) WHERE spieler LIKE "%,' . $_SESSION['userID'] . ',%" GROUP BY awardID ORDER BY eventdatum DESC'); $awards = array(); while ($row = $db->fetch_assoc()) { $row['eventdatum'] = date('d.m.Y', $row['eventdatum']); $awards[] = $row; } $tpl->assign('awards', $awards); $tpl->assign('award', count($awards)); $db->query('SELECT `warID`, ' . DB_PRE . 'ecp_wars.datum, `result`, `resultscore`, `tname`, `oppname`, `country`, ' . DB_PRE . 'ecp_wars_opp.homepage, `icon`, `gamename`, `matchtypename`, COUNT(comID) as comments FROM ' . DB_PRE . 'ecp_wars LEFT JOIN ' . DB_PRE . 'ecp_teams ON ' . DB_PRE . 'ecp_teams.tID = ' . DB_PRE . 'ecp_wars.tID LEFT JOIN ' . DB_PRE . 'ecp_wars_games ON gID = gameID LEFT JOIN ' . DB_PRE . 'ecp_wars_opp ON oID = oppID LEFT JOIN ' . DB_PRE . 'ecp_wars_matchtype ON mID = matchtypeID LEFT JOIN ' . DB_PRE . 'ecp_comments ON (subID = warID AND bereich = "clanwars") WHERE status = 1 AND ownplayers LIKE "%,' . $_SESSION['userID'] . ',%" GROUP BY warID ORDER BY datum DESC'); $clanwars = array(); while ($row = $db->fetch_assoc()) { $row['datum'] = date('d.m.y', $row['datum']); $row['countryname'] = $countries[$row['country']]; $clanwars[] = $row; } $tpl->assign('clanwars', $clanwars); $tpl->assign('clanwar', count($clanwars)); ob_start(); $tpl->display(DESIGN . '/tpl/user/user_stats.html'); $content = ob_get_contents(); ob_end_clean(); main_content(STATS, $content, '', 1); }
function lotto_result($userID, $gewinn, $scheinID, $rundenID, $art, $datum, $zahl1, $zahl2, $zahl3, $zahl4, $zahlen) { global $db; if (in_array($zahl1, $zahlen)) { $zahl1 = '<strong>' . $zahl1 . '</strong>'; } if (in_array($zahl2, $zahlen)) { $zahl2 = '<strong>' . $zahl2 . '</strong>'; } if (in_array($zahl3, $zahlen)) { $zahl3 = '<strong>' . $zahl3 . '</strong>'; } if (in_array($zahl4, $zahlen)) { $zahl4 = '<strong>' . $zahl4 . '</strong>'; } $db->query('SELECT * FROM ' . DB_PRE . 'ecp_texte WHERE name = "LOTTO_WIN"'); $text = array(); while ($row = $db->fetch_assoc()) { $text[$row['lang']] = $row; } $row = $db->fetch_assoc('SELECT country FROM ' . DB_PRE . 'ecp_user WHERE ID = ' . $userID); $search = array('{datum}', '{richtige}', '{zahlen}', '{tippzahlen}', '{gewinn}', '{rundenid}'); $replace = array(date(LONG_DATE, $datum), $art, implode(',', $zahlen), "{$zahl1}, {$zahl2}, {$zahl3}, {$zahl4}", format_nr($gewinn, 2) . ' ' . VIRTUELL_MONEY_UNIT, $rundenID); if (!isset($text[$row['country']])) { $row['country'] = DEFAULT_LANG; } message_send($userID, 0, $text[$row['country']]['content2'], str_replace($search, $replace, $text[$row['country']]['content']), 0, 1); $db->query('INSERT INTO ' . DB_PRE . 'ecp_lotto_gewinner (`userID`, `rID`, `sID`, `gewinn`, `art`) VALUES (' . $userID . ',' . $rundenID . ', ' . $scheinID . ',' . $gewinn . ', ' . $art . ')'); $db->query('UPDATE ' . DB_PRE . 'ecp_user_stats SET money = money + ' . $gewinn . ', ' . $art . 'er = ' . $art . 'er + 1 WHERE userID = ' . $userID); }
function news_archiv($topicID = 0) { global $db; $topics = array(); $db->query('SELECT tID, topicname FROM ' . DB_PRE . 'ecp_topics ORDER BY topicname ASC'); while ($row = $db->fetch_assoc()) { $topics[] = $row; } if ($topicID) { $anzahl = $db->result(DB_PRE . 'ecp_news', 'COUNT(newsID)', '(lang = "" OR lang LIKE ",%' . LANGUAGE . '%,") AND topicID = ' . $topicID . ' AND ' . DB_PRE . 'ecp_news.datum < ' . time() . ' AND (access = "" OR ' . $_SESSION['access_search'] . ')'); $seiten = get_sql_limit($anzahl, 30); $sql = 'SELECT `newsID`, `' . DB_PRE . 'ecp_news`.`userID`, `topicID`, `' . DB_PRE . 'ecp_news`.`datum`, `headline`, `bodytext`, `extendtext`, `links`, `hits`, `username`, `topicname`, `topicbild`, `beschreibung`, COUNT(comID) AS comments FROM ' . DB_PRE . 'ecp_news LEFT JOIN ' . DB_PRE . 'ecp_user ON (' . DB_PRE . 'ecp_news.userID = ID) LEFT JOIN ' . DB_PRE . 'ecp_topics ON (topicID = tID) LEFT JOIN ' . DB_PRE . 'ecp_comments ON (subID = newsID AND bereich = "news") WHERE (lang = "" OR lang LIKE ",%' . LANGUAGE . '%,") AND topicID = ' . $topicID . ' AND ' . DB_PRE . 'ecp_news.datum < ' . time() . ' AND (access = "" OR ' . $_SESSION['access_search'] . ') GROUP BY newsID ORDER BY sticky DESC, datum DESC'; } else { $anzahl = $db->result(DB_PRE . 'ecp_news', 'COUNT(newsID)', '(lang = "" OR lang LIKE ",%' . LANGUAGE . '%,") AND ' . DB_PRE . 'ecp_news.datum < ' . time() . ' AND (access = "" OR ' . $_SESSION['access_search'] . ')'); $seiten = get_sql_limit($anzahl, 30); $sql = 'SELECT `newsID`, `' . DB_PRE . 'ecp_news`.`userID`, `topicID`, `' . DB_PRE . 'ecp_news`.`datum`, `headline`, `bodytext`, `extendtext`, `links`, `hits`, `username`, `topicname`, `topicbild`, `beschreibung`, COUNT(comID) AS comments FROM ' . DB_PRE . 'ecp_news LEFT JOIN ' . DB_PRE . 'ecp_user ON (' . DB_PRE . 'ecp_news.userID = ID) LEFT JOIN ' . DB_PRE . 'ecp_topics ON (topicID = tID) LEFT JOIN ' . DB_PRE . 'ecp_comments ON (subID = newsID AND bereich = "news") WHERE (lang = "" OR lang LIKE ",%' . LANGUAGE . '%,") AND ' . DB_PRE . 'ecp_news.datum < ' . time() . ' AND (access = "" OR ' . $_SESSION['access_search'] . ') GROUP BY newsID ORDER BY sticky DESC, datum DESC'; } if ($anzahl) { if (!isset($_GET['page'])) { $_GET['page'] = 1; } $db->query($sql . ' LIMIT ' . $seiten[1] . ', 30'); $news = array(); while ($row = $db->fetch_assoc()) { $row['datum'] = date(LONG_DATE, $row['datum']); $row['comments'] = format_nr($row['comments']); $row['hits'] = format_nr($row['hits']); $news[] = $row; } $tpl = new smarty(); $tpl->assign('topics', $topics); $tpl->assign('news', $news); ob_start(); $tpl->display(DESIGN . '/tpl/news/news_archiv.html'); $content = ob_get_contents(); ob_end_clean(); main_content(NEWS_ARCHIV, $content, '', 1); if ($seiten[0] > 1) { table(PAGES, '<div style="text-align:center">' . NEWS . ': ' . $anzahl . ' | ' . PAGES . ': ' . makepagelink('?section=news&action=archiv&tid=' . $topicID, $_GET['page'], $seiten[0]) . '</div>'); } } else { table(INFO, NO_ENTRIES); } }
$tpl->assign('tage', floor($tage)); $tpl->assign('visits', format_nr($row['visits'])); $tpl->assign('hits', format_nr($row['hits'])); $tpl->assign('messages', format_nr(mysql_result($db->query('SHOW TABLE STATUS LIKE "%ecp_messages"'), 0, 'Auto_increment') - 1)); $tpl->assign('awards', $db->result(DB_PRE . 'ecp_awards', 'COUNT(awardID)', '1')); $tpl->assign('news', format_nr($db->result(DB_PRE . 'ecp_news', 'COUNT(newsID)', '1'))); $tpl->assign('surveys', format_nr($db->result(DB_PRE . 'ecp_survey', 'COUNT(surveyID)', '1'))); $tpl->assign('clanwars', format_nr($db->result(DB_PRE . 'ecp_wars', 'COUNT(warID)', '1'))); $tpl->assign('comments', format_nr($db->result(DB_PRE . 'ecp_comments', 'COUNT(comID)', 'bereich != "guestbook"'))); $tpl->assign('members', format_nr($db->result(DB_PRE . 'ecp_user', 'COUNT(ID)', '1'))); $row = $db->fetch_assoc('SELECT username, ID, registerdate FROM ' . DB_PRE . 'ecp_user ORDER BY registerdate DESC LIMIT 1'); $tpl->assign('lastmember', '<a href="?section=user&id=' . $row['ID'] . '">' . $row['username'] . '</a> (' . date('d.m.Y', $row['registerdate']) . ')'); $row = $db->fetch_assoc('SELECT SUM(traffic) as traffic, COUNT(*) as anzahl FROM ' . DB_PRE . 'ecp_downloads'); $tpl->assign('downloads', format_nr($row['anzahl'])); $tpl->assign('traffic', goodsize($row['traffic'])); $tpl->assign('money', format_nr($db->result(DB_PRE . 'ecp_user_stats', 'SUM(money)', '1'))); $tpl->assign('members', format_nr($db->result(DB_PRE . 'ecp_user', 'COUNT(ID)', '1'))); $row = $db->fetch_assoc('SELECT SUM(images) as images, COUNT(*) as gallery FROM ' . DB_PRE . 'ecp_gallery'); $tpl->assign('images', format_nr($row['images'])); $tpl->assign('galleries', format_nr($row['gallery'])); $row = $db->fetch_assoc('SELECT SUM(threads) as threads, SUM(posts) AS posts FROM ' . DB_PRE . 'ecp_forum_boards'); $tpl->assign('threads', format_nr($row['threads'])); $tpl->assign('posts', format_nr($row['posts'])); ob_start(); $tpl->display(DESIGN . '/tpl/stats/overview.html'); $content = ob_get_contents(); ob_end_clean(); main_content(STATS, $content, '', 1); } else { table(ACCESS_DENIED, NO_ACCESS_RIGHTS); }
function forum_search_results($id) { global $db; if ($id) { $search = $db->fetch_assoc('SELECT * FROM ' . DB_PRE . 'ecp_forum_search WHERE (SID = \'' . session_id() . '\' OR userID = ' . (int) @$_SESSION['userID'] . ') AND searchID = ' . $id); if (isset($search['searchID'])) { if ($search['stichwort'] != '') { if ($search['viewas'] == 'comments') { $db->query($search['sqlquery'] . ' ORDER BY ' . $search['sortart'] . ' ' . $search['sortorder']); $anzahl = $db->num_rows(); $limits = get_sql_limit($anzahl, LIMIT_FORUM_COMMENTS); $result = $db->query($search['sqlquery'] . ' ORDER BY ' . $search['sortart'] . ' ' . $search['sortorder'] . ' LIMIT ' . $limits[1] . ', ' . LIMIT_FORUM_COMMENTS); $comments = array(); while ($row = mysql_fetch_assoc($result)) { $row['adatum'] = forum_make_date($row['adatum']); $row['nr'] = ++$limits[1]; $row['countryname'] = @$countries[$row['country']]; $row['sex'] == 'male' ? $row['sextext'] = MALE : ($row['sextext'] = FEMALE); if ($row['edits']) { $row['edit'] = str_replace(array('{anzahl}', '{von}', '{last}'), array($row['edits'], '<a href="?section=user&id=' . $row['edituserID'] . '">' . $row['editfrom'] . '</a>', date(LONG_DATE, $row['editdatum'])), COMMENT_EDIT_TXT); } if ($row['attachs']) { $anhaenge = array(); $db->query('SELECT `attachID`, `name`, `size`, `downloads` FROM `' . DB_PRE . 'ecp_forum_attachments` WHERE `bID` = ' . $row['bID'] . ' AND `tID` = ' . $row['tID'] . ' AND `mID` = ' . $row['comID']); while ($sub = $db->fetch_assoc()) { $sub['size'] = goodsize($sub['size']); $anhaenge[] = $sub; } $row['attchs'] = $anhaenge; } $comments[] = $row; } $tpl = new smarty(); $tpl->assign('comments', $comments); $tpl->assign('words', str_replace(array('AND', 'OR'), array('<strong>AND</strong>', '<strong>OR</strong>'), $search['stichwort'])); if ($limits[0] != 1) { $tpl->assign('seiten', '<span class="klammer">[</span> ' . PAGES . ': ' . $anzahl . ' <span class="klammer">|</span> ' . makepagelink('?section=forum&action=searchresults&id=' . $id, (int) @$_GET['page'] == 0 ? 1 : (int) @$_GET['page'], $limits[0]) . ' <span class="klammer">]</span>'); } $tpl->assign('path', '<a href="?section=forum">' . FORUM . '</a> <img src="templates/' . DESIGN . '/images/pfeil_o.gif" alt="" /> ' . SEARCH); ob_start(); $tpl->display(DESIGN . '/tpl/forum/board_head.html'); $tpl->display(DESIGN . '/tpl/forum/search_results_comments.html'); echo '</div>'; $content = ob_get_contents(); ob_end_clean(); main_content(FORUM_SEARCH_RESULTS, $content, '', 1); } else { if ($search['sortart'] == 'adatum') { $search['sortart'] = 'lastreplay'; } $db->query($search['sqlquery']); $anzahl = $db->num_rows(); $limits = get_sql_limit($anzahl, LIMIT_THREADS); $result = $db->query($search['sqlquery'] . ' ORDER BY ' . $search['sortart'] . ' ' . $search['sortorder'] . ' LIMIT ' . $limits[1] . ', ' . LIMIT_THREADS); $threads = array(); while ($row = mysql_fetch_assoc($result)) { $row['lastreplay'] = forum_make_date($row['lastreplay']); $row['datum'] = forum_make_date($row['datum']); $row['bewertung'] = $row['ratingvotes'] != 0 ? str_replace(array('{anzahl}', '{avg}'), array(format_nr($row['ratingvotes']), format_nr($row['rating'], 2)), FORUM_RATING_VAL) : FORUM_NO_RATINGS; $row['bewertungbild'] = 'rating_' . str_replace('.', '_', get_forum_rating($row['rating'])); $threads[] = $row; } $tpl = new smarty(); $tpl->assign('threads', $threads); $tpl->assign('words', str_replace(array('AND', 'OR'), array('<strong>AND</strong>', '<strong>OR</strong>'), $search['stichwort'])); if ($limits[0] != 1) { $tpl->assign('seiten', '<span class="klammer">[</span> ' . PAGES . ': ' . $anzahl . ' <span class="klammer">|</span> ' . makepagelink('?section=forum&action=searchresults&id=' . $id, (int) @$_GET['page'] == 0 ? 1 : (int) @$_GET['page'], $limits[0]) . ' <span class="klammer">]</span>'); } $tpl->assign('path', '<a href="?section=forum">' . FORUM . '</a> <img src="templates/' . DESIGN . '/images/pfeil_o.gif" alt="" /> ' . SEARCH); ob_start(); $tpl->display(DESIGN . '/tpl/forum/board_head.html'); $tpl->display(DESIGN . '/tpl/forum/search_results_boards.html'); echo '</div>'; $content = ob_get_contents(); ob_end_clean(); main_content(FORUM_SEARCH_RESULTS, $content, '', 1); } } else { if ($search['usersuchart'] == 1) { if ($search['sortart'] == 'adatum') { $search['sortart'] == 'datum'; } $db->query($search['sqlquery'] . ' ORDER BY ' . $search['sortart'] . ' ' . $search['sortorder']); $anzahl = $db->num_rows(); $limits = get_sql_limit($anzahl, LIMIT_FORUM_COMMENTS); $result = $db->query($search['sqlquery'] . ' ORDER BY ' . $search['sortart'] . ' ' . $search['sortorder'] . ' LIMIT ' . $limits[1] . ', ' . LIMIT_FORUM_COMMENTS); $comments = array(); while ($row = mysql_fetch_assoc($result)) { $row['adatum'] = forum_make_date($row['adatum']); $row['nr'] = ++$limits[1]; $row['countryname'] = @$countries[$row['country']]; $row['sex'] == 'male' ? $row['sextext'] = MALE : ($row['sextext'] = FEMALE); if ($row['edits']) { $row['edit'] = str_replace(array('{anzahl}', '{von}', '{last}'), array($row['edits'], '<a href="?section=user&id=' . $row['edituserID'] . '">' . $row['editfrom'] . '</a>', date(LONG_DATE, $row['editdatum'])), COMMENT_EDIT_TXT); } if ($row['attachs']) { $anhaenge = array(); $db->query('SELECT `attachID`, `name`, `size`, `downloads` FROM `' . DB_PRE . 'ecp_forum_attachments` WHERE `bID` = ' . $row['bID'] . ' AND `tID` = ' . $row['tID'] . ' AND `mID` = ' . $row['comID']); while ($sub = $db->fetch_assoc()) { $sub['size'] = goodsize($sub['size']); $anhaenge[] = $sub; } $row['attchs'] = $anhaenge; } $comments[] = $row; } $tpl = new smarty(); $tpl->assign('search', 'username'); $tpl->assign('username', $search['fromusername']); $tpl->assign('comments', $comments); if ($limits[0] != 1) { $tpl->assign('seiten', '<span class="klammer">[</span> ' . PAGES . ': ' . $anzahl . ' <span class="klammer">|</span> ' . makepagelink('?section=forum&action=searchresults&id=' . $id, (int) @$_GET['page'] == 0 ? 1 : (int) @$_GET['page'], $limits[0]) . ' <span class="klammer">]</span>'); } $tpl->assign('path', '<a href="?section=forum">' . FORUM . '</a> <img src="templates/' . DESIGN . '/images/pfeil_o.gif" alt="" /> ' . SEARCH); ob_start(); $tpl->display(DESIGN . '/tpl/forum/board_head.html'); $tpl->display(DESIGN . '/tpl/forum/search_results_comments.html'); echo '</div>'; $content = ob_get_contents(); ob_end_clean(); main_content(FORUM_SEARCH_RESULTS, $content, '', 1); } else { if ($search['sortart'] == 'adatum') { $search['sortart'] = 'lastreplay'; } $db->query($search['sqlquery']); $anzahl = $db->num_rows(); $limits = get_sql_limit($anzahl, LIMIT_THREADS); $result = $db->query($search['sqlquery'] . ' ORDER BY ' . $search['sortart'] . ' ' . $search['sortorder'] . ' LIMIT ' . $limits[1] . ', ' . LIMIT_THREADS); $threads = array(); while ($row = mysql_fetch_assoc($result)) { $row['lastreplay'] = forum_make_date($row['lastreplay']); $row['datum'] = forum_make_date($row['datum']); $row['bewertung'] = $row['ratingvotes'] != 0 ? str_replace(array('{anzahl}', '{avg}'), array(format_nr($row['ratingvotes']), format_nr($row['rating'], 2)), FORUM_RATING_VAL) : FORUM_NO_RATINGS; $row['bewertungbild'] = 'rating_' . str_replace('.', '_', get_forum_rating($row['rating'])); $threads[] = $row; } $tpl = new smarty(); $tpl->assign('search', 'username'); $tpl->assign('username', $search['fromusername']); $tpl->assign('threads', $threads); if ($limits[0] != 1) { $tpl->assign('seiten', '<span class="klammer">[</span> ' . PAGES . ': ' . $anzahl . ' <span class="klammer">|</span> ' . makepagelink('?section=forum&action=searchresults&id=' . $id, (int) @$_GET['page'] == 0 ? 1 : (int) @$_GET['page'], $limits[0]) . ' <span class="klammer">]</span>'); } $tpl->assign('path', '<a href="?section=forum">' . FORUM . '</a> <img src="templates/' . DESIGN . '/images/pfeil_o.gif" alt="" /> ' . SEARCH); ob_start(); $tpl->display(DESIGN . '/tpl/forum/board_head.html'); $tpl->display(DESIGN . '/tpl/forum/search_results_boards.html'); echo '</div>'; $content = ob_get_contents(); ob_end_clean(); main_content(FORUM_SEARCH_RESULTS, $content, '', 1); } } } else { table(ERROR, FORUM_SEARCH_NOT_YOURS); } } }
} } else { echo htmlentities(NO_ACCESS_RIGHTS); } break; case 'shout_page': if (@$_SESSION['rights']['public']['shoutbox']['view'] or @$_SESSION['rights']['superadmin']) { $tpl = new smarty(); $anzahl = $db->result(DB_PRE . 'ecp_comments', 'COUNT(comID)', 'bereich="shoutbox"'); if ($anzahl) { $limits = get_sql_limit($anzahl, LIMIT_SHOUTBOX); $shouts = array(); $db->query('SELECT comID, country, username, userID, author, datum, beitrag FROM ' . DB_PRE . 'ecp_comments LEFT JOIN ' . DB_PRE . 'ecp_user ON userID = ID WHERE bereich="shoutbox" ORDER BY datum DESC LIMIT ' . $limits[1] . ',' . LIMIT_SHOUTBOX); $anzahl -= $limits[1]; while ($row = $db->fetch_assoc()) { $row['nr'] = format_nr($anzahl--, 0); $row['countryname'] = @$countries[$row['country']]; $row['datum'] = date(LONG_DATE, $row['datum']); $shouts[] = $row; } $tpl->assign('shoutbox', $shouts); if ($limits[0] > 1) { $tpl->assign('seiten', makepagelink_ajax('?section=shoutbox', 'return load_shout_page({nr});', @$_GET['page'], $limits[0])); } ob_start(); $tpl->display(DESIGN . '/tpl/shoutbox/shoutbox.html'); $content = ob_get_contents(); ob_end_clean(); echo html_ajax_convert($content); } else { echo html_ajax_convert(NO_ENTRIES);
function lotto_view_all() { global $db; $db->query('SELECT a.rundenID, `ende`, `rundenjackpot`, `auszahlung`, a.zahl1, a.zahl2, a.zahl3, a.zahl4, `4er`, `3er`, `2er`, COUNT(scheinID) as scheine FROM ' . DB_PRE . 'ecp_lotto_runden as a LEFT JOIN ' . DB_PRE . 'ecp_lotto_scheine as b ON (a.rundenID = b.rundenID) WHERE a.zahl1 != 0 GROUP BY a.rundenID ORDER BY ende DESC'); $runden = array(); while ($row = $db->fetch_assoc()) { $row['ende'] = date(LONG_DATE, $row['ende']); $row['auszahlung'] = format_nr($row['auszahlung'], 2); $row['rundenjackpot'] = format_nr($row['rundenjackpot'], 2); $row['winner'] = format_nr($row['4er'] + $row['3er'] + $row['2er']); $runden[] = $row; } $tpl = new Smarty(); $tpl->assign('runden', $runden); ob_start(); $tpl->display(DESIGN . '/tpl/lotto/viewall.html'); $content = ob_get_contents(); ob_end_clean(); main_content(LOTTO, $content, '', 1); }
function user_details($id) { if (@$_SESSION['rights']['public']['user']['view'] or @$_SESSION['rights']['superadmin']) { global $db, $countries, $groups; $data = $db->fetch_assoc('SELECT ID, `username`, `country`, `sex`, `signatur`, `realname`, `wohnort`, `geburtstag`, `homepage`, `icq`, `msn`, `yahoo`, `skype`, `xfire`, `aim`, `clanname`, `clanirc`, `clanhomepage`, `clanhistory`, `cpu`, `mainboard`, `ram`, `gkarte`, `skarte`, `monitor`, `maus`, `tastatur`, `mauspad`, `internet`, `festplatte`, `headset`, `aboutme`, lastlogin, registerdate, uID AS online, user_pic FROM ' . DB_PRE . 'ecp_user LEFT JOIN ' . DB_PRE . 'ecp_online ON (uID = ' . $id . ' AND lastklick > ' . (time() - SHOW_USER_ONLINE) . ') WHERE ID = ' . $id . ' GROUP BY ID'); if (isset($data['username'])) { if (isset($_SESSION['userID']) and $_SESSION['userID'] != $id) { $db->query('UPDATE ' . DB_PRE . 'ecp_user_lastvisits SET datum = ' . time() . ' WHERE userID = ' . $id . ' AND visitID = ' . $_SESSION['userID']); if ($db->affekt_rows() == 0) { $db->query('INSERT INTO ' . DB_PRE . 'ecp_user_lastvisits (userID, visitID, datum) VALUES (' . $id . ', ' . $_SESSION['userID'] . ', ' . time() . ')'); } $anzahl = $db->result(DB_PRE . 'ecp_user_lastvisits', 'COUNT(userID)', 'userID = ' . $id); if ($anzahl > 10) { $db->query('DELETE FROM ' . DB_PRE . 'ecp_user_lastvisits WHERE userID =' . $id . ' LIMIT ' . ($anzahl - 10)); } } if (!isset($_SESSION['profil'][$id]) and @$_SESSION['userID'] != $id) { $db->query('UPDATE ' . DB_PRE . 'ecp_user_stats SET profilhits = profilhits + 1 WHERE userID = ' . $id); $_SESSION['profil'][$id] = true; } $tpl = new smarty(); $data['ID'] = format_nr($data['ID']); $data['homepage'] = check_url_length($data['homepage']); $data['clanhomepage'] = check_url_length($data['clanhomepage']); $data['registerdate'] = date(LONG_DATE, $data['registerdate']); if ($data['lastlogin'] == 0) { $data['lastlogin'] = NEVER_LOGGED_IN; } else { $data['lastlogin'] = date(LONG_DATE, $data['lastlogin']); } $data['countryname'] = $countries[$data['country']]; if ($data['geburtstag'] == '0000-00-00') { $data['geburtstag'] = ''; } if ($data['geburtstag']) { $birthday = explode('-', $data['geburtstag']); $data['geburtstag'] = $birthday[2] . '.' . $birthday[1] . '.' . $birthday[0]; $alter = alter($birthday[2], $birthday[1], $birthday[0]); if (date('m') == $birthday[1] and date('d') < $birthday[2]) { $alter -= 1; } $next = @mktime(0, 0, 0, $birthday[1], $birthday[2], $birthday[0] + $alter + 1) - time(); $tpl->assign('alter', $alter); if (date('m') == $birthday[1] and date('d') == $birthday[2]) { $tpl->assign('next', BIRTH_TODAY); } else { $tpl->assign('next', round(($next + 86400) / 60 / 60 / 24) . ' ' . DAYS); } } $data['icqtrim'] = str_replace('-', '', $data['icq']); $data['sextext'] = $data['sex'] == 'male' ? MALE : FEMALE; foreach ($data as $key => $value) { $tpl->assign($key, $value); } ob_start(); $conditions = array('LIMIT' => LIMIT_COMMENTS, 'ORDER' => 'DESC', 'SPAM' => SPAM_USER_GB_COMMENTS, 'section' => 'user'); $conditions['action'] = 'add'; $conditions['link'] = '?section=user&view=gb&id=' . $id; comments_get('user', $id, $conditions, 0, 0); $content = ob_get_contents(); $tpl->assign('guestbook', $content); ob_end_clean(); $db->query('SELECT buddyID, username, country, uID as online, user_pic, lastlogin, sex FROM ' . DB_PRE . 'ecp_buddy LEFT JOIN ' . DB_PRE . 'ecp_user ON (buddyID = ID) LEFT JOIN ' . DB_PRE . 'ecp_online ON (uID = buddyID AND lastklick > ' . (time() - SHOW_USER_ONLINE) . ') WHERE userID = ' . $id . ' GROUP BY buddyID ORDER BY online DESC,username ASC'); $buddy = array(); while ($row = $db->fetch_assoc()) { if ($row['lastlogin'] == 0) { $row['lastlogin'] = NEVER_LOGGED_IN; } else { $row['lastlogin'] = date(SHORT_DATE, $row['lastlogin']); } $buddy[] = $row; } $tpl->assign('buddies', $buddy); $last = array(); $db->query('SELECT visitID, username, country, datum, uID as online FROM ' . DB_PRE . 'ecp_user_lastvisits LEFT JOIN ' . DB_PRE . 'ecp_user ON visitID = ID LEFT JOIN ' . DB_PRE . 'ecp_online ON (uID = visitID AND lastklick > ' . (time() - SHOW_USER_ONLINE) . ') WHERE userID = ' . $id . ' GROUP BY visitID ORDER BY datum DESC'); while ($row = $db->fetch_assoc()) { $row['countryname'] = $countries[$row['country']]; $row['time'] = goodtime(time() - $row['datum'], 4); $last[] = $row; } $tpl->assign('last', $last); $user = $db->fetch_assoc('SELECT `registerdate`, rankname, `clicks`, `logins`, `comments`, a.money, iconname, `msg_s`, `msg_r`, `profilhits`, `scheine`, `2er`, `3er`, `4er`, COUNT(b.scheinID) as scheine FROM ' . DB_PRE . 'ecp_user LEFT JOIN ' . DB_PRE . 'ecp_user_stats as a ON (a.userID = ID) LEFT JOIN ' . DB_PRE . 'ecp_ranks ON (rID = rankID) LEFT JOIN ' . DB_PRE . 'ecp_lotto_scheine as b ON (b.userID = ID) WHERE ID = ' . $id . ' GROUP BY ID'); $db->query('SELECT SUM(gewinn) as gewinn, art FROM ' . DB_PRE . 'ecp_lotto_gewinner WHERE userID = ' . $id . ' GROUP BY art'); $user['wonmoney'] = 0; $user['2ermoney'] = 0; $user['3ermoney'] = 0; $user['4ermoney'] = 0; while ($row = $db->fetch_assoc()) { $user['wonmoney'] += $row['gewinn']; $user[$row['art'] . 'ermoney'] = $row['gewinn']; } $user['runden'] = $db->result(DB_PRE . 'ecp_lotto_scheine', 'COUNT(DISTINCT(rundenID)) as runden', 'userID = ' . $id); $user['gesamtrunden'] = mysql_result($db->query('SHOW TABLE STATUS LIKE "' . DB_PRE . 'ecp_lotto_runden"'), 0, 'Auto_increment') - 1; $user['tage'] = ceil((time() - $user['registerdate']) / 86400); $user['teilqoute'] = format_nr($user['runden'] / ($user['gesamtrunden'] == 0 ? 1 : $user['gesamtrunden']) * 100, 2); $user['scheinrunde'] = format_nr($user['scheine'] / ($user['runden'] == 0 ? 1 : $user['runden']), 2); $user['winscheine'] = format_nr($user['2er'] + $user['3er'] + $user['4er']); $user['winqoute'] = format_nr($user['winscheine'] / ($user['scheine'] == 0 ? 1 : $user['scheine']) * 100, 2); $user['registerdate'] = date(LONG_DATE, $user['registerdate']); $user['2erpro'] = format_nr($user['2er'] / ($user['winscheine'] == 0 ? 1 : $user['winscheine']) * 100, 2); $user['3erpro'] = format_nr($user['3er'] / ($user['winscheine'] == 0 ? 1 : $user['winscheine']) * 100, 2); $user['4erpro'] = format_nr($user['4er'] / ($user['winscheine'] == 0 ? 1 : $user['winscheine']) * 100, 2); $user['2ermpro'] = format_nr($user['2ermoney'] / ($user['wonmoney'] == 0 ? 1 : $user['wonmoney']) * 100, 2); $user['3ermpro'] = format_nr($user['3ermoney'] / ($user['wonmoney'] == 0 ? 1 : $user['wonmoney']) * 100, 2); $user['4ermpro'] = format_nr($user['4ermoney'] / ($user['wonmoney'] == 0 ? 1 : $user['wonmoney']) * 100, 2); foreach ($user as $key => $value) { if ($key == 'clicks' or $key == 'comments' or $key == 'gesamtrunden' or $key == 'runden' or $key == 'msg_s' or $key == 'msg_r' or $key == 'profilhits' or $key == 'scheine' or $key == '2er' or $key == '3er' or $key == '4er') { $value = format_nr($value); } if ($key == 'money' or $key == 'wonmoney' or $key == '2ermoney' or $key == '3ermoney' or $key == '4ermoney') { $value = format_nr($value, 2); } $tpl->assign($key, $value); } $db->query('SELECT `awardID`, `eventname`, `eventdatum`, `url`, `platz`, `teamID`, `gID`, `preis`, tname, icon, gamename, COUNT(comID) as comments FROM `' . DB_PRE . 'ecp_awards` LEFT JOIN ' . DB_PRE . 'ecp_teams ON tID = teamID LEFT JOIN ' . DB_PRE . 'ecp_wars_games ON gameID = gID LEFT JOIN ' . DB_PRE . 'ecp_comments ON (bereich = "awards" AND subID = awardID) WHERE spieler LIKE "%,' . $id . ',%" GROUP BY awardID ORDER BY eventdatum DESC'); $awards = array(); while ($row = $db->fetch_assoc()) { $row['eventdatum'] = date('d.m.Y', $row['eventdatum']); $awards[] = $row; } $tpl->assign('awards', $awards); $tpl->assign('award', count($awards)); $db->query('SELECT `warID`, ' . DB_PRE . 'ecp_wars.datum, `result`, `resultscore`, `tname`, `oppname`, `country`, ' . DB_PRE . 'ecp_wars_opp.homepage, `icon`, `gamename`, `matchtypename`, COUNT(comID) as comments FROM ' . DB_PRE . 'ecp_wars LEFT JOIN ' . DB_PRE . 'ecp_teams ON ' . DB_PRE . 'ecp_teams.tID = ' . DB_PRE . 'ecp_wars.tID LEFT JOIN ' . DB_PRE . 'ecp_wars_games ON gID = gameID LEFT JOIN ' . DB_PRE . 'ecp_wars_opp ON oID = oppID LEFT JOIN ' . DB_PRE . 'ecp_wars_matchtype ON mID = matchtypeID LEFT JOIN ' . DB_PRE . 'ecp_comments ON (subID = warID AND bereich = "clanwars") WHERE status = 1 AND ownplayers LIKE "%,' . $id . ',%" GROUP BY warID ORDER BY datum DESC'); $clanwars = array(); while ($row = $db->fetch_assoc()) { $row['datum'] = date('d.m.y', $row['datum']); $row['countryname'] = $countries[$row['country']]; $clanwars[] = $row; } $tpl->assign('clanwars', $clanwars); $tpl->assign('clanwar', count($clanwars)); ob_start(); $tpl->display(DESIGN . '/tpl/user/user_stats.html'); $content = ob_get_contents(); ob_end_clean(); $tpl->assign('stats', $content); ob_start(); $db->query('SELECT gID, name FROM `' . DB_PRE . 'ecp_user_groups` LEFT JOIN `' . DB_PRE . 'ecp_groups` ON (gID = groupID) WHERE userID = ' . $id . ' ORDER BY name ASC'); $gruppen = array(); while ($row = $db->fetch_assoc()) { if (array_key_exists($row['name'], $groups)) { $row['name'] = $groups[$row['name']]; } $gruppen[] = $row; } $tpl->assign('gruppen', $gruppen); $tpl->display(DESIGN . '/tpl/user/user_details.html'); $content = ob_get_contents(); ob_end_clean(); main_content(USER_PROFIL, $content, '', 1); } else { table(ERROR, NO_ENTRIES_ID); } } else { table(ERROR, ACCESS_DENIED); } }
<?php if (defined('VERSION')) { $tpls = new smarty(); $db->query('SELECT uID FROM ' . DB_PRE . 'ecp_online WHERE lastklick > ' . (time() - SHOW_USER_ONLINE)); while ($row1 = $db->fetch_assoc()) { if ($row1['uID'] == 0) { @$guest++; } else { @$users++; } @$gesamt++; } $tpls->assign('gesamt', format_nr(@$gesamt)); $tpls->assign('guests', format_nr(@$guest)); $tpls->assign('users', format_nr(@$users)); $tpls->display(DESIGN . '/tpl/modul/user_online.html'); } else { echo 'Kein direktes Aufrufen der Datei!'; }
function setTSUsers($uArray, $ip, $port, $tPort) { $array = array(); for ($i = 1; $i < count($uArray); $i++) { $innerArray = $uArray[$i]; $subarray = array(); $subarray['icon'] = setUserStatus($innerArray[12]); $subarray['name'] = "<strong>" . removeChar($innerArray[14]) . "</strong> (" . setPPriv($innerArray[11]) . "" . setCPriv($innerArray[10]) . ")"; $subarray['channel'] = getChannelName($innerArray[1], $ip, $port, $tPort); $subarray['ping'] = format_nr($innerArray[7], 0); $subarray['loggedin'] = goodtime((int) $innerArray[8], (int) $innerArray[8] > 86400 ? 1 : 3); $subarray['idle'] = goodtime((int) $innerArray[9]); $array[] = $subarray; } return $array; }