Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("include/BasicLib.php");
- ?>
- <h1>Log In</h1>
- <script type="text/javascript">
- $(document).ready(function() {
- $("#submit").click(function(){
- var username = $("#username").val();
- var password = $("#password").val();
- $.post(
- "login.php",
- {
- username: username,
- password: password
- },
- function(msg)
- {
- $("#section").html(msg);
- });
- });
- });
- $('#password').change(function(e) {
- $('input[type=button]').click();
- });
- </script>
- <?php
- if($logged)
- {
- echo "Sei già loggato... Verrai reinderizzato alla home!";
- ?>
- <script type="text/javascript">
- setTimeout(function(){ homepage(); }, 1500);
- </script>
- <?php
- }
- else if(@checkParameter($_POST['username']) && @checkParameter($_POST['password']))
- {
- $username = $conn->escape_string($_POST['username']);
- $password = $conn->escape_string($_POST['password']);
- $SQL = "SELECT ID FROM Utenti WHERE Username ='".$username."' AND Password ='".$password."'";
- $result = $conn->query($SQL);
- $row = $result->fetch_assoc();
- if($row)
- {
- setSession($row['ID'], $username, $password);
- echo "Login effettuato... Verrai reinderizzato alla home!";
- ?>
- <script type="text/javascript">
- setTimeout(function(){ window.location.href = "index.php"; }, 1500);
- </script>
- <?php
- }
- else
- {
- echo "Username o Password errati!";
- }
- }
- else
- {
- ?>
- <form name="Login">
- <h3 class="center">Username</h3>
- <input type="text" id="username" name="username" pattern=".{3,10}" placeholder="Minimo 3, Massimo 10">
- <br>
- <h3 class="center">Password</h3>
- <input type="password" id="password" name="password" pattern=".{6,16}" placeholder="Minimo 6, Massimo 16">
- <br>
- <br>
- <input class="buttonStyle" type="button" id="submit" value="Login">
- </form>
- <?php
- }
- $conn->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement