<?php
ini_set('display_errors', 0);
//error_reporting(E_ALL);
//ini_set('display_errors', 1);

session_start();
ob_start();

require_once('configuration/server_connect.php');
require_once('configuration/all_function.php');

$order_no = $_REQUEST['order_no'];
$user_id = $_REQUEST['user_id'];
$page_name = $_REQUEST['page_name'];
$page_id = $_REQUEST['page_id'];
$flag = $_REQUEST['flag'];


$entry_by=$_SESSION['user']['id'];
$entry_at=date('Y-m-d H:i:s');

if($flag>0){
$sql_del = 'delete from user_roll_manage where user_id="'.$user_id.'" and order_no="'.$order_no.'"';
mysqli_query($conn,$sql_del);
}else{
 $ins_sql = 'INSERT INTO  user_roll_manage (page_name, page_id, order_no, user_id, entry_by, entry_at, edit_by, edit_at) VALUES
("'.$page_name.'", "'.$page_id.'", "'.$order_no.'", "'.$user_id.'", "'.$entry_by.'", "'.$entry_at.'", "0", "0000-00-00")';
mysqli_query($conn,$ins_sql);
}

echo 'Success!';
?>