Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- //PHP GIUSTO ULTIMA VERSIOEN 22/03/2018
- //variabili utili
- $servername = "localhost";
- $username = "root"; //pp2shreg_smart
- $password = ""; //;lD,BaZkkh{. //ASDASD123123
- $dbname = "pp2shreg_smartdoor2018";
- /*
- $username = "root";
- $password = "";//;lD,BaZkkh{.
- */
- //Creazione della connessione con il db
- //Verifichiamo se c'è la connessione
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Connessione fallita: " . $conn->connect_error);
- }
- //query pin
- $sql = "SELECT `pin` FROM `accesso` WHERE `pin` = '".$_POST['pin']."'";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- while($row = $result->fetch_assoc()) {
- //pin corretto
- $myfile = fopen("test/index.html", "w") or die("Unable to open file!");
- $txt = "1";
- fwrite($myfile, $txt);
- }
- } else {
- //pin sbagliato
- $myfile = fopen("test/index.html", "w") or die("Unable to open file!");
- $txt = "2";
- fwrite($myfile, $txt);
- sleep(2);
- $myfile = fopen("test/index.html", "w") or die("0");
- $txt = "0";
- fwrite($myfile, $txt);
- }
- //query admin
- $sql1 = "SELECT * FROM `pannello` WHERE `user` = '".$_POST['uname1']."' AND `pass` = '".$_POST['psw1']."'";
- $result1 = $conn->query($sql1);
- if($result1->num_rows>0){
- $_SESSION["user"] = $_POST['uname1'];
- header("Location: pannelloDiControllo.php");
- }
- else
- {
- //header("Location: index.php");
- }
- $conn->close();
- ?>
- <html lang="it">
- <head>
- <title>Login SmartDoor</title>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <!--===============================================================================================-->
- <link rel="icon" type="image/png" href="images/icons/favicon.ico"/>
- <!--===============================================================================================-->
- <link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css">
- <!--===============================================================================================-->
- <link rel="stylesheet" type="text/css" href="fonts/font-awesome-4.7.0/css/font-awesome.min.css">
- <!--===============================================================================================-->
- <link rel="stylesheet" type="text/css" href="fonts/Linearicons-Free-v1.0.0/icon-font.min.css">
- <!--===============================================================================================-->
- <link rel="stylesheet" type="text/css" href="vendor/animate/animate.css">
- <!--===============================================================================================-->
- <link rel="stylesheet" type="text/css" href="vendor/css-hamburgers/hamburgers.min.css">
- <!--===============================================================================================-->
- <link rel="stylesheet" type="text/css" href="vendor/animsition/css/animsition.min.css">
- <!--===============================================================================================-->
- <link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css">
- <!--===============================================================================================-->
- <link rel="stylesheet" type="text/css" href="vendor/daterangepicker/daterangepicker.css">
- <!--===============================================================================================-->
- <link rel="stylesheet" type="text/css" href="css/util.css">
- <link rel="stylesheet" type="text/css" href="css/main.css">
- <link rel="stylesheet" type="text/css" href="css/modal.css">
- <!--===============================================================================================-->
- <script>
- // Get the modal
- var modal = document.getElementById('id01');
- // When the user clicks anywhere outside of the modal, close it
- window.onclick = function(event) {
- if (event.target == modal) {
- modal.style.display = "none";
- }
- }
- </script>
- </head>
- <body onLoad="ResetTime()">
- <div class="limiter">
- <div class="container-login100">
- <div class="wrap-login100 p-l-85 p-r-85 p-t-55 p-b-55">
- <form action="" method="post" class="login100-form validate-form flex-sb flex-w">
- <span class="login100-form-title p-b-32">
- SmartDoor
- </span>
- <label for="pin"><b>PIN</b></label>
- <div class="wrap-input100 validate-input m-b-36">
- <input type="password" name="pin" maxlength="4" placeholder="Inserisci il PIN" required>
- </div>
- <div class="container-login100-form-btn" style="margin-left:30%">
- <button class="login100-form-btn">
- Aprire la porta
- </button>
- </div>
- <div class="flex-sb-m w-full p-b-48" onclick="document.getElementById('id01').style.display='flex'"></br>
- <div>
- <a href="#" class="txt3">
- <img title="Pannello di controllo" border="0" src="images/icons/download.png" width="40" height="40">
- </a>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- <div id="dropDownSelect1"></div>
- <!-- The Modal -->
- <div class="limiter">
- <div id="id01" class="modal" style="background-color:#ebebeb">
- <div class="wrap-login100 p-l-85 p-r-85 p-t-55 p-b-55">
- <span onclick="document.getElementById('id01').style.display='none'"
- class="close" title="Chiudi">×</span>
- <form action="" method="post" class="login100-form validate-form flex-sb flex-w">
- <span class="titleModal">SmartDoor</span>
- <label for="uname"><b>Nickname</b></label>
- <input type="text" placeholder="Inserisci il tuo Nickname" name="uname1" required>
- <label for="psw"style="margin-top:2%"><b>Password</b></label>
- <input type="password" placeholder="Inserisci la Password" name="psw1" required>
- <div class="container-login100-form-btn" style="margin-left:30%">
- <button class="login100-form-btn" style="margin-top:10%" >Accedi</button>
- </div>
- </form>
- </div> </div>
- </div>
- <!--===============================================================================================-->
- <script src="vendor/jquery/jquery-3.2.1.min.js"></script>
- <!--===============================================================================================-->
- <script src="vendor/animsition/js/animsition.min.js"></script>
- <!--===============================================================================================-->
- <script src="vendor/bootstrap/js/popper.js"></script>
- <script src="vendor/bootstrap/js/bootstrap.min.js"></script>
- <!--===============================================================================================-->
- <script src="vendor/select2/select2.min.js"></script>
- <!--===============================================================================================-->
- <script src="vendor/daterangepicker/moment.min.js"></script>
- <script src="vendor/daterangepicker/daterangepicker.js"></script>
- <!--===============================================================================================-->
- <script src="vendor/countdowntime/countdowntime.js"></script>
- <!--===============================================================================================-->
- <script src="js/main.js"></script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement