<?php include './common/db.php'; $user = $common['user']; $sql = 'select toid, username, authorid, max(dateline) as timeline, count(*) as msgcount from message,user where delstatus=0 and message.toid=1 and message.authorid=user.userid group by authorid order by dateline desc limit 0,10'; $sqljoin = 'select toid, authorid, content, max(dateline) as timeline, count(*) as msgcount, username from message,user where delstatus=0 and message.toid=' . $user['userid'] . ' and authorid=userid group by authorid order by timeline desc;'; $result = mysql_query($sqljoin); $msg_arr = array(); if ($result) { while ($row = mysql_fetch_array($result)) { $msg_arr[] = array('userid' => $row['authorid'], 'username' => $row['username'], 'content' => getLatestMsg($row['authorid'], $user['userid'], $con), 'dateline' => timeFormat($row['timeline']), 'realtime' => $row['timeline'], 'avator' => getAvator(), 'newcount' => mt_rand(0, 10)); } } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <?php include './common/meta.php'; ?> <title>纸条</title> </head> <body> <?php $mod = 'at'; $doc_title = '@提到我的'; include './common/header.php'; ?>
<?php include '../common/db.php'; $page_size = 5; $page = $_GET['page']; if (!$page || $page <= 0) { $page = 1; } $limit_start = $page_size * ($page - 1); $msg_arr = array(); $user = $common['user']; $targetid = $_GET['uid']; $loadend = false; if ($targetid) { $sqljoin = 'select * from message' . ' where (message.toid=' . $user['userid'] . ' and message.authorid=' . $targetid . ') ' . 'OR (message.toid=' . $targetid . ' and message.authorid=' . $user['userid'] . ') ' . 'order by dateline desc limit ' . $limit_start . ',' . $page_size . ';'; $result = mysql_query($sqljoin, $con); $tavator = getAvator(); if ($result) { while ($row = mysql_fetch_array($result)) { $issend = $row['authorid'] == $targetid ? false : true; $msg_arr[] = array('userid' => $row['authorid'], 'username' => $row['username'], 'content' => $row['content'], 'dateline' => date('m-d H:i', $row['dateline']), 'issend' => $issend, 'avator' => $issend ? $user['avator'] : $tavator); } if (empty($msg_arr) || count($msg_arr) < $page_size) { $loadend = true; } else { // $msg_arr = array_reverse($msg_arr); } } } $data = array('status' => 0, 'data' => array('page' => $page, 'list' => $msg_arr, 'loadend' => $loadend)); echo json_encode($data);
return './static/asset/img/' . $user_avator_arr[mt_rand(0, count($user_avator_arr) - 1)]; } function getUserByName($username, $connect) { $sql = 'select * from user where username="******";'; $res = mysql_query($sql, $connect); if ($res && ($row = mysql_fetch_array($res))) { $data = array('userid' => $row['userid'], 'username' => $row['username']); return $data; } return null; } function url($url) { header("Location: " . $url); exit; } // user set $username = '******'; $userid = 0; if ($_GET['me']) { $userid = $_GET['me']; } $usersql = 'select * from user where username="******";'; if ($userid) { $usersql = 'select * from user where userid=' . $userid; } $res = mysql_query($usersql, $con); $data = mysql_fetch_array($res); $user = array('username' => $data['username'], 'userid' => $data['userid'], 'avator' => getAvator()); $common = array('user' => $user);
<?php include './common/db.php'; ?> <?php $sql = 'select * from user where userid!=' . $common['user']['userid'] . ';'; $result = mysql_query($sql, $con); $data = array(); if ($result) { while ($row = mysql_fetch_array($result)) { $data[] = array('userid' => $row['authorid'], 'username' => $row['username'], 'avator' => getAvator()); } } ?> <ul class="user-list"> <?php foreach ($data as $user) { ?> <li> <a class="list-item clear" href="javascript:;"> <dl> <dd class="box fl"><img class="avator-round" src="<?php echo $user['avator']; ?> "></dd> <dt class="box fl"><?php echo $user['username']; ?> </dt> </dl>
<?php include './common/db.php'; $user = $common['user']; $targetid = $_GET['uid']; if (!$targetid) { url('index.php'); } $sqltuser = '******' . $targetid . ';'; $result = mysql_query($sqltuser, $con); if (!$result) { url('index.php'); } while ($row = mysql_fetch_array($result)) { $tuser = array('userid' => $row['userid'], 'username' => $row['username'], 'avator' => getAvator()); } $doc_title = $tuser['username']; $sqljoin = 'select * from message' . ' where (message.toid=' . $user['userid'] . ' and message.authorid=' . $targetid . ') ' . 'OR (message.toid=' . $targetid . ' and message.authorid=' . $user['userid'] . ') ' . 'order by dateline desc limit 0,5;'; $result = mysql_query($sqljoin, $con); $msg_arr = array(); if ($result) { while ($row = mysql_fetch_array($result)) { $issend = $row['authorid'] == $targetid ? false : true; $msg_arr[] = array('userid' => $row['authorid'], 'username' => $row['username'], 'content' => $row['content'], 'dateline' => date('m-d H:i', $row['dateline']), 'issend' => $issend, 'avator' => $issend ? $user['avator'] : $tuser['avator']); } // $msg_arr = array_reverse($msg_arr); } ?> <!DOCTYPE html> <html>