Размер файла: 4.45Kb
<?php
require '../inc/func.php';
$id = isset($_GET['id'])? $_GET['id']:'1';
bk_head('Wall '.user_info($id,'username').'');
require '../inc/head.php';
$ch_id = mysql_query("SELECT id FROM users WHERE id = '$id'");
if(!mysql_num_rows($ch_id)){
$id = $userid;
}
if (!$user) {
header('location: /index.php');
}
$q = mysql_query("SELECT * FROM users WHERE id = '$id'");
$req = mysql_fetch_assoc($q);
if($user) {
echo '<div class="list1"><div class="tt">Wall '.$req['username'].'</div>';
if(isset($_POST['submit'])){
$msg = check($_POST['msg']);
if(empty($msg) OR strlen($msg) > 9999 OR strlen($msg) < 2){
err('Lỗi! Nội dung quá ngắn or quá dài');
}else{
mysql_query("INSERT INTO status (from_id,text,time,timeline_id) VALUES ('$userid','$msg',".time().",'$id')");
if($id != $userid){
$lstt = mysql_fetch_assoc(mysql_query("SELECT * FROM `status` WHERE `timeline_id` = '".$id."' ORDER BY `time` DESC LIMIT 1"));
mysql_query("INSERT INTO notice (id_id,type,time,id_user,id_from) VALUES ('$lstt[id]','p',".time().",'$id','$userid')");
}
}
}
####anh bia###
if(file_exists('../gallery/cover/'.$id.'.jpg')){
echo ' <img src="/gallery/cover/'.$id.'.jpg" alt="'.$req['username'].'" title="'.$req['username'].'" /><br />';
}else{
echo ' <img src="/gallery/cover/emp.jpg" alt="'.$req['username'].'" title="'.$req['username'].'" /><br />';
}
####end cover#####
echo '<div class="list1">';
echo avatar($req['id'],35,50);
echo '<br />';
if($id != $userid){
echo '<br />';
echo is_friend($userid,$id);
echo ' <a href="/mail/send'.$id.'"><input type="button" class="green" value="Nhắn Tin"></a> <a href="/gallery/index.php?id='.$id.'"><input type="button" value="Album" class="blue"></a>';
}
echo '<br />';
echo '
<a href="/about.php?id='.$id.'">About</a>
<a href="/users/listfriends.php?id='.$id.'">Friends</a>';
if($id == $userid){
echo ' <a href="/users/edit.php">Edit</a>';
}
echo '</div>';
echo '<br />';
$ch = checkfriend($userid,$id);
echo '<div class="shadow">';
echo '<form action="" method="post">
Write on '.user_info($id,'username').' wall...<br/>
<textarea name="msg" cols="30" rows="3"></textarea>
<input type="submit" class="login" style="vertical-align: top;" value="Post" name="submit"/>
</div>
</form>';
$c_status = mysql_result(mysql_query("SELECT COUNT(*) FROM `status` WHERE `timeline_id` = '".$id."' "),0);
$display = 3;
$count_pages = ceil($c_status/$display);
$page = (isset($_GET['page']) and is_numeric($_GET['page']) and $_GET['page']>1 and $_GET['page']<=$count_pages) ? $_GET['page'] : 1;
$start = $page*$display-$display;
$q_status = mysql_query("SELECT * FROM `status` WHERE `timeline_id` = '".$id."' ORDER BY `time` DESC LIMIT $start,$display");
while ($status = mysql_fetch_assoc($q_status)){
$c_likes = mysql_result(mysql_query("SELECT COUNT(*) FROM `status_like` WHERE `id_status` = '".$status['id']."' "),0);
$ch_likes = mysql_result(mysql_query("SELECT COUNT(*) FROM `status_like` WHERE `id_status` = '".$status['id']."' AND `id_user` = '".$userid."' "),0);
$c_cmt = mysql_result(mysql_query("SELECT COUNT(*) FROM `status_cmt` WHERE `id_status` = '".$status['id']."' "),0);
echo '<div class="list1">';
echo '<div><b>'.user($status['from_id']).'</b><br />'.smiles(tags($status['text'])).'</div><span style="color: #8f8f8f">'.time_post($status['time']).'</span>';
if(!$ch_likes){
if(!$c_likes){
echo ' <a href="/status/like.php?id='.$status['id'].'&like">Like</a>';
}else{
echo ' '.$c_likes.' <img src="/images/like.gif" /> <a href="/status/like.php?id='.$status['id'].'&like">Like</a>';
}
}
else{
if(!$c_likes){
echo ' <a href="/status/like.php?id='.$status['id'].'&unlike">UnLike</a>';
}else{
echo ' '.$c_likes.' <img src="/images/like.gif" /> <a href="/status/like.php?id='.$status['id'].'&unlike">UnLike</a>';
}
}
echo ' <a href="/status/list.php?id='.$status['id'].'">'.($c_cmt == 0? 'Bình Luận':''.$c_cmt.' <img src="/images/chat.gif" /> Bình Luận').'</a>';
echo '</div>';
}
if($c_status > 3){
echo '<div class="shadow">';
pages($page,$count_pages,'/users/profile.php?id='.$id.'&page=');
echo '</div><br />';
}
if($id != $userid && $ch == 1){
echo '<div class="left_bot">»
<a href="../friends/remove.php?fid='. $id .'">Remove '. user_info($id, "username") .' From friends list</a>
</div>';
}
echo '</div>';
}
bk_foot();
?>