<?php

require_once("../config/configDB.php"); 

$userpid        = stripslashes($_GET['userpid']);
$datashow       = stripslashes($_GET['showvalue']);
$uid            = stripslashes($_GET['uid']);
$ptype          = stripslashes($_GET['ptype']);
if($datashow==1) {
    $datashowval = 0;
}
else if($datashow==0) {
    $datashowval =1;
}


$sql_update = "UPDATE user_permission SET ";

if($ptype=='show')
    $sql_update .= "datashow='$datashowval' ";

if($ptype=='add')    
    $sql_update .= "dataadd='$datashowval' ";
    
if($ptype=='edit')    
    $sql_update .= "dataedit='$datashowval' ";
  
if($ptype=='delete')    
    $sql_update .= "datadelete='$datashowval' ";

if($ptype=='print')    
    $sql_update .= "dataprint ='$datashowval' ";

if($ptype=='excelformat')    
    $sql_update .= "dataexcelformat  ='$datashowval' ";

$sql_update .= " WHERE id='$userpid' ";


mysqli_query($conn,$sql_update);



header("Location:../usersMasterPermission.php?id=".$uid);

?>