Advertisement
Guest User

admin.php

a guest
Jan 18th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 16.36 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. include "/var/www/html/mr_ads/config/config.php";
  5. // if(!isset($_SESSION["ads"])) header('location:../index.php');
  6. if($_SESSION["ads"]["level_akses"] == 2) header('location:/user.php');
  7. $today = date("Y-m-d H:i:s");
  8.  
  9. if(!isset($_SESSION["ads"])){
  10.   header('location:../index.php');
  11. }else{
  12.   $now = time(); // Checking the time now when home page starts.
  13.  
  14.   if ($now > $_SESSION['expire']) {
  15.       header('location:../logout.php');
  16.   }
  17.  
  18. }
  19.  
  20. ?>
  21. <!-- <?php echo "expire : ".$_SESSION['expire'] ?> -->
  22. <!-- <?php echo "start : ".$_SESSION['start'] ?> -->
  23. <!DOCTYPE html>
  24. <html lang="en">
  25.   <head>
  26.     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  27.     <!-- Meta, title, CSS, favicons, etc. -->
  28.     <meta charset="utf-8">
  29.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  30.     <meta name="viewport" content="width=device-width, initial-scale=1">
  31.  
  32.     <title>Media Rating Advertising</title>
  33.  
  34.     <link href="vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
  35.     <!-- Font Awesome -->
  36.     <link href="vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
  37.     <!-- Datatables -->
  38.     <link href="vendors/datatables.net-bs/css/dataTables.bootstrap.min.css" rel="stylesheet">
  39.     <link href="vendors/datatables.net-responsive-bs/css/responsive.bootstrap.min.css" rel="stylesheet">
  40.     <!-- Custom Theme Style -->
  41.     <link href="build/css/custom.css" rel="stylesheet">
  42.     <link href="build/css/custom.min.css" rel="stylesheet">
  43.  
  44.   </head>
  45.  
  46.   <body class="nav-md">
  47.     <div class="container body">
  48.       <div class="main_container">
  49.         <div class="col-md-3 left_col">
  50.           <div class="left_col scroll-view">
  51.             <div class="navbar nav_title" style="border: 0;">
  52.               <a href="?page=T_Geo_Dist"><img alt="Brand" src="../asset/images/mrav4.png" width= "185px" style="margin-top: 0px;margin-left: 5px;"></a>
  53.              <!--<a href="?page=home" class="site_title"> <span>Media Rating Television</span></a>-->
  54.             </div>
  55.  
  56.             <div class="clearfix"></div>
  57.  
  58.             <!-- menu profile quick info -->
  59.             <div class="profile">
  60.               <div class="profile_pic">
  61.                 <img src="production/images/male.png" alt="..." class="img-circle profile_img">
  62.               </div>
  63.               <div class="profile_info">
  64.                 <span>Welcome,</span>
  65.                 <h2><?php echo $_SESSION['ads']['id']->name;?></h2>
  66.                
  67.               </div>
  68.             </div>
  69.             <!-- /menu profile quick info -->
  70.  
  71.             <br />
  72.  
  73.             <!-- sidebar menu -->
  74.             <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
  75.               <div class="menu_section">
  76.                 <h3>Admin</h3>
  77.                 <ul class="nav side-menu">
  78.                   <li><a href="?page=User_management"><i class="fa fa-home"></i>USER MANAGEMENT</a>
  79.                   </li>
  80.                   <li><a href="?page=Privilage_menu"><i class="fa fa-bars"></i>PRIVILAGE MENU</a>
  81.                   </li>
  82.  
  83.  
  84.                   <li><a><i class="fa fa-area-chart"></i> PROGRAM ANALYTICS <span class="fa fa-chevron-down"></span></a>
  85.                     <ul class="nav child_menu">
  86.                       <li><a href="?page=T_Views">VIEWS</a></li>
  87.                       <li><a href="?page=T_Top_Program">TOP PROGRAM</a></li>
  88.                     </ul>
  89.                   </li>
  90.  
  91.                   <li><a><i class="fa fa-area-chart"></i> GEO DISTRIBUTION <span class="fa fa-chevron-down"></span></a>
  92.                     <ul class="nav child_menu">
  93.                       <li><a href="?page=T_Geo_Dist">MAP</a></li>
  94.                       <li><a href="?page=T_Geo_Dist_List">LIST</a></li>
  95.                     </ul>
  96.                   </li>
  97.  
  98.                    
  99.                   <li><a><i class="fa fa-area-chart"></i>TIME SEGMENT<span class="fa fa-chevron-down"></span></a>
  100.                     <ul class="nav child_menu">
  101.                       <li><a href="?page=T_Time_Segment_Program">By Program</a></li>
  102.                       <li><a href="?page=T_Time_Segment_Channel">By Channel</a></li>
  103.                     </ul>
  104.                   </li>
  105.                  
  106.  
  107.                 </ul>
  108.               </div>
  109.              
  110.  
  111.             </div>
  112.             <!-- /sidebar menu -->
  113.  
  114.             <!-- /menu footer buttons -->
  115.             <div class="sidebar-footer hidden-small">
  116.               <a data-toggle="tooltip" data-placement="top" title="FullScreen" class="menu_toggle">
  117.                 <span class="glyphicon glyphicon-fullscreen" aria-hidden="true"></span>
  118.               </a>
  119.               <a href="../logout.php" data-toggle="tooltip" data-placement="top" title="Logout">
  120.                 <span class="glyphicon glyphicon-off" aria-hidden="true"></span>
  121.               </a>
  122.             </div>
  123.             <!-- /menu footer buttons -->
  124.           </div>
  125.         </div>
  126.  
  127.         <!-- top navigation -->
  128.         <div class="top_nav">
  129.           <div class="nav_menu">
  130.             <nav>
  131.               <div class="nav toggle">
  132.                 <a class="menu_toggle"><i class="fa fa-bars"></i></a>
  133.               </div>
  134.              
  135.               <ul class="nav navbar-nav navbar-right">
  136.                 <li class="">
  137.                   <a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
  138.                     <img src="production/images/male.png" alt=""><?php echo $_SESSION['ads']['id']->name;?>
  139.  
  140.                     <span class=" fa fa-angle-down"></span>
  141.                   </a>
  142.                   <ul class="dropdown-menu dropdown-usermenu pull-right">
  143.                     <li><a href="../logout.php"><i class="fa fa-sign-out pull-right"></i> Log Out</a></li>
  144.                   </ul>
  145.                 </li>
  146.  
  147.            
  148.               </ul>
  149.             </nav>
  150.           </div>
  151.         </div>
  152.         <!-- /top navigation -->
  153.  
  154.         <!-- page content -->
  155.         <div class="right_col" role="main">
  156.          
  157.           <!-- /top tiles -->
  158.  
  159.           <div class="row">
  160.             <div class="col-md-12 col-sm-12 col-xs-12">
  161.               <div class="dashboard_graph">
  162.                 <?php
  163.                   if(isset($_GET["regis"]) == 'true'){
  164.                 ?>
  165.                    <div id="stat_regis" style="text-align: center;margin-top: 10px;"><span style="padding: 7px;color: #698c65;font-style: normal;font-size: 13px;font-weight: bold;background: #eaeaea;">REGISTRASI BERHASIL</span></div>
  166.                 <?php
  167.                   }
  168.                 ?>
  169.                   <?php include "content.php"; ?>
  170.                 <div class="clearfix"></div>
  171.               </div>
  172.             </div>
  173.           </div>
  174.           <br />
  175.  
  176.         </div>
  177.         <!-- /page content -->
  178.  
  179.         <!-- footer content -->
  180.         <footer>
  181.           <div class="pull-right">
  182.             ©2016 All Rights Reserved. PT Telkom Indonesia. Privacy and Terms
  183.           </div>
  184.           <div class="clearfix"></div>
  185.         </footer>
  186.         <!-- /footer content -->
  187.       </div>
  188.     </div>
  189.  
  190.     <!-- jQuery -->
  191.     <script src="vendors/jquery/dist/jquery.min.js"></script>
  192.     <!-- Bootstrap -->
  193.     <script src="vendors/bootstrap/dist/js/bootstrap.min.js"></script>
  194.     <!-- Datatables -->
  195.     <script src="vendors/datatables.net/js/jquery.dataTables.min.js"></script>
  196.     <script src="vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
  197.     <script src="vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
  198.     <script src="vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
  199.     <script src="vendors/bootbox/bootbox.js"></script>
  200.     <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.1/js/bootstrap-datepicker.min.js"></script>
  201.     <link rel="stylesheet" href="vendors/bootstrap/dist/css/bootstrap-datepicker3.css"/>
  202.  
  203.     <!-- Custom -->
  204.     <script src="build/js/custom.min.js"></script>
  205.  
  206.     <!-- Analytics Start -->
  207.     <script type="text/javascript">
  208.         var _tar= {};_tar.ID="50441841-9d03-45a7-b07b-f06c99396ebe";
  209.     </script>
  210.  
  211.     <script src='https://track.analytic.rocks/load/' async>
  212.     </script>
  213.     <!-- Analytics End -->
  214.  
  215.     <script>
  216.       $(document).ready(function() {
  217.             var myVar = setInterval(logout, 10 * 60000);
  218.             var url = "../logout.php";
  219.             function logout() {
  220.                 location.href = url;
  221.             }
  222.  
  223.             $('.cek').click(function() {
  224.                var cek=$(this).attr('data-id');
  225.                var b=$(this).val();
  226.            
  227.                var tmp = new Array();
  228.                tmp = b.split(' ');
  229.                var user_id=tmp[0];
  230.                var menu_id=tmp[1];
  231.            
  232.    
  233.                 $.ajax({
  234.                   type:"POST",
  235.                   url:"../dash/aksi/update_privilage.php",
  236.                   dataType:"json",
  237.                   data:{cek:cek,user_id:user_id,menu_id:menu_id},
  238.                   success:function(result){
  239.                     if(result.status==1){
  240.                       alert("ada");
  241.                     }else{
  242.                       alert('g ada');
  243.                     }
  244.  
  245.                   }
  246.                 });
  247.                          
  248.                            
  249.                          
  250.  
  251.  
  252.              // var a=$(this).attr('data-id');
  253.              //    $.ajax({
  254.              //    type:"POST",
  255.              //    url:"../aksi/update_privilage.php",
  256.              //    dataType:"json",
  257.              //    data:{nim:nim,nama:nama,jurusan:jurusan},
  258.              //    success:function(result){
  259.              //      if(result.status==1){
  260.              //        alert('success');
  261.              //      }else{
  262.              //        alert('gagal');
  263.              //      }
  264.  
  265.  
  266.  
  267.              //    }
  268.              
  269.              //  });
  270.             });
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.        // $('.updatePrivilage').click(function(){
  278.        //     var tamp=$(this).attr('data-id');
  279.        //        var a="cek"+tamp+1;
  280.        //        var b="cek"+tamp+2;
  281.        //        var c="cek"+tamp+3;
  282.        //        var d=$('#a').attr('data-id');
  283.        //        console.log(d);
  284.        // });
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.         $('#datatable-responsive-1').DataTable();
  292.         $('#datatable-responsive-user-management').DataTable();
  293.        
  294.         /*Date Pembatalan*/
  295.         var date_cancel=$('input[name="birthday"]'); //our date input has the name "date"
  296.         var container=$('.login_content form').length>0 ? $('.login_content form').parent() : "body";
  297.         date_cancel.datepicker({
  298.           format: 'mm/dd/yyyy',
  299.           container: container,
  300.           todayHighlight: true,
  301.           autoclose: true,
  302.         })
  303.         var password_hash = document.getElementById("password_hash")
  304.       , repassword_hash = document.getElementById("repassword_hash");
  305.  
  306.        
  307.  
  308.  
  309.           });
  310.  
  311.  
  312.       function validatePassword(){
  313.           if(password_hash.value != repassword_hash.value) {
  314.             repassword_hash.setCustomValidity("Passwords Don't Match");
  315.           } else {
  316.             repassword_hash.setCustomValidity('');
  317.           }
  318.  
  319.           password_hash.onchange = validatePassword;
  320.           repassword_hash.onkeyup = validatePassword;
  321.         }
  322.  
  323.        
  324.  
  325.  
  326.       // Hapus user
  327.       function hapus(id) {
  328.         var dialog = confirm('Anda yakin akan menghapus data ini ?');
  329.         if(dialog == true){
  330.           $.ajax({
  331.             type: 'POST',
  332.             data: 'id='+id,
  333.             url: '../dash/aksi/hapus.php',
  334.             success: function(result) {
  335.               var response = JSON.parse(result);
  336.               if(response.status){    
  337.                 alert('berhasil');
  338.               }else{                
  339.                 alert('gagal');
  340.               }
  341.             }
  342.           });          
  343.           location.reload();
  344.         }      
  345.        
  346.        };
  347.  
  348.        
  349.       //  $(".open_modal").click(function(e) {
  350.       // var m = $(this).attr("id");
  351.       //  $.ajax({
  352.       //       url: "modal_edit.php",
  353.       //       type: "GET",
  354.       //       data : {id: m,},
  355.       //       success: function (ajaxData){
  356.       //         $("#ModalEdit").html(ajaxData);
  357.       //         $("#ModalEdit").modal('show',{backdrop: 'true'});
  358.       //       }
  359.       //     });
  360.       //   });
  361.  
  362.  
  363.       // Edit User
  364.       $('.editUser').click(function() {
  365.             var x = $(this).attr('id');
  366.             var url = "../dash/aksi/modal_edit.php";
  367.             //alert(x);
  368.             //var y = $(this).attr("data");
  369.            
  370.             $.ajax({
  371.                 url: url,
  372.                 type: "GET",
  373.                 data : {id: x},
  374.                 success: function (ajaxData){
  375.                     $("#tampilUserEdit").html(ajaxData);
  376.                     $("#tampilUserEdit").modal('show');
  377.                 }
  378.             });
  379.  
  380.             // alert('edit');
  381.            
  382.         });
  383.  
  384.       // Update User
  385.            
  386.       function save() {
  387.           // alert('update data');
  388.           // $("#tampilUserEdit").modal('hide');
  389.           var url = "../dash/aksi/proses_edit.php";
  390.           $('#btnSave').text('saving...'); //change button text
  391.           $('#btnSave').attr('disabled',true); //set button disable
  392.           var id = $('#id').val();    
  393.           var username = $('#username').val();  
  394.           var password_hash = $('#pass').val();  
  395.           var repassword_hash = $('#pass2').val();  
  396.           var company = $('#company').val();  
  397.           var name = $('#name').val();  
  398.           var level_akses = $('#level_akses').val();  
  399.           var hp = $('#hp').val();
  400.           var pass_old = $('#pass_old').val();
  401.           var email  = $('#email').val();
  402.           if(password_hash != repassword_hash)
  403.           {
  404.             alert('Confirm Password Dont Match');
  405.             $('#pass2').focus();
  406.           }else
  407.           {
  408.             $.ajax({
  409.                 url : url,
  410.                 type: "POST",
  411.                 data : {id: id, username:username , email: email, password_hash: password_hash, company: company,
  412.                   name: name, level_akses: level_akses , hp: hp, pass_old: pass_old},
  413.                 dataType: "JSON",
  414.                 success: function(data)
  415.                 {
  416.                     if(data.status) //if success close modal and reload ajax table
  417.                     {
  418.                         $("#tampilUserEdit").modal('hide');
  419.                         location.reload();
  420.                     }
  421.                     else
  422.                     {
  423.                         for (var i = 0; i < data.inputerror.length; i++)
  424.                         {
  425.                             $('[name="'+data.inputerror[i]+'"]').parent().parent().addClass('has-error'); //select parent twice to select div form-group class and add has-error class
  426.                             $('[name="'+data.inputerror[i]+'"]').next().text(data.error_string[i]); //select span help-block class set text error string
  427.                         }
  428.                     }
  429.  
  430.                     // $('#btnSave').text('Update'); //change button text
  431.                     $('#btnSave').attr('disabled',false); //set button enable
  432.                     location.reload();
  433.                    
  434.  
  435.  
  436.                 },
  437.                 error: function (jqXHR, textStatus, errorThrown)
  438.                 {
  439.                     alert('Error adding / update data');
  440.                     $('#btnSave').text('save'); //change button text
  441.                     $('#btnSave').attr('disabled',false); //set button enable
  442.  
  443.                 }
  444.             });
  445.             // console.log(id,email,password_hash,repassword_hash,company,first_name,last_name,level_akses,gender,phone);
  446.           }
  447.  
  448.        
  449.       }
  450.  
  451.       $("#stat_regis").alert();
  452.       window.setTimeout(function() {
  453.         // $(".alert").fadeOut();
  454.         $("#stat_regis").alert('close');
  455.         $("#stat_regis").slideUp(500);
  456.       }, 5000);
  457.  
  458.              
  459.  
  460.        // $('.updatePrivilage').click(function(){
  461.        //     var tamp=$(this).attr('data-id');
  462.        //        var a="cek"+tamp+1;
  463.        //        var b="cek"+tamp+2;
  464.        //        var c="cek"+tamp+3;
  465.        //        var d=$('#a').attr('data-id');
  466.        //        console.log
  467.  
  468.  
  469.                    
  470.              
  471.            
  472.        // });
  473.        
  474.      
  475.      
  476.     </script>
  477.  
  478.   </body>
  479. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement