예제 #1
0
 public function Delete()
 {
     global $obj, $model, $param1;
     include_once 'Model/newslike.php';
     $model = new Newslike();
     $model->Id = $param1;
     if ($model->Delete()) {
         print '<span class="success">Newslike Updated</span>';
     } else {
         print '<span class="error">' . $model->Error . '</span>';
     }
     include_once 'View/Newslike/index.php';
 }
예제 #2
0
파일: singleNews.php 프로젝트: csebubt/news
</div></div>



<div class="row" >
  <div class="col-lg-9">
    <h4>
    <?php 
include_once 'Model/newslike.php';
$nl = new Newslike();
if (isset($_POST['btnLike'])) {
    $nl->NewsId = $model->Id;
    $nl->UserId = $_SESSION['userid'];
    $nl->Date = date("Y-m-d");
    if ($nl->Insert()) {
        $nl = new Newslike();
    }
}
if (isset($_SESSION['usertype'])) {
    $nl->UserId = $_SESSION['userid'];
    $nl->NewsId = $model->Id;
    if ($nl->Check()) {
        print 'Liked';
    } else {
        print '<form method="post" action="">
        <input type="submit" name="btnLike" value="Like" />
      </form>';
    }
} else {
    print '<a href="User/Login">Login to Like</a>';
}