Advertisement
Guest User

Untitled

a guest
Nov 20th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.99 KB | None | 0 0
  1. <?php
  2. $db = 'work_time';
  3. $host = 'localhost';
  4. $dsn = "mysql:host={$host};dbname={$db}";
  5. $dbuser = 'work_time';
  6. $dbpass = 'QppE3W5VfJ7iSJjC';
  7. $options = [ PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', ];
  8. $dbh = new PDO($dsn, $dbuser, $dbpass, $options);
  9. $pname = 'admin.php';
  10. $ipAddress=$_SERVER['REMOTE_ADDR'];
  11. $arp=`arp -a $ipAddress`;
  12. $lines=explode(" ", $arp);
  13. $user_mac=$lines[3];
  14. $allow_admins=array(
  15.   "38:d5:47:11:7f:7f" ,
  16.   "2c:57:31:e2:0c:70" ,
  17.    );
  18.  
  19. if (!in_array($user_mac, $allow_admins))
  20.   {
  21.     echo "<img src=\"oops.jpg\"></img><br>";
  22.     echo "<h3><b>OOPS! <br> Доступ к данной <br> странице запрещен!</b></h3>";
  23.     die();
  24.   }
  25. ?>
  26.  
  27. <!DOCTYPE html>
  28. <html lang="ru">
  29. <html>
  30.   <head>
  31.     <title>Учет рабочего времени V1.0 - Админ режим</title>
  32.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  33.     <link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet">
  34.     <link href="../bootstrap/css/bootstrap-theme.min.css" rel="stylesheet">
  35.     <link href="../bootstrap/css/bootstrap-select.min.css" rel="stylesheet">
  36.     <link href="../bootstrap/css/bootstrap-select.min.css" rel="stylesheet">
  37.     <script src="../bootstrap/jquery.min.js"></script>
  38.     <link rel="shortcut icon" href="login.png">
  39.     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  40.   </head>
  41. <body>
  42. <script src="../bootstrap/js/bootstrap.min.js"></script>
  43.  
  44.  
  45. <?php
  46. if ($_POST['disable']) { die(); }
  47. ?>
  48.  
  49. <nav class="navbar navbar-inverse navbar-fixed-top">
  50.   <div class="container">
  51.     <img align="left" width="7%" src="logo.png">
  52.     <div class="navbar-header">  
  53.       <a class="navbar-brand" href="<?php echo($pname);?>">Учет рабочего времени V1.0. Админ панель.:</a>
  54.       <form action="" method="post">
  55.       <input type="text" name="addrealuser" placeholder="Ф.И.О." size="25" style="width: 250px;">
  56.       <input type="text" name="adduser" placeholder="Mac адрес" size="25" style="width: 250px;">
  57.       <button type="submit" class="btn btn-md btn-success" name="add">Добавить</button>
  58.       </form>
  59.     </div>  
  60.   </div>
  61. </nav>
  62. <br>
  63. <br>
  64. <br>
  65. <br>
  66. <div class="col-md-122">
  67.   <table class="table table-striped">
  68.     <thead>
  69.       <tr>
  70.         <th>#</th>
  71.         <th>Реальное имя</th>
  72.         <th>MAC устройства</th>
  73.         <th>Параметры</th>
  74.       </tr>
  75.     </thead>
  76.   <tbody>
  77.   <?php
  78.    $counter=1;
  79.    $mysql="SELECT * FROM `tUsers`";
  80.    $sql=$dbh->query($mysql, PDO::FETCH_ASSOC);
  81.     foreach ($sql as $key => $result)
  82.       {
  83.         $emptymac=0;
  84.         echo("<tr>");
  85.         echo("<form action=\"\" method=POST>");
  86.         echo("<td width=\"30px\">".$counter."</td>");
  87.         echo("<td width=\"250px\">".$result['user']."</td>");
  88.         echo("<td width=\"200px\"><input type=\"text\" size=\"14px\" id=\"".$result['number']."\" onChange=\"Save(".$result['number'].")\" value=\"".$result['mac']."\"</td>");
  89.         echo("<td>");
  90.         echo("<button type=\"button\" class=\"btn btn-md\" name=\"del\" onclick=\"ShowPass(".$result['number'].")\">Редактировать</button>");
  91.         if ($result['active'] == 1)
  92.                 { echo("<button type=\"submit\" class=\"btn btn-md btn-warning\" name=\"disable\">Деактивировать</button>"); }
  93.               else
  94.                 { echo("<button type=\"submit\" class=\"btn btn-md btn-success\" name=\"enable\">Активировать</button>"); }
  95.         echo("<button type=\"submit\" class=\"btn btn-md btn-danger\" name=\"del\">Удалить</button></td>");
  96.         echo("</form></tr>");
  97.         $counter++;
  98.       }
  99.   ?>
  100.     </tbody>
  101.   </table>
  102. </div>
  103.  
  104. <script>
  105.   function Save(txt)
  106.   {
  107.    var x = document.getElementById(txt).value;
  108.    $.ajax({type:'POST', dataType:'text', url:'admin.php', data:'param=sadasdfsadfsadfsadfsadfsadfsadfasdfasdfasdfsadfsafsafsafsadfsadfsadff'});
  109.   }
  110.   </script>
  111. </body>
  112. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement