<?php session_start(); include '../model/notify_model.php'; include '../model/diary_model.php'; $m = new NotifyModel(); $d = new DiaryModel(); include '../views/header.php'; $did = $_GET['did']; $return = 0; if (isset($_POST['submit'])) { if (isset($_POST['subject'])) { $temp['subject'] = $_POST['subject']; } if (isset($_POST['content'])) { $temp['content'] = $_POST['content']; } else { $temp['content'] = $diary['content']; } if (isset($_POST['sharewith'])) { $temp['type'] = $_POST['sharewith']; } else { $temp['type'] = $diary['type']; } if ($d->edit($temp, $did)) { $return = 1; } else { $return = 0; } } $diary = $d->getDiarybyid($did);
<?php session_start(); include_once '../model/comment_model.php'; include_once '../model/diary_model.php'; include_once '../model/user_model.php'; include_once '../model/notify_model.php'; include_once '../model/friend_model.php'; include_once '../model/like_model.php'; $l = new LikeModel(); $t = new DiaryModel(); $c = new CommentModel(); $u = new UserModel(); $n = new NotifyModel(); $m = new NotifyModel(); $f = new FriendModel(); $button = ''; $p = 0; $onclick1 = ''; $user_page = $u->getUser($_GET['user_id']); if ($f->checkUserId($_SESSION['id'], $user_page['id'])) { $a = $f->getFlagFriend($_SESSION['id'], $user_page['id']); $flag['flag'] = $a['flag']; } if ($f->checkUserId($user_page['id'], $_SESSION['id'])) { $b = $f->getFlagFriend($user_page['id'], $_SESSION['id']); if ($b['flag'] == 2) { $flag['flag'] = 3; } } if (!$f->checkUserId($_SESSION['id'], $user_page['id']) && !$f->checkUserId($user_page['id'], $_SESSION['id'])) {
<?php include '../model/diary_model.php'; $d = new DiaryModel(); $did = $_GET['did']; if ($d->delete($did)) { $back = $_SERVER['HTTP_REFERER']; header('Location: ' . $back); exit; }
<?php session_start(); include '../model/diary_model.php'; include '../model/comment_model.php'; include '../model/notify_model.php'; include '../model/user_model.php'; include_once '../model/friend_model.php'; include_once '../model/like_model.php'; $l = new LikeModel(); $t = new DiaryModel(); $u2 = new UserModel(); $c = new CommentModel(); $n = new NotifyModel(); $m = new NotifyModel(); $f = new FriendModel(); $diary = $t->getDiaryOfUser($_SESSION['id']); $userid = $_SESSION['id']; $user2 = $u2->getUser($userid); if (isset($_POST['submit'])) { if (isset($_POST['subject'])) { $temp['subject'] = $_POST['subject']; } if ($_POST['content']) { $temp['content'] = $_POST['content']; } if ($_POST['sharewith']) { $temp['type'] = $_POST['sharewith']; } $temp['user_id'] = $userid; $t->create($temp);
public function getDiarySeachSub($subDiary, $user_id) { if (empty(self::$conn)) { self::$conn = $this->connectPdo(); } $sql = "SELECT diary.id,diary.user_id as user_id,content,time_on,subject,type FROM diary,friend\r\n WHERE diary.subject like '%" . $subDiary . "%' AND diary.type=2 AND diary.user_id=friend.user_id1 AND flag=1\r\n UNION SELECT diary.id,diary.user_id as user_id,content,time_on,subject,type FROM diary WHERE diary.type=3 AND diary.subject like '%" . $subDiary . "%'\r\n UNION SELECT diary.id,diary.user_id as user_id,content,time_on,subject,type FROM diary WHERE user_id=" . $user_id . " AND diary.subject like '%" . $subDiary . "%'\r\n ORDER BY time_on DESC\r\n"; $stmt = self::$conn->prepare($sql); $stmt->execute(); $stmt->setFetchMode(PDO::FETCH_ASSOC); $diary = array(array()); $i = 0; while ($row = $stmt->fetch()) { $diary[$i++] = $row; } $i--; return $diary; }