Server IP : 108.163.255.210 / Your IP : 3.138.134.149 Web Server : Apache System : Linux blossom.urlnameserver.com 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64 User : ( 1172) PHP Version : 7.2.34 Disable Function : eval,escapeshellarg,proc_close,proc_get_status,proc_nice,proc_open,symlink,system,pcntl_exec,getrusage,chown,chgp,closelog,openlog,syslog,define_syslog_variables,php_ini_loaded_file,getservbyname,getservbyport,posix_getgid,posix_getgrgid,proc_terminate,pfsockopen,apache_child_terminate,posix_mkfifo,posix_setpgid,posix_setuid,hypot,pg_host,pos,posix_access,posix_getcwd,posix_getservbyname,myshellexec,getpid,posix_getsid,posix_isatty,posix_kill,posix_mknod,posix_setgid,posix_setsid,posix_setuid,posix_times,posix_uname,ps_fill,posix_getpwuid,global,ini_restore,zip_open,zip_read,rar_open,bzopen,bzread,bzwrite,apache_get_modules,apache_get_version,phpversionphpinfo,php_ini_scanned_files,get_current_user,disk_total_space,diskfreespace,leak,imap_list,hypo,filedump,safe_mode,getmygid,apache_getenv,apache_setenv,bzread,bzwrite,bzopen,phpini,higlight_file,dos_conv,get_cwd,er_log,cmd,e_name,vdir,get_dir,only_read,ftok,ftpexec,posix_getpwnam,mysql_list_dbs,disk_free_space,session_save_path,confirm_phpdoc_compiled,zip_entry_rea,php_u,psockopen,crack_opendict,crack_getlastmessage,crack_closedict,crack_check,fpassthru,posix_get_last_error,posix_getlogin,posix_getgroups,posix_strerror,posix_getrlimit,posix_getpgrp,posix_getgrnam,pos,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/unilinki/www/Intellilead/users/ |
Upload File : |
<?php require "../includes/authenticate.php"; if($_SESSION['user_type']!="0") exit; $menu_table_name = 'mstr_menu'; if(isset($_POST['row_id'])){ $row_id = checkInput($_POST['row_id']); $parent_menu = checkInput(@$_POST['parent_menu']); if($row_id!="" && @$_POST['delete_data']=="delete"){ $result = executeUpdate("DELETE FROM `$menu_table_name` WHERE `menu_id`='$row_id'"); echo $result>0?"deleted":"fail"; }else if($parent_menu!=""){ $menu_id = checkInput($_POST['menu_id']); $menu_name = checkInput($_POST['menu_name']); $menu_url = checkInput($_POST['menu_url']); $menu_icon = checkInput($_POST['menu_icon']); $result = "fail"; if($menu_url!="" && getSingleResult("select count(menu_id) from $menu_table_name where menu_url='$menu_url' AND menu_id!='$row_id'")>0){ echo "duplicate"; exit; } if($row_id!=$menu_id && getSingleResult("select count(menu_id) from $menu_table_name where menu_id='$menu_id'")>0){ $menu_id = $row_id!=''?$row_id:''; } if($row_id!=""){ $result = executeUpdate("UPDATE `$menu_table_name` SET `menu_id`='$menu_id', `menu_name`='$menu_name', `parent_menu`='$parent_menu', `menu_url`='$menu_url', `menu_icon`='$menu_icon' WHERE `menu_id`='$row_id'"); $result = $menu_id;//$result>0?"done":"fail"; $_SESSION['menu_items'][] = $menu_id; $_SESSION['privilege'] .=",".$menu_id; }else{ executeQuery("INSERT INTO `$menu_table_name`(`menu_id`, `menu_name`, `parent_menu`, `menu_url`, `menu_icon`) VALUES ('$menu_id', '$menu_name', '$parent_menu', '$menu_url','$menu_icon')"); $result = mysql_insert_id(); $_SESSION['menu_items'][] = $result; $_SESSION['privilege'] .=",".$result; } echo $result; }else echo "fail"; exit; } include('../template/header.php'); $menu_list= getTableData("SELECT * FROM `$menu_table_name` ORDER BY `menu_id` ASC"); ?> <!--data table--> <link rel="stylesheet" href="../style/js/data-tables/DT_bootstrap.css" /> <!--body wrapper start--> <div class="wrapper"> <div class="row"> <div class="col-sm-12"> <section class="panel"> <header class="panel-heading"> Menu List <span class="tools pull-right"> <a href="javascript:;" class="fa fa-chevron-down"></a> </span> </header> <div class="panel-body"> <div class="adv-table editable-table "> <div class="clearfix"> <div class="btn-group"> <button id="editable-sample_new" class="btn btn-sm btn-primary"> Add New <i class="fa fa-plus"></i> </button> </div> </div> <div class="space15"></div> <table class="table table-striped table-hover table-bordered" id="editable-sample"> <thead> <tr> <th>MenuID</th> <th>ParentID</th> <th>Name</th> <th>Url</th> <th>Icon CSS</th> <th>Edit</th> <th>Delete</th> </tr> </thead> <tbody> <?php foreach($menu_list as $menuData){ ?> <tr class="" trid="<?php echo $menuData['menu_id'];?>"> <td><?php echo $menuData['menu_id'];?></td> <td><?php echo $menuData['parent_menu'];?></td> <td><?php echo $menuData['menu_name'];?></td> <td><?php echo $menuData['menu_url'];?></td> <td><?php echo $menuData['menu_icon'];?></td> <td><a class="edit" href="javascript:;">Edit</a></td> <td><a class="delete" href="javascript:;">Delete</a></td> </tr> <?php }?> </tbody> </table> </div> </div> </section> </div> </div> </div> <!--body wrapper end--> <!--data table--> <script type="text/javascript" src="../style/js/data-tables/jquery.dataTables.js"></script> <script type="text/javascript" src="../style/js/data-tables/DT_bootstrap.js"></script> <!-- END JAVASCRIPTS --> <script> var EditableTable = function () { return { //main function to initiate the module init: function () { function restoreRow(oTable, nRow) { var aData = oTable.fnGetData(nRow); var jqTds = $('>td', nRow); for (var i = 0, iLen = jqTds.length; i < iLen; i++) { oTable.fnUpdate(aData[i], nRow, i, false); } oTable.fnDraw(); } function editRow(oTable, nRow) { var aData = oTable.fnGetData(nRow); var jqTds = $('>td', nRow); jqTds[0].innerHTML = '<input type="text" class="form-control small markerDTO" name="menu_id" value="' + aData[0] + '">'; jqTds[1].innerHTML = '<input type="number" min="0" class="form-control small markerDTO" name="parent_menu" value="' + aData[1] + '">'; jqTds[2].innerHTML = '<input type="text" class="form-control small markerDTO" name="menu_name" value="' + aData[2] + '">'; jqTds[3].innerHTML = '<input type="text" class="form-control small markerDTO" name="menu_url" value="' + aData[3] + '">'; jqTds[4].innerHTML = '<input type="text" class="form-control small markerDTO" name="menu_icon" value="' + aData[4] + '">'; jqTds[5].innerHTML = '<a class="edit" href="">Save</a>'; jqTds[6].innerHTML = '<a class="cancel" href="">Cancel</a>'; } function saveRow(oTable, nRow, trId) { var jqInputs = $('input', nRow); var menu_id = jqInputs[0].value; if(trId!=""){ $(nRow).attr("trid",trId); menu_id = trId; } oTable.fnUpdate(menu_id, nRow, 0, false); oTable.fnUpdate(jqInputs[1].value, nRow, 1, false); oTable.fnUpdate(jqInputs[2].value, nRow, 2, false); oTable.fnUpdate(jqInputs[3].value, nRow, 3, false); oTable.fnUpdate(jqInputs[4].value, nRow, 4, false); oTable.fnUpdate('<a class="edit" href="">Edit</a>', nRow, 5, false); oTable.fnUpdate('<a class="delete" href="">Delete</a>', nRow, 6, false); oTable.fnDraw(); } function cancelEditRow(oTable, nRow) { var jqInputs = $('input', nRow); oTable.fnUpdate(jqInputs[0].value, nRow, 0, false); oTable.fnUpdate(jqInputs[1].value, nRow, 1, false); oTable.fnUpdate(jqInputs[2].value, nRow, 2, false); oTable.fnUpdate(jqInputs[3].value, nRow, 3, false); oTable.fnUpdate(jqInputs[4].value, nRow, 4, false); oTable.fnUpdate('<a class="edit" href="">Edit</a>', nRow, 5, false); oTable.fnDraw(); } var oTable = $('#editable-sample').dataTable({ "aLengthMenu": [ [10, 25, 50, 100, -1], [10, 25, 50, 100, "All"] // change per page values here ], // set the initial value "iDisplayLength": 50, "sDom": "<'row'<'col-lg-6'l><'col-lg-6'f>r>t<'row'<'col-lg-6'i><'col-lg-6'p>>", "sPaginationType": "bootstrap", "oLanguage": { "sLengthMenu": "_MENU_ records per page", "oPaginate": {"sPrevious": "Prev","sNext": "Next"} }, "aoColumnDefs": [{'bSortable': false,'aTargets': [5]},{'bSortable': false,'aTargets': [6]}] }); jQuery('#editable-sample_wrapper .dataTables_filter input').addClass("form-control medium"); // modify table search input jQuery('#editable-sample_wrapper .dataTables_length select').addClass("form-control xsmall"); // modify table per page dropdown var nEditing = null; $('#editable-sample_new').click(function (e) { e.preventDefault(); var aiNew = oTable.fnAddData(['', '', '', '', '', '<a class="edit" href="">Edit</a>', '<a class="cancel" data-mode="new" href="">Cancel</a>']); var nRow = oTable.fnGetNodes(aiNew[0]); editRow(oTable, nRow); nEditing = nRow; }); $('#editable-sample a.delete').live('click', function (e) { e.preventDefault(); if (confirm("Are you sure to delete this row ?") == false) { return; } var nRow = $(this).parents('tr')[0]; var row_id = $(nRow).attr("trid"); var objTable = oTable; var request =$.ajax({ type: "POST", url: "", data: 'row_id=' + row_id + '&delete_data=delete', cache: false }); request.done(function( response ) { if(response=="deleted"){ objTable.fnDeleteRow(nRow); alert("Data Deleted Successfully!"); }else if(response=="fail"){ alert("Failed! Some error occurred!"); }else alert(response); }); request.fail(function( jqXHR, textStatus ) { alert( "Failed: " + textStatus ); }); }); $('#editable-sample a.cancel').live('click', function (e) { e.preventDefault(); if ($(this).attr("data-mode") == "new") { var nRow = $(this).parents('tr')[0]; oTable.fnDeleteRow(nRow); } else { restoreRow(oTable, nEditing); nEditing = null; } }); $('#editable-sample a.edit').live('click', function (e) { e.preventDefault(); /* Get the row as a parent of the link that was clicked on */ var nRow = $(this).parents('tr')[0]; if (nEditing !== null && nEditing != nRow) { /* Currently editing - but not this row - restore the old before continuing to edit mode */ restoreRow(oTable, nEditing); editRow(oTable, nRow); nEditing = nRow; } else if (nEditing == nRow && this.innerHTML == "Save") { /* Editing this row and want to save it */ var jqInputs = $('input', nEditing); var row_id = $(nRow).attr("trid"); if(typeof row_id === "undefined") row_id=''; var objTable = oTable; var request =$.ajax({ type: "POST", url: "", data: $.param($(nRow).find(".markerDTO").serializeArray())+ '&row_id=' + row_id, cache: false }); request.done(function( response ) { if(response=="duplicate"){ alert("Duplicate Url!"); }else if(response=="fail"){ alert("Failed! Some error occurred!"); }else if(response!="" && $.isNumeric(response)){ saveRow(objTable, nRow, response); alert("Menu Updated Successfully!"); }else alert(response); }); request.fail(function( jqXHR, textStatus ) { alert( "Failed: " + textStatus ); }); nEditing = null; } else { /* No edit in progress - let's start one */ editRow(oTable, nRow); nEditing = nRow; } }); } }; }(); jQuery(document).ready(function() { EditableTable.init(); }); </script> <?php include('../template/footer.php');?>