<?php
session_start();
if (empty($_SESSION['namauser']) AND empty($_SESSION['passuser'])){
	header('location:../../404.php');
}else{
include_once '../../../po-library/po-database.php';
include_once '../../../po-library/po-function.php';

$val = new Povalidasi;
$mod=$_POST[mod];
$act=$_POST[act];

// Delete Comment
if ($mod=='comment' AND $act=='delete'){
	$id = $val->validasi($_POST['id'],'sql');
	$tabledel = new PoTable('comment');
	$tabledel->deleteBy('id_comment', $id);
}

// Approve Comment
elseif ($mod=='comment' AND $act=='approve'){
$id = $val->validasi($_POST['id'],'sql');
$active =  $val->validasi($_POST['active'],'xss');
	$data = array(
		'active' => $active
	);
	$table = new PoTable('comment');
	$table->updateBy('id_comment', $id, $data);
	echo "$active";
}
}
?>