Advertisement
Guest User

Untitled

a guest
Feb 2nd, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.23 KB | None | 0 0
  1.  
  2.  
  3. <?php
  4. session_start();
  5.  
  6. //PHP GIUSTO ULTIMA VERSIOEN 22/03/2018
  7. //variabili utili
  8. $servername = "localhost";
  9. $username = "root"; //pp2shreg_smart
  10. $password = ""; //;lD,BaZkkh{. //ASDASD123123
  11. $dbname = "pp2shreg_smartdoor2018";
  12.  
  13.  
  14. /*
  15. $username = "root";
  16. $password = "";//;lD,BaZkkh{.
  17. */
  18.  
  19. //Creazione della connessione con il db
  20. //Verifichiamo se c'è la connessione
  21.  
  22. $conn = new mysqli($servername, $username, $password, $dbname);
  23. if ($conn->connect_error) {
  24. die("Connessione fallita: " . $conn->connect_error);
  25. }
  26.  
  27. //query pin
  28. $sql = "SELECT `pin` FROM `accesso` WHERE `pin` = '".$_POST['pin']."'";
  29. $result = $conn->query($sql);
  30.  
  31. if ($result->num_rows > 0) {
  32. while($row = $result->fetch_assoc()) {
  33. //pin corretto
  34. $myfile = fopen("test/index.html", "w") or die("Unable to open file!");
  35. $txt = "1";
  36. fwrite($myfile, $txt);
  37.  
  38. }
  39. } else {
  40. //pin sbagliato
  41. $myfile = fopen("test/index.html", "w") or die("Unable to open file!");
  42. $txt = "2";
  43. fwrite($myfile, $txt);
  44. sleep(2);
  45. $myfile = fopen("test/index.html", "w") or die("0");
  46. $txt = "0";
  47. fwrite($myfile, $txt);
  48.  
  49.  
  50. }
  51.  
  52.  
  53.  
  54. //query admin
  55. $sql1 = "SELECT * FROM `pannello` WHERE `user` = '".$_POST['uname1']."' AND `pass` = '".$_POST['psw1']."'";
  56. $result1 = $conn->query($sql1);
  57. if($result1->num_rows>0){
  58. $_SESSION["user"] = $_POST['uname1'];
  59. header("Location: pannelloDiControllo.php");
  60. }
  61. else
  62. {
  63. //header("Location: index.php");
  64. }
  65.  
  66. $conn->close();
  67. ?>
  68. <html lang="it">
  69. <head>
  70. <title>Login SmartDoor</title>
  71. <meta charset="UTF-8">
  72. <meta name="viewport" content="width=device-width, initial-scale=1">
  73. <!--===============================================================================================-->
  74. <link rel="icon" type="image/png" href="images/icons/favicon.ico"/>
  75. <!--===============================================================================================-->
  76. <link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css">
  77. <!--===============================================================================================-->
  78. <link rel="stylesheet" type="text/css" href="fonts/font-awesome-4.7.0/css/font-awesome.min.css">
  79. <!--===============================================================================================-->
  80. <link rel="stylesheet" type="text/css" href="fonts/Linearicons-Free-v1.0.0/icon-font.min.css">
  81. <!--===============================================================================================-->
  82. <link rel="stylesheet" type="text/css" href="vendor/animate/animate.css">
  83. <!--===============================================================================================-->
  84. <link rel="stylesheet" type="text/css" href="vendor/css-hamburgers/hamburgers.min.css">
  85. <!--===============================================================================================-->
  86. <link rel="stylesheet" type="text/css" href="vendor/animsition/css/animsition.min.css">
  87. <!--===============================================================================================-->
  88. <link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css">
  89. <!--===============================================================================================-->
  90. <link rel="stylesheet" type="text/css" href="vendor/daterangepicker/daterangepicker.css">
  91. <!--===============================================================================================-->
  92. <link rel="stylesheet" type="text/css" href="css/util.css">
  93. <link rel="stylesheet" type="text/css" href="css/main.css">
  94. <link rel="stylesheet" type="text/css" href="css/modal.css">
  95. <!--===============================================================================================-->
  96. <script>
  97. // Get the modal
  98. var modal = document.getElementById('id01');
  99.  
  100. // When the user clicks anywhere outside of the modal, close it
  101. window.onclick = function(event) {
  102. if (event.target == modal) {
  103. modal.style.display = "none";
  104. }
  105. }
  106. </script>
  107.  
  108. </head>
  109. <body onLoad="ResetTime()">
  110.  
  111. <div class="limiter">
  112. <div class="container-login100">
  113. <div class="wrap-login100 p-l-85 p-r-85 p-t-55 p-b-55">
  114. <form action="" method="post" class="login100-form validate-form flex-sb flex-w">
  115. <span class="login100-form-title p-b-32">
  116. SmartDoor
  117. </span>
  118.  
  119. <label for="pin"><b>PIN</b></label>
  120. <div class="wrap-input100 validate-input m-b-36">
  121. <input type="password" name="pin" maxlength="4" placeholder="Inserisci il PIN" required>
  122. </div>
  123.  
  124. <div class="container-login100-form-btn" style="margin-left:30%">
  125. <button class="login100-form-btn">
  126. Aprire la porta
  127. </button>
  128. </div>
  129.  
  130. <div class="flex-sb-m w-full p-b-48" onclick="document.getElementById('id01').style.display='flex'"></br>
  131. <div>
  132. <a href="#" class="txt3">
  133. <img title="Pannello di controllo" border="0" src="images/icons/download.png" width="40" height="40">
  134. </a>
  135. </div>
  136. </div>
  137. </form>
  138. </div>
  139. </div>
  140. </div>
  141.  
  142. <div id="dropDownSelect1"></div>
  143.  
  144. <!-- The Modal -->
  145. <div class="limiter">
  146. <div id="id01" class="modal" style="background-color:#ebebeb">
  147. <div class="wrap-login100 p-l-85 p-r-85 p-t-55 p-b-55">
  148.  
  149. <span onclick="document.getElementById('id01').style.display='none'"
  150. class="close" title="Chiudi">&times;</span>
  151.  
  152. <form action="" method="post" class="login100-form validate-form flex-sb flex-w">
  153. <span class="titleModal">SmartDoor</span>
  154.  
  155. <label for="uname"><b>Nickname</b></label>
  156. <input type="text" placeholder="Inserisci il tuo Nickname" name="uname1" required>
  157.  
  158. <label for="psw"style="margin-top:2%"><b>Password</b></label>
  159. <input type="password" placeholder="Inserisci la Password" name="psw1" required>
  160. <div class="container-login100-form-btn" style="margin-left:30%">
  161.  
  162. <button class="login100-form-btn" style="margin-top:10%" >Accedi</button>
  163.  
  164. </div>
  165. </form>
  166. </div> </div>
  167. </div>
  168.  
  169.  
  170.  
  171. <!--===============================================================================================-->
  172. <script src="vendor/jquery/jquery-3.2.1.min.js"></script>
  173. <!--===============================================================================================-->
  174. <script src="vendor/animsition/js/animsition.min.js"></script>
  175. <!--===============================================================================================-->
  176. <script src="vendor/bootstrap/js/popper.js"></script>
  177. <script src="vendor/bootstrap/js/bootstrap.min.js"></script>
  178. <!--===============================================================================================-->
  179. <script src="vendor/select2/select2.min.js"></script>
  180. <!--===============================================================================================-->
  181. <script src="vendor/daterangepicker/moment.min.js"></script>
  182. <script src="vendor/daterangepicker/daterangepicker.js"></script>
  183. <!--===============================================================================================-->
  184. <script src="vendor/countdowntime/countdowntime.js"></script>
  185. <!--===============================================================================================-->
  186. <script src="js/main.js"></script>
  187.  
  188. </body>
  189. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement