本文整理汇总了PHP中convredirect函数的典型用法代码示例。如果您正苦于以下问题:PHP convredirect函数的具体用法?PHP convredirect怎么用?PHP convredirect使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了convredirect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: myerror
<?php
// Fetch forum info
$result = $fdb->query('SELECT b.*,m.posterName,m.ID_MSG,m.posterTime FROM ' . $fdb->prefix . 'boards AS b LEFT JOIN ' . $fdb->prefix . 'messages AS m ON b.ID_LAST_TOPIC=ID_MSG WHERE ID_BOARD>' . $start . ' ORDER BY ID_BOARD LIMIT ' . $_SESSION['limit']) or myerror('phpBB: Unable to get table: forums', __FILE__, __LINE__, $fdb->error());
$last_id = -1;
while ($ob = $fdb->fetch_assoc($result)) {
$last_id = $ob['ID_BOARD'];
echo htmlspecialchars($ob['name']) . ' (' . $ob['ID_BOARD'] . ")<br>\n";
flush();
// Dataarray
$todb = array('id' => $ob['ID_BOARD'], 'forum_name' => $ob['name'], 'forum_desc' => $ob['description'], 'num_topics' => $ob['numTopics'], 'num_posts' => $ob['numPosts'], 'disp_position' => $ob['boardOrder'], 'last_poster' => $ob['posterName'], 'last_post_id' => $ob['ID_MSG'], 'last_post' => $ob['posterTime'], 'cat_id' => $ob['ID_CAT']);
// Save data
insertdata('forums', $todb, __FILE__, __LINE__);
}
convredirect('ID_BOARD', 'boards', $last_id);
示例2: next_step
// Check if AutoPoll is installed
if ($start == 0 && !$db->table_exists('polls')) {
next_step();
}
$result = $fdb->query('SELECT vote_id,topic_id,vote_text,vote_start FROM ' . $fdb->prefix . $_SESSION['phpnuke'] . 'vote_desc WHERE vote_id>' . $start . ' ORDER BY vote_id LIMIT ' . $_SESSION['limit']) or myerror('Unable to fetch poll info', __FILE__, __LINE__, $fdb->error());
$last_id = -1;
while ($ob = $fdb->fetch_assoc($result)) {
$last_id = $ob['vote_id'];
echo htmlspecialchars($ob['vote_text']) . ' (' . $ob['vote_id'] . ")<br>\n";
flush();
$answers = null;
$results = null;
$vote_results = $fdb->query('SELECT vote_option_text,vote_result FROM ' . $fdb->prefix . $_SESSION['phpnuke'] . 'vote_results WHERE vote_id=' . $ob['vote_id'] . ' ORDER BY vote_option_id') or myerror("Unable to get poll answers.", __FILE__, __LINE__, $fdb->error());
while (list($vote_option_text, $vote_result) = $fdb->fetch_row($vote_results)) {
$answers[] = htmlspecialchars($vote_option_text, ENT_QUOTES);
$results[] = $vote_result;
}
$voter_ids = null;
$vote_results = $fdb->query('SELECT vote_user_id FROM ' . $fdb->prefix . $_SESSION['phpnuke'] . 'vote_voters WHERE vote_id=' . $ob['vote_id']) or myerror("PhpBB: Unable to get poll voters.", __FILE__, __LINE__, $fdb->error());
while (list($voters) = $fdb->fetch_row($vote_results)) {
$voter_ids[] = $voters;
}
$db->query('UPDATE ' . $db->prefix . 'topics SET question=\'' . $db->escape(convert_to_utf8($ob['vote_text'])) . '\' WHERE id=' . $ob['topic_id']) or myerror("PhpBB: Unable to get poll voters.", __FILE__, __LINE__, $fdb->error());
// Dataarray
$todb = array('id' => $ob['vote_id'], 'pollid' => $ob['topic_id'], 'ptype' => 1, 'options' => serialize($answers), 'voters' => serialize($voter_ids), 'votes' => serialize($results), 'created' => $ob['vote_start']);
// Save data
insertdata('polls', $todb, __FILE__, __LINE__);
}
convredirect('vote_id', $_SESSION['phpnuke'] . 'vote_desc', $last_id);
示例3: myerror
)') or myerror("Unable to save post", __FILE__, __LINE__, $db->error());
break;
// 0: Read the message [ Inbox ]
// 3: Saved a message [ Savebox ]
// 0: Read the message [ Inbox ]
// 3: Saved a message [ Savebox ]
case 0:
case 3:
$ob['owner'] = $ob['privmsgs_to_userid'];
$ob['sender'] = $ob['privmsgs_from_userid'];
$ob['status'] = 0;
$ob['showed'] = 1;
break;
}
// Save to database
$db->query('INSERT INTO ' . $db->prefix . 'messages
(owner, subject, message, sender, sender_id, posted, sender_ip, smileys, status, showed) VALUES(
' . $ob['owner'] . ',
\'' . addslashes($ob['privmsgs_subject']) . '\',
\'' . addslashes($ob['privmsgs_text']) . '\',
\'' . addslashes($ob['username']) . '\',
' . $ob['sender'] . ',
' . $ob['privmsgs_date'] . ',
\'' . decode_ip($ob['privmsgs_ip']) . '\',
' . $ob['privmsgs_enable_smilies'] . ',
' . $ob['status'] . ',
' . $ob['showed'] . '
)') or myerror("Unable to save post", __FILE__, __LINE__, $db->error());
}
convredirect('privmsgs_id', $_SESSION['phpnuke'] . 'privmsgs', $last_id);
示例4: myerror
<?php
// Fetch topic info
$result = $fdb->query('SELECT * FROM ' . $fdb->prefix . 'topics WHERE tid > ' . $start . ' ORDER BY tid LIMIT ' . $_SESSION['limit']) or myerror('Unable to get topic info', __FILE__, __LINE__, $fdb->error());
$last_id = -1;
while ($ob = $fdb->fetch_assoc($result)) {
$last_id = $ob['tid'];
echo htmlspecialchars($ob['title']) . ' (' . $ob['tid'] . ")<br>\n";
flush();
// Check id=1 collisions
$ob['starter_id'] == 1 ? $ob['starter_id'] = $_SESSION['admin_id'] : null;
$ob['last_poster_id'] == 1 ? $ob['last_poster_id'] = $_SESSION['admin_id'] : null;
$ob['last_poster_name'] == '' || $ob['last_poster_name'] == null ? $ob['last_poster_name'] = 'null' : null;
// Fetch last_post_id
$res = $fdb->query('SELECT pid FROM ' . $fdb->prefix . 'posts WHERE topic_id=' . $ob['tid'] . ' ORDER BY pid DESC LIMIT 1') or myerror('Unable to get last_post_id', __FILE__, __LINE__, $fdb->error());
$ob['last_post_id'] = $fdb->num_rows($res) > 0 ? $fdb->result($res, 0) : null;
// Dataarray
$todb = array('id' => $ob['tid'], 'poster' => $ob['starter_name'], 'subject' => $ob['title'], 'posted' => $ob['start_date'], 'num_views' => $ob['views'], 'num_replies' => $ob['posts'], 'last_post' => $ob['last_post'], 'last_post_id' => $ob['last_post_id'], 'last_poster' => $ob['last_poster_name'], 'sticky' => $ob['pinned'], 'forum_id' => $ob['forum_id']);
// Save data
insertdata('topics', $todb, __FILE__, __LINE__);
}
convredirect('tid', 'topics', $last_id);
示例5: myerror
<?php
// Fetch posts info
$result = $fdb->query('SELECT post_id, poster_name, post_time, poster_id, poster_ip, topic_id, post_text FROM ' . $fdb->prefix . 'posts WHERE post_id>' . $start . ' ORDER BY post_id LIMIT ' . $_SESSION['limit']) or myerror("Unable to get posts", __FILE__, __LINE__, $fdb->error());
$last_id = -1;
while ($ob = $fdb->fetch_assoc($result)) {
$last_id = $ob['post_id'];
echo htmlspecialchars($ob['post_id']) . ' (' . $ob['poster_name'] . ")<br>\n";
flush();
// Change guest and admin user id
$ob['poster_id'] == 1 ? $ob['poster_id'] = $_SESSION['admin_id'] : null;
if ($ob['poster_id'] == 0) {
$ob['poster_id'] = 1;
}
// Dataarray
$todb = array('id' => $ob['post_id'], 'poster' => $ob['poster_name'], 'poster_id' => $ob['poster_id'], 'posted' => strtotime($ob['post_time']), 'poster_ip' => $ob['poster_ip'], 'message' => convert_posts($ob['post_text']), 'topic_id' => $ob['topic_id']);
// Save data
insertdata('posts', $todb, __FILE__, __LINE__);
}
convredirect('post_id', 'posts', $last_id);
示例6: flush
flush();
// Check for user/guest collision
if ($ob['id'] == 1) {
// Fetch last user id
$last_result = $fdb->query('SELECT id FROM ' . $_SESSION['php'] . "members ORDER BY id DESC LIMIT 1") or myerror('Unable to fetch last user id', __FILE__, __LINE__, $fdb->error());
list($last_user_id) = $fdb->fetch_row($last_result);
$ob['id'] = ++$last_user_id;
$_SESSION['admin_id'] = $ob['id'];
}
// Posts and topics settings
list($ob['disp_posts'], $ob['disp_topics']) = explode("&", $ob['view_prefs']);
$ob['disp_posts'] < 3 ? $ob['disp_posts'] = 'null' : null;
$ob['disp_topics'] < 3 ? $ob['disp_topics'] = 'null' : null;
// Last_post should be 'null' instead of 0
$ob['last_post'] == null ? $ob['last_post'] = 'null' : null;
// Ver 1.3 specific stuff
if ($_SESSION['ver'] == "13") {
$ob['signature'] = preg_replace('#\\<br>#i', "\r\n", $ob['signature']);
} else {
$ob['password'] = '';
}
// Dataarray
$todb = array('id' => $ob['id'], 'username' => $ob['name'], 'password' => $ob['password'], 'url' => $ob['website'], 'icq' => $ob['icq_number'], 'msn' => $ob['msnname'], 'aim' => $ob['aim_name'], 'yahoo' => $ob['yahoo'], 'signature' => convert_posts($ob['signature']), 'location' => $ob['location'], 'timezone' => $ob['time_offset'], 'num_posts' => $ob['posts'], 'last_post' => $ob['last_post'], 'show_img' => $ob['view_img'], 'show_avatars' => $ob['view_avs'], 'show_sig' => $ob['view_sigs'], 'registered' => $ob['joined'], 'last_visit' => $ob['last_visit'], 'email_setting' => (int) ($ob['hide_email'] == "0"), 'email' => $ob['email']);
if ($_SESSION['pun_version'] == '1.1') {
$todb['last_action'] = $ob['last_activity'];
}
// Save data
insertdata('users', $todb, __FILE__, __LINE__);
}
convredirect('id', 'members', $last_id);
示例7: myerror
<?php
$result = $fdb->query('SELECT post.post_id, post.post_time, post.poster_id, post.poster_ip, post.topic_id, text.post_subject, text.post_text, users.username FROM ' . $_SESSION['php'] . $_SESSION['phpnuke'] . 'posts AS post, ' . $_SESSION['php'] . $_SESSION['phpnuke'] . 'posts_text AS text, ' . $_SESSION['php'] . 'users AS users WHERE post.post_id>' . $start . ' AND post.post_id=text.post_id AND users.user_id=post.poster_id ORDER BY post.post_id LIMIT ' . $_SESSION['limit']) or myerror("Unable to get posts", __FILE__, __LINE__, $fdb->error());
$last_id = -1;
while ($ob = $fdb->fetch_assoc($result)) {
$last_id = $ob['post_id'];
echo $ob['post_id'] . ' (' . $ob['username'] . ")<br>\n";
flush();
// Check for anonymous poster id problem
if ($ob['poster_id'] == -1) {
$ob['poster_id'] = 1;
$ob['username'] = 'Guest';
}
// Dataarray
$todb = array('id' => $ob['post_id'], 'poster' => $ob['username'], 'poster_id' => $ob['poster_id'], 'posted' => $ob['post_time'], 'poster_ip' => decode_ip($ob['poster_ip']), 'message' => convert_posts($ob['post_text']), 'topic_id' => $ob['topic_id']);
// Save data
insertdata('posts', $todb, __FILE__, __LINE__);
}
convredirect('post_id', $_SESSION['phpnuke'] . 'posts', $last_id);
示例8: next_step
// Check if New PMS mod is installed
if ($start == 0 && !$db->table_exists('pms_new_posts')) {
next_step();
}
$result = $fdb->query('SELECT m.*, u.username FROM ' . $fdb->prefix . 'privmsgs AS m LEFT JOIN ' . $fdb->prefix . 'users AS u ON u.user_id=m.author_id WHERE m.msg_id>' . $start . ' ORDER BY m.msg_id LIMIT ' . $_SESSION['limit']) or myerror("Unable to get message list", __FILE__, __LINE__, $fdb->error());
$last_id = -1;
while ($ob = $fdb->fetch_assoc($result)) {
$last_id = $ob['msg_id'];
echo $ob['msg_id'] . "<br>\n";
flush();
$result_msg = $fdb->query('SELECT t.*, u.username FROM ' . $fdb->prefix . 'privmsgs_to AS t, ' . $fdb->prefix . 'users AS u WHERE t.user_id=u.user_id AND t.msg_id=' . $ob['msg_id'] . ' LIMIT 1') or myerror("Unable to get message list", __FILE__, __LINE__, $fdb->error());
$msg = $fdb->fetch_assoc($result_msg);
// Is topic message?
if ($ob['root_level'] != 0) {
$topic_id = $ob['root_level'];
} else {
$to_user = intval(str_replace('u_', '', $ob['to_address']));
$result_username = $fdb->query('SELECT username FROM ' . $fdb->prefix . 'users WHERE user_id=' . $to_user) or myerror('Unable to get username', __FILE__, __LINE__, $fdb->error());
$to_username = $fdb->result($result_username);
$todb = array('id' => $ob['msg_id'], 'topic' => $ob['message_subject'], 'starter' => $ob['username'], 'starter_id' => $ob['author_id'], 'to_user' => $to_username, 'to_id' => $to_user, 'replies' => 1, 'last_posted' => $ob['message_time']);
// Save data
insertdata('pms_new_topics', $todb, __FILE__, __LINE__);
$topic_id = $db->insert_id();
}
// Dataarray
$todb = array('poster' => $ob['username'], 'poster_id' => $ob['author_id'], 'message' => convert_posts($ob['message_text']), 'posted' => $ob['message_time'], 'post_new' => $msg['pm_unread'], 'topic_id' => $topic_id);
// Save data
insertdata('pms_new_posts', $todb, __FILE__, __LINE__);
}
convredirect('msg_id', 'privmsgs', $last_id);
示例9: ceil
<?php
$result = $fdb->query('SELECT ' . $fdb->prefix . 'ban_items.id_ban, ' . $fdb->prefix . 'members.member_name,
ip_low1, ip_low2, ip_low3, ip_low4,
' . $fdb->prefix . 'ban_items.email_address, ' . $fdb->prefix . 'ban_groups.reason, ' . $fdb->prefix . 'ban_groups.expire_time
FROM ' . $fdb->prefix . 'ban_items
INNER JOIN ' . $fdb->prefix . 'ban_groups ON ' . $fdb->prefix . 'ban_groups.id_ban_group = ' . $fdb->prefix . 'ban_items.id_ban_group
LEFT JOIN ' . $fdb->prefix . 'members ON ' . $fdb->prefix . 'members.id_member = ' . $fdb->prefix . 'ban_items.id_member
WHERE id_ban>' . $start . ' ORDER BY id_ban LIMIT ' . ceil($_SESSION['limit'] / 5)) or myerror("Unable to get bans", __FILE__, __LINE__, $fdb->error());
$last_id = -1;
while ($ob = $fdb->fetch_assoc($result)) {
$last_id = $ob['id_ban'];
$ob['member_name'] == '' ? $username = 'null' : ($username = $ob['member_name']);
$ob['ip_low1'] == '0' ? $ip = 'null' : ($ip = trim($ob['ip_low1'] . '.' . $ob['ip_low2'] . '.' . $ob['ip_low3'] . '.' . $ob['ip_low4'], '.'));
$ob['email_address'] == '' ? $email = 'null' : ($email = $ob['email_address']);
$ob['reason'] == '' ? $message = 'null' : ($message = $ob['reason']);
$ob['expire_time'] == '' ? $expire = 'null' : ($expire = strtotime(date('Y-m-d', $ob['expire_time']) . ' GMT'));
echo $ob['id_ban'] . ' - ' . ($username == 'null' ? $email == 'null' ? $ip : $email : $username) . "<br>\n";
flush();
// Dataarray
$todb = array('username' => $username, 'ip' => $ip, 'email' => $email, 'message' => $message, 'expire' => $expire);
// Save data
insertdata('bans', $todb, __FILE__, __LINE__);
}
convredirect('id_ban', 'ban_items', $last_id);
示例10: myerror
<?php
// Fetch topic info
$result = $fdb->query('SELECT * FROM ' . $_SESSION['php'] . 'topics WHERE ID_TOPIC > ' . $start . ' ORDER BY ID_TOPIC LIMIT ' . $_SESSION['limit']) or myerror('Unable to get topic info', __FILE__, __LINE__, $fdb->error());
$last_id = -1;
while ($ob = $fdb->fetch_assoc($result)) {
$last_id = $ob['ID_TOPIC'];
// Fetch last post info
$posts_res = $fdb->query('SELECT * FROM ' . $_SESSION['php'] . 'messages WHERE ID_MSG IN(' . $ob['ID_FIRST_MSG'] . ',' . $ob['ID_LAST_MSG'] . ')') or myerror('Unable to fetch last topic post info', __FILE__, __LINE__, $fdb->error());
$ob['first'] = $fdb->fetch_assoc($posts_res);
$ob['last'] = $fdb->fetch_assoc($posts_res);
$ob['last'] == null ? $ob['last'] = $ob['first'] : null;
echo $ob['first']['subject'] . ' (' . $ob['ID_TOPIC'] . ")<br>\n";
flush();
// Dataarray
$todb = array('id' => $ob['ID_TOPIC'], 'poster' => $ob['first']['posterName'], 'subject' => $ob['first']['subject'], 'posted' => $ob['first']['posterTime'], 'num_views' => $ob['numViews'], 'num_replies' => $ob['numReplies'], 'last_post' => $ob['last']['posterTime'], 'last_post_id' => $ob['last']['ID_MSG'], 'last_poster' => $ob['last']['posterName'], 'sticky' => $ob['isSticky'], 'closed' => $ob['locked'], 'forum_id' => $ob['ID_BOARD']);
// Save data
insertdata('topics', $todb, __FILE__, __LINE__);
}
convredirect('ID_TOPIC', 'topics', $last_id);
示例11: myerror
<?php
if ($start == 0 && $_SESSION['phpnuke'] != '') {
echo '<script type="text/javascript">window.location="index.php?page=' . ++$_GET['page'] . '"</script>';
exit;
}
$result = $fdb->query('SELECT * FROM ' . $_SESSION['php'] . 'banlist WHERE ban_id>' . $start . ' ORDER BY ban_id LIMIT ' . $_SESSION['limit']) or myerror("Unable to get posts", __FILE__, __LINE__, $fdb->error());
$last_id = -1;
while ($ob = $fdb->fetch_assoc($result)) {
$last_id = $ob['ban_id'];
$username = '';
if ($ob['ban_userid'] != 0) {
$res = $db->query('SELECT username FROM ' . $_SESSION['pun'] . 'users WHERE id=' . $ob['ban_userid']) or myerror("Unable to get userinfo for ban", __FILE__, __LINE__, $db->error());
list($username) = $db->fetch_row($res);
}
$ob['ban_ip'] == '' ? $ip = 'null' : ($ip = decode_ip($ob['ban_ip']));
$ob['ban_email'] == '' ? $ob['ban_email'] = 'null' : null;
// Dataarray
$todb = array('username' => $username, 'ip' => $ip, 'email' => $ob['ban_email']);
// Save data
insertdata('bans', $todb, __FILE__, __LINE__);
}
convredirect('ban_id', 'banlist', $last_id);
示例12: myerror
$result = $fdb->query('SELECT * FROM ' . $_SESSION['php'] . 'forum WHERE forumid>' . $start . ' ORDER BY forumid LIMIT ' . $_SESSION['limit']) or myerror('Unable to fetch forum info', __FILE__, __LINE__, $fdb->error());
$last_id = -1;
while ($ob = $fdb->fetch_assoc($result)) {
$last_id = $ob['forumid'];
echo '<br>' . $ob['title'] . ' (' . $ob['forumid'] . ")\n";
flush();
// Forum IS v2.0 category, insert it into the database
if ($ob['parentid'] == -1) {
// Dataarray
$todb = array('id' => $ob['forumid'], 'cat_name' => $ob['title'], 'disp_position' => $ob['displayorder']);
// Save data
insertdata('categories', $todb, __FILE__, __LINE__);
} else {
// Fetch last-post-id
$res = $fdb->query('SELECT postid FROM ' . $_SESSION['php'] . 'post WHERE threadid=' . $ob['lastthreadid'] . ' ORDER BY postid DESC') or myerror('Unable to fetch last-post-info', __FILE__, __LINE__, $fdb->error());
$ob['lastpostid'] = $fdb->result($res, 0);
// Settings
// --> Parent
$parentlist = explode(',', $ob['parentlist']);
$ob['parentid'] = $parentlist[sizeof($parentlist) - 2];
// --> Lastpost & Lastpostid
$ob['lastpost'] == 0 ? $ob['lastpost'] = 'null' : null;
$ob['lastpostid'] == 0 ? $ob['lastpostid'] = 'null' : null;
// Dataarray
$todb = array('id' => $ob['forumid'], 'forum_name' => $ob['title'], 'forum_desc' => $ob['description'], 'num_topics' => $ob['threadcount'], 'num_posts' => $ob['replycount'], 'disp_position' => $ob['displayorder'], 'last_poster' => $ob['lastposter'], 'last_post_id' => $ob['lastpostid'], 'last_post' => $ob['lastpost'], 'cat_id' => $ob['parentid']);
// Save data
insertdata('forums', $todb, __FILE__, __LINE__);
}
}
convredirect('forumid', 'forum', $last_id);
示例13: while
$last_id = 0;
while ($ob = $fdb->fetch_assoc($res)) {
$last_id = $ob['user_id'];
echo htmlspecialchars($ob['user_name']) . ' (' . $ob['user_id'] . ")<br>\n";
flush();
// Fetch last post info
$post_res = $fdb->query('SELECT * FROM ' . $fdb->prefix . 'posts WHERE post_author=' . $ob['user_id'] . ' ORDER BY post_datestamp DESC LIMIT 1') or myerror('Unable to fetch last post info', __FILE__, __LINE__, $fdb->error());
if ($fdb->num_rows($post_res) > 0) {
$last_ob = $fdb->fetch_assoc($post_res);
$ob['last_post_time'] = $last_ob['post_datestamp'];
} else {
$ob['last_post_time'] = 'null';
}
// Check for user/guest collision
if ($ob['user_id'] == 1) {
// Fetch last user id
$last_result = $fdb->query('SELECT user_id FROM ' . $fdb->prefix . "users ORDER BY user_id DESC LIMIT 1") or myerror('Unable to fetch last user id', __FILE__, __LINE__, $fdb->error());
list($last_user_id) = $fdb->fetch_row($last_result);
$ob['user_id'] = ++$last_user_id;
$_SESSION['admin_id'] = $ob['user_id'];
}
// Dataarray
$todb = array('id' => $ob['user_id'], 'username' => $ob['user_name'], 'password' => $ob['user_password'], 'email' => $ob['user_email'], 'url' => $ob['user_web'], 'icq' => $ob['user_icq'], 'msn' => $ob['user_msn'], 'yahoo' => $ob['user_yahoo'], 'signature' => $ob['user_sig'], 'timezone' => $ob['user_offset'], 'num_posts' => $ob['user_posts'], 'last_post' => $ob['last_post_time'], 'registered' => $ob['user_joined'], 'last_visit' => $ob['user_lastvisit'], 'location' => $ob['user_location'], 'email_setting' => !$ob['user_hide_email']);
if ($_SESSION['pun_version'] == '1.1') {
$todb['last_action'] = $ob['user_lastvisit'];
}
// Save data
insertdata('users', $todb, __FILE__, __LINE__);
}
convredirect('user_id', 'users', $last_id);
示例14: ceil
<?php
// Fetch user info
$res = $fdb->query('SELECT * FROM ' . $fdb->prefix . 'members WHERE ID_MEMBER>' . $start . ' ORDER BY ID_MEMBER LIMIT ' . ceil($_SESSION['limit'] / 5)) or myerror('Unable to fetch user info', __FILE__, __LINE__, $fdb->error());
$last_id = -1;
while ($ob = $fdb->fetch_assoc($res)) {
$last_id = $ob['ID_MEMBER'];
echo '<br>' . htmlspecialchars($ob['memberName']) . ' (' . $ob['ID_MEMBER'] . ")\n";
flush();
// Check for user/guest collision
if ($ob['ID_MEMBER'] == 1) {
// Fetch last user id
$last_result = $fdb->query('SELECT ID_MEMBER FROM ' . $fdb->prefix . "members ORDER BY ID_MEMBER DESC LIMIT 1") or myerror('Unable to fetch last user id', __FILE__, __LINE__, $fdb->error());
list($last_user_id) = $fdb->fetch_row($last_result);
$ob['ID_MEMBER'] = ++$last_user_id;
$_SESSION['admin_id'] = $ob['ID_MEMBER'];
}
// Dataarray
$todb = array('id' => $ob['ID_MEMBER'], 'username' => $ob['memberName'], 'password' => $ob['passwd'], 'url' => $ob['websiteUrl'], 'title' => $ob['usertitle'], 'icq' => $ob['ICQ'], 'aim' => $ob['AIM'], 'msn' => $ob['MSN'], 'yahoo' => $ob['YIM'], 'signature' => $ob['signature'], 'timezone' => $ob['timeOffset'], 'num_posts' => $ob['posts'], 'registered' => $ob['dateRegistered'], 'last_visit' => $ob['lastLogin'], 'email_setting' => $ob['hideEmail'], 'location' => $ob['location'], 'email' => $ob['emailAddress']);
if ($_SESSION['pun_version'] == '1.1') {
$todb['last_action'] = $ob['lastLogin'];
}
insertdata('users', $todb, __FILE__, __LINE__);
}
convredirect('ID_MEMBER', 'members', $last_id);
示例15: while
$last_id = -1;
while ($ob = $fdb->fetch_assoc($result)) {
$last_id = $ob['id'];
echo '<br>' . htmlspecialchars($ob['name']) . ' (' . $ob['id'] . ")\n";
flush();
// If parent is zero, it's a categorie
if ($ob['parent'] == 0) {
// Dataarray
$todb = array('id' => $ob['id'], 'cat_name' => $ob['name'], 'disp_position' => $ob['description']);
// Save data
insertdata('categories', $todb, __FILE__, __LINE__);
} else {
// Get last post information
$post_result = $fdb->query('SELECT * FROM ' . $fdb->prefix . 'messages WHERE catid=' . $ob['id'] . ' ORDER BY id DESC LIMIT 1') or myerror("Unable to fetch last post information", __FILE__, __LINE__, $fdb->error());
$post = $fdb->fetch_assoc($post_result);
// Get topic count
$topic_result = $fdb->query('SELECT count(*) FROM ' . $fdb->prefix . 'messages WHERE catid=' . $ob['id'] . ' AND parent=0 ORDER BY id DESC LIMIT 1') or myerror("Unable to fetch last post information", __FILE__, __LINE__, $fdb->error());
$topics = $fdb->fetch_row($topic_result);
$num_topics = $topics[0];
// Get posts count
$posts_result = $fdb->query('SELECT count(*) FROM ' . $fdb->prefix . 'messages WHERE catid=' . $ob['id'] . ' ORDER BY id DESC LIMIT 1') or myerror("Unable to fetch last post information", __FILE__, __LINE__, $fdb->error());
$posts = $fdb->fetch_row($posts_result);
$num_posts = $posts[0];
// Dataarray
$todb = array('id' => $ob['id'], 'forum_name' => $ob['name'], 'forum_desc' => $ob['description'], 'cat_id' => $ob['parent'], 'disp_position' => $ob['ordering'], 'num_topics' => $num_topics, 'num_posts' => $num_posts - $num_topics, 'last_poster' => $post['name'], 'last_post_id' => $post['id'], 'last_post' => $post['time']);
// Save data
insertdata('forums', $todb, __FILE__, __LINE__);
}
}
convredirect('id', 'categories', $last_id);