I was able to obtain some hark code
-2
It's not really anything special, but in any case I'm posting it here for the heck of it.
The name is "db_stored_procs.inc"
<?php
/* XXX: This really needs to be put somewhere else */
function dbsp_normalize_manga(&$manga) {
if (!$manga['description'])
$manga['description'] = 'No description has been written.';
if (!$manga['sample'])
$manga['sample'] = 'sample.gif';
else
$manga['sample'] = 'thumbs/' . $manga['sample'];
if (!$manga['cover'])
$manga['cover'] = 'cover.gif';
else
$manga['cover'] = 'thumbs/' . $manga['cover'];
$manga['sample'] = "https://www.fakku.net/manga/{$manga['section']}/{$manga['folder']}/{$manga['sample']}";
$manga['cover'] = "https://www.fakku.net/manga/{$manga['section']}/{$manga['folder']}/{$manga['cover']}";
return $manga;
}
function dbsp_related_manga($manga, $offset = 0, $limit = 5, $term = '') {
list($count, $ids) = sphinx_related_manga
( $manga
, $offset
, $limit
);
if ($ids) {
$id_list = implode(',', $ids);
$ret = db_query_cached
( $term
, 10800
, "
-- db_related_manga (idlist)
SELECT m.*
, s.series AS series_name
, m.translation AS translator
FROM content_manga m
LEFT JOIN doujinshi_series s
ON s.series_id = m.series
WHERE
m.content_active = 1
AND m.content_id IN ({$id_list})
");
}
else {
$ret = array();
}
return array($count, $ret);
}
function dbsp_forum_data($forum_id = null) {
if ($x = cache_get(cache_key_forum_list())) {
list($cat_by_id, $forum_by_id) = $x;
}
else {
$categories = db_query
( "
SELECT *
FROM phpbb_categories c
ORDER BY cat_order
");
$forums = db_query
( "
SELECT
*
, f.forum_id AS forum_id
FROM phpbb_forums f
LEFT JOIN phpbb_posts p
ON f.forum_last_post_id = p.post_id
LEFT JOIN phpbb_topics t
ON p.topic_id = t.topic_id
LEFT JOIN phpbb_users u
ON u.user_id = p.poster_id
-- Order by attached_forum_id so that a forum
-- is guarenteed to be collated before its parent
ORDER BY attached_forum_id ASC, forum_order
");
$cat_by_id = array();
$forum_by_id = array();
/* Collate the categories by id */
foreach ($categories as $c)
$cat_by_id[$c['cat_id']] = $c;
/* Then dump the forums */
foreach ($forums as &$f) {
$tmp =& $cat_by_id[$f['cat_id']];
if (!isset($tmp['forums']))
$tmp['forums'] = array();
$forum_by_id[$f['forum_id']] =& $f;
$f['children'] = array();
if ($f['attached_forum_id'] != -1) {
$forum_by_id[$f['attached_forum_id']]['children'][] =& $f;
}
else {
$tmp['forums'][] =& $f;
}
}
cache_set
( cache_key_forum_list()
, array($cat_by_id, $forum_by_id)
, 86400
);
}
if ($forum_id) {
$auth = auth_get_forum($forum_id);
if (!$auth['auth_view'])
error_message("You do not have permission to view this forum");
return $forum_by_id[$forum_id];
}
else {
/* Strip out all the hidden forums from this listing
* XXX: ugh this is gonna be slow */
foreach ($cat_by_id as &$cat)
_dbsp_strip_hidden_forums($cat['forums']);
return $cat_by_id;
}
}
function _dbsp_strip_hidden_forums(&$forums) {
$forums = array_filter
( $forums
, create_function
( '&$f'
, '
$auth = auth_get_forum($f["forum_id"]);
return $auth["auth_view"];
')
);
foreach ($forums as &$f) {
_dbsp_strip_hidden_forums($f['children']);
}
}
/* XXX: This needs to be refactored */
function _dbsp_forum_topics_by_type($forum_id, $type) {
return db_query_cached
( cache_key_forum_topics_by_type($forum_id, $type)
, 1
, "
SELECT
t.*
, p_last.post_username AS last_username
, p.*
, p.post_username AS username
, pt.*
, t.topic_id AS topic_id
FROM phpbb_topics t
INNER JOIN phpbb_posts p
ON t.topic_first_post_id = p.post_id
INNER JOIN phpbb_posts_text pt
ON p.post_id = pt.post_id
INNER JOIN phpbb_posts p_last
ON t.topic_last_post_id = p_last.post_id
WHERE
t.forum_id = ?
AND t.topic_type = ?
ORDER BY p_last.post_time DESC
"
, array($forum_id, $type)
);
}
function dbsp_forum_stickies($forum_id) {
return _dbsp_forum_topics_by_type($forum_id, POST_STICKY);
}
function dbsp_forum_topics($forum_id, $start = 0) {
$key = cache_key_forum_topics($forum_id, $start);
if ($topics = cache_get($key))
return $topics;
/* Don't join on the phpbb_posts table here for the OP --
* joining on the same table twice causes MySQL to copy
* everything to a temporary table = SLOW. We need to sort
* on the p_last.post_time, so we _HAVE_ to join that table.
* Offload the other post information to a separate query. */
/* XXX: I think the above may be incorrect */
$topics = db_query
( "
SELECT
t.*
, p_last.post_username AS last_username
, p.*
, p.post_username AS username
, pt.post_image
, pt.post_thumb
, pt.bbcode_uid
, LEFT(pt.post_cached,120) AS post_cached
, t.topic_id AS topic_id
FROM phpbb_topics t
INNER JOIN phpbb_posts p
ON t.topic_first_post_id = p.post_id
INNER JOIN phpbb_posts_text pt
ON p.post_id = pt.post_id
INNER JOIN phpbb_posts p_last
ON t.topic_last_post_id = p_last.post_id
WHERE t.forum_id = ?
AND t.topic_type != ?
ORDER BY p_last.post_time DESC
LIMIT 20
OFFSET ?
"
, array
( $forum_id
, POST_STICKY
, $start
)
);
foreach ($topics as &$t) {
/* LOL FUCK XXX SHOULDN'T DO THIS HERE (MAYBE) */
if ($t['post_cached']) {
$t['post_text'] = $t['post_cached'];
}
else {
bbcode_apply($t['post_text'], $t['bbcode_uid']);
if (rand(0, 10) == 0) {
db_query
( "
UPDATE LOW_PRIORITY phpbb_posts_text
SET post_cached = ?
WHERE post_id = ?
"
, array
( $t['post_text']
, $t['post_id']
)
);
}
}
if (isset($t['post_text']))
unset($t['post_text']);
}
cache_set($key, $topics);
return $topics;
}
function dbsp_topic_data($topic_id) {
$r = db_query
( "
SELECT *
FROM phpbb_topics
WHERE topic_id = ?
"
, array($topic_id)
);
if ($r)
return $r[0];
else
return null;
}
function dbsp_topic_posts($topic_id, $start) {
/* Don't let it go negative */
$start = max(0, $start);
/* XXX: blockcache */
$topic_posts = db_query
( "
SELECT *
FROM phpbb_posts p
LEFT JOIN phpbb_posts_text pt
ON p.post_id = pt.post_id
LEFT JOIN phpbb_users u
ON p.poster_id = u.user_id
WHERE
p.topic_id = ?
ORDER BY p.post_time ASC
LIMIT 15
OFFSET ?
"
, array($topic_id, $start)
);
foreach ($topic_posts as &$topic_post) {
if ($topic_post['post_cached']) {
$topic_post['post_text'] = $topic_post['post_cached'];
}
else {
bbcode_apply($topic_post['post_text'], $topic_post['bbcode_uid']);
if (rand(0, 10) == 0) {
db_query
( "
UPDATE LOW_PRIORITY phpbb_posts_text
SET post_cached = ?
WHERE post_id = ?
"
, array
( $topic_post['post_text']
, $topic_post['post_id']
)
);
}
}
if (isset($topic_post['post_cached']))
unset($topic_post['post_cached']);
$topic_post['user_rank'] = rank_compute($topic_post);
}
return $topic_posts;
}
function dbsp_user_groups($user_id) {
$r = db_query
( "
SELECT group_id
FROM phpbb_user_group
WHERE
user_id = ?
AND user_pending = 0
"
, array($user_id)
);
return array_map
( create_function
( '$x'
, 'return $x["group_id"];'
)
, $r
);
}
function dbsp_user_in_group($user_id, $group_name) {
$r = db_query
( "
SELECT group_id
FROM phpbb_groups
WHERE group_name = ?
LIMIT 1
"
, array($group_name)
);
$group_id = $r[0]['group_id'];
$user_groups = dbsp_user_groups($user_id);
return in_array($group_id, $user_groups);
}
The name is "db_stored_procs.inc"
<?php
/* XXX: This really needs to be put somewhere else */
function dbsp_normalize_manga(&$manga) {
if (!$manga['description'])
$manga['description'] = 'No description has been written.';
if (!$manga['sample'])
$manga['sample'] = 'sample.gif';
else
$manga['sample'] = 'thumbs/' . $manga['sample'];
if (!$manga['cover'])
$manga['cover'] = 'cover.gif';
else
$manga['cover'] = 'thumbs/' . $manga['cover'];
$manga['sample'] = "https://www.fakku.net/manga/{$manga['section']}/{$manga['folder']}/{$manga['sample']}";
$manga['cover'] = "https://www.fakku.net/manga/{$manga['section']}/{$manga['folder']}/{$manga['cover']}";
return $manga;
}
function dbsp_related_manga($manga, $offset = 0, $limit = 5, $term = '') {
list($count, $ids) = sphinx_related_manga
( $manga
, $offset
, $limit
);
if ($ids) {
$id_list = implode(',', $ids);
$ret = db_query_cached
( $term
, 10800
, "
-- db_related_manga (idlist)
SELECT m.*
, s.series AS series_name
, m.translation AS translator
FROM content_manga m
LEFT JOIN doujinshi_series s
ON s.series_id = m.series
WHERE
m.content_active = 1
AND m.content_id IN ({$id_list})
");
}
else {
$ret = array();
}
return array($count, $ret);
}
function dbsp_forum_data($forum_id = null) {
if ($x = cache_get(cache_key_forum_list())) {
list($cat_by_id, $forum_by_id) = $x;
}
else {
$categories = db_query
( "
SELECT *
FROM phpbb_categories c
ORDER BY cat_order
");
$forums = db_query
( "
SELECT
*
, f.forum_id AS forum_id
FROM phpbb_forums f
LEFT JOIN phpbb_posts p
ON f.forum_last_post_id = p.post_id
LEFT JOIN phpbb_topics t
ON p.topic_id = t.topic_id
LEFT JOIN phpbb_users u
ON u.user_id = p.poster_id
-- Order by attached_forum_id so that a forum
-- is guarenteed to be collated before its parent
ORDER BY attached_forum_id ASC, forum_order
");
$cat_by_id = array();
$forum_by_id = array();
/* Collate the categories by id */
foreach ($categories as $c)
$cat_by_id[$c['cat_id']] = $c;
/* Then dump the forums */
foreach ($forums as &$f) {
$tmp =& $cat_by_id[$f['cat_id']];
if (!isset($tmp['forums']))
$tmp['forums'] = array();
$forum_by_id[$f['forum_id']] =& $f;
$f['children'] = array();
if ($f['attached_forum_id'] != -1) {
$forum_by_id[$f['attached_forum_id']]['children'][] =& $f;
}
else {
$tmp['forums'][] =& $f;
}
}
cache_set
( cache_key_forum_list()
, array($cat_by_id, $forum_by_id)
, 86400
);
}
if ($forum_id) {
$auth = auth_get_forum($forum_id);
if (!$auth['auth_view'])
error_message("You do not have permission to view this forum");
return $forum_by_id[$forum_id];
}
else {
/* Strip out all the hidden forums from this listing
* XXX: ugh this is gonna be slow */
foreach ($cat_by_id as &$cat)
_dbsp_strip_hidden_forums($cat['forums']);
return $cat_by_id;
}
}
function _dbsp_strip_hidden_forums(&$forums) {
$forums = array_filter
( $forums
, create_function
( '&$f'
, '
$auth = auth_get_forum($f["forum_id"]);
return $auth["auth_view"];
')
);
foreach ($forums as &$f) {
_dbsp_strip_hidden_forums($f['children']);
}
}
/* XXX: This needs to be refactored */
function _dbsp_forum_topics_by_type($forum_id, $type) {
return db_query_cached
( cache_key_forum_topics_by_type($forum_id, $type)
, 1
, "
SELECT
t.*
, p_last.post_username AS last_username
, p.*
, p.post_username AS username
, pt.*
, t.topic_id AS topic_id
FROM phpbb_topics t
INNER JOIN phpbb_posts p
ON t.topic_first_post_id = p.post_id
INNER JOIN phpbb_posts_text pt
ON p.post_id = pt.post_id
INNER JOIN phpbb_posts p_last
ON t.topic_last_post_id = p_last.post_id
WHERE
t.forum_id = ?
AND t.topic_type = ?
ORDER BY p_last.post_time DESC
"
, array($forum_id, $type)
);
}
function dbsp_forum_stickies($forum_id) {
return _dbsp_forum_topics_by_type($forum_id, POST_STICKY);
}
function dbsp_forum_topics($forum_id, $start = 0) {
$key = cache_key_forum_topics($forum_id, $start);
if ($topics = cache_get($key))
return $topics;
/* Don't join on the phpbb_posts table here for the OP --
* joining on the same table twice causes MySQL to copy
* everything to a temporary table = SLOW. We need to sort
* on the p_last.post_time, so we _HAVE_ to join that table.
* Offload the other post information to a separate query. */
/* XXX: I think the above may be incorrect */
$topics = db_query
( "
SELECT
t.*
, p_last.post_username AS last_username
, p.*
, p.post_username AS username
, pt.post_image
, pt.post_thumb
, pt.bbcode_uid
, LEFT(pt.post_cached,120) AS post_cached
, t.topic_id AS topic_id
FROM phpbb_topics t
INNER JOIN phpbb_posts p
ON t.topic_first_post_id = p.post_id
INNER JOIN phpbb_posts_text pt
ON p.post_id = pt.post_id
INNER JOIN phpbb_posts p_last
ON t.topic_last_post_id = p_last.post_id
WHERE t.forum_id = ?
AND t.topic_type != ?
ORDER BY p_last.post_time DESC
LIMIT 20
OFFSET ?
"
, array
( $forum_id
, POST_STICKY
, $start
)
);
foreach ($topics as &$t) {
/* LOL FUCK XXX SHOULDN'T DO THIS HERE (MAYBE) */
if ($t['post_cached']) {
$t['post_text'] = $t['post_cached'];
}
else {
bbcode_apply($t['post_text'], $t['bbcode_uid']);
if (rand(0, 10) == 0) {
db_query
( "
UPDATE LOW_PRIORITY phpbb_posts_text
SET post_cached = ?
WHERE post_id = ?
"
, array
( $t['post_text']
, $t['post_id']
)
);
}
}
if (isset($t['post_text']))
unset($t['post_text']);
}
cache_set($key, $topics);
return $topics;
}
function dbsp_topic_data($topic_id) {
$r = db_query
( "
SELECT *
FROM phpbb_topics
WHERE topic_id = ?
"
, array($topic_id)
);
if ($r)
return $r[0];
else
return null;
}
function dbsp_topic_posts($topic_id, $start) {
/* Don't let it go negative */
$start = max(0, $start);
/* XXX: blockcache */
$topic_posts = db_query
( "
SELECT *
FROM phpbb_posts p
LEFT JOIN phpbb_posts_text pt
ON p.post_id = pt.post_id
LEFT JOIN phpbb_users u
ON p.poster_id = u.user_id
WHERE
p.topic_id = ?
ORDER BY p.post_time ASC
LIMIT 15
OFFSET ?
"
, array($topic_id, $start)
);
foreach ($topic_posts as &$topic_post) {
if ($topic_post['post_cached']) {
$topic_post['post_text'] = $topic_post['post_cached'];
}
else {
bbcode_apply($topic_post['post_text'], $topic_post['bbcode_uid']);
if (rand(0, 10) == 0) {
db_query
( "
UPDATE LOW_PRIORITY phpbb_posts_text
SET post_cached = ?
WHERE post_id = ?
"
, array
( $topic_post['post_text']
, $topic_post['post_id']
)
);
}
}
if (isset($topic_post['post_cached']))
unset($topic_post['post_cached']);
$topic_post['user_rank'] = rank_compute($topic_post);
}
return $topic_posts;
}
function dbsp_user_groups($user_id) {
$r = db_query
( "
SELECT group_id
FROM phpbb_user_group
WHERE
user_id = ?
AND user_pending = 0
"
, array($user_id)
);
return array_map
( create_function
( '$x'
, 'return $x["group_id"];'
)
, $r
);
}
function dbsp_user_in_group($user_id, $group_name) {
$r = db_query
( "
SELECT group_id
FROM phpbb_groups
WHERE group_name = ?
LIMIT 1
"
, array($group_name)
);
$group_id = $r[0]['group_id'];
$user_groups = dbsp_user_groups($user_id);
return in_array($group_id, $user_groups);
}
0
NEXUS
Since 2010
Tegumi wrote...
Being able to see the site code is a bad thing.This thread should be deleted then.
0
Oh come on, it's not like I know the directory where all of it is hidden, oh wait, I do, but that's not the point and I'm not going to say it.
However, in the end, this code gave no DB usernames or passwords. That's the only real harm in showing the code, so I see no problem.
However, in the end, this code gave no DB usernames or passwords. That's the only real harm in showing the code, so I see no problem.
0
NEXUS
Since 2010
phallus99 wrote...
Oh come on, it's not like I know the directory where all of it is hidden, oh wait, I do, but that's not the point and I'm not going to say it.However, in the end, this code gave no DB usernames or passwords. That's the only real harm in showing the code, so I see no problem.
People could hack the site you fool. And after Jacob and others have put so much time
and effort into fixing the site.
0
SLAYER NEXUS wrote...
phallus99 wrote...
Oh come on, it's not like I know the directory where all of it is hidden, oh wait, I do, but that's not the point and I'm not going to say it.However, in the end, this code gave no DB usernames or passwords. That's the only real harm in showing the code, so I see no problem.
People could hack the site you fool. And after Jacob and others have put so much time
and effort into fixing the site.
Not with this they couldn't.
0
That's not "hacking the site", although it is an interesting trick. I was unaware that there was a way to embed html in posts. Cool.
0
Tegumi
"im always cute"
I meant it is a bad thing as the site is obviously not functioning correctly. That or you were somehow able to access the Apache directory which is in itself a security risk.