require 'includes/header.php'?> if($_SERVER['REQUEST_METHOD'] === 'POST') { if($_POST['action'] == 'add'){ $ins = $con->query("INSERT INTO `login_permission` (`type`,`permissions`) VALUES ('".$_POST['type']."','".json_encode($_POST['permissions'])."')"); }else{ $up = $con->query("UPDATE `login_permission` SET `type`= '".$_POST['type']."',`permissions`= '".json_encode($_POST['permissions'])."' WHERE id = '".$_POST['id']."'"); if(!$up){ print_r($con->error);exit; } } echo ''; } $type = $permissions = $input = ''; $action = 'add'; if(isset($_GET['action']) && $_GET['action'] == 'edit'){ $id = $_GET['id']; $get = $con->query("SELECT * FROM login_permission WHERE id = '$id'"); if($get->num_rows){ $row = $get->fetch_assoc(); extract($row); $action = 'update'; $input = ''; } } ?>
require 'includes/footer.php'?>