一个完整的论坛系统(包括后台管理和数据库)
源代码在线查看: my.inc.php
/*
[Discuz!] (C)2001-2007 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: my.inc.php 9806 2007-08-15 06:04:37Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(empty($discuz_uid)) {
wapmsg('not_loggedin');
}
$uid = !empty($uid) ? intval($uid) : $discuz_uid;
$username = !empty($username) ? dhtmlspecialchars($username) : '';
$usernameadd = $uid ? "m.uid='$uid'" : "m.username='$username'";
if(empty($do)) {
$query = $db->query("SELECT m.*, mf.* FROM {$tablepre}members m
LEFT JOIN {$tablepre}memberfields mf ON mf.uid=m.uid
WHERE $usernameadd LIMIT 1");
if(!$member = $db->fetch_array($query)) {
wapmsg('my_nonexistence');
}
if($member['gender'] == '1') {
$member['gender'] = $lang['my_male'];
} elseif($member['gender'] == '2') {
$member['gender'] = $lang['my_female'];
} else {
$member['gender'] = $lang['my_secrecy'];
}
echo "$lang[my]".
"$lang[my_uid] $member[uid]".
"$lang[my_username] $member[username]".
"$lang[my_gender] $member[gender]".
($member['bday'] != '0000-00-00' ? "$lang[my_bday] $member[bday]" : '').
($member['location'] ? "$lang[my_location] $member[location]" : '').
($member['bio'] ? "$lang[my_bio] $member[bio]" : '');
if($uid == $discuz_uid) {
echo "$lang[my_phone]".
"$lang[my_favorites]".
"$lang[pm]";
} else {
echo "$lang[pm_send]";
}
} else {
if($do == 'fav') {
if(!empty($favid)) {
$selectid = $type == 'thread' ? 'tid' : 'fid';
$query = $db->query("SELECT $selectid FROM {$tablepre}favorites WHERE uid='$discuz_uid' AND $selectid='$favid' LIMIT 1");
if($db->result($query, 0)) {
wapmsg('fav_existence');
} else {
$db->query("INSERT INTO {$tablepre}favorites (uid, $selectid)
VALUES ('$discuz_uid', '$favid')");
wapmsg('fav_add_succeed');
}
} else {
echo "$lang[my_threads]";
$query = $db->query("SELECT m.*, t.subject FROM {$tablepre}mythreads m, {$tablepre}threads t
WHERE m.uid = '$discuz_uid' AND m.tid = t.tid ORDER BY m.dateline DESC LIMIT 0, 3");
while($mythread = $db->fetch_array($query)) {
echo "".cutstr($mythread['subject'], 15)."";
}
echo "$lang[my_replies]";
$query = $db->query("SELECT m.*, t.subject FROM {$tablepre}myposts m, {$tablepre}threads t
WHERE m.uid = '$discuz_uid' AND m.tid = t.tid ORDER BY m.dateline DESC LIMIT 0, 3");
while($mypost = $db->fetch_array($query)) {
echo "".cutstr($mypost['subject'], 15)."";
}
echo "$lang[my_fav_thread]";
$query = $db->query("SELECT t.tid, t.subject FROM {$tablepre}favorites fav, {$tablepre}threads t
WHERE fav.tid=t.tid AND t.displayorder>='0' AND fav.uid='$discuz_uid' ORDER BY t.lastpost DESC LIMIT 0, 3");
while($favthread = $db->fetch_array($query)) {
echo "".cutstr($favthread['subject'], 24)."";
}
echo "$lang[my_fav_forum]";
$query = $db->query("SELECT f.fid, f.name FROM {$tablepre}favorites fav, {$tablepre}forums f WHERE fav.uid='$discuz_uid' AND fav.fid=f.fid ORDER BY f.displayorder DESC LIMIT 0, 3");
while($favforum = $db->fetch_array($query)) {
echo "$favforum[name]";
}
echo '';
}
}
}
?>