Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <?php
- session_start();
- ?>
- <html lang="it">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
- <meta name="description" content="">
- <meta name="author" content="">
- <link rel="icon" href="docs/favicon.ico">
- <title>Pagina di login</title>
- <!-- Bootstrap -->
- <link href="css/bootstrap.min.css" rel="stylesheet">
- <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
- <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
- <!--[if lt IE 9]>
- <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
- <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
- <![endif]-->
- <!-- Custom CSS **************************************
- <link href="css/freelancer.css" rel="stylesheet">
- Custom Fonts
- <link href="/bootstrap/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
- <link href="http://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
- <link href="http://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic" rel="stylesheet" type="text/css">
- <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
- <link href="docs/assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">
- <link href="jumbotron-narrow.css" rel="stylesheet">
- <!-- Custom styles for this template -->
- <link href="signin.css" rel="stylesheet">
- <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
- <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
- <script src="docs/assets/js/ie-emulation-modes-warning.js"></script><style type="text/css"></style>
- <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
- <!--[if lt IE 9]>
- <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
- <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
- <![endif]-->
- </head>
- <body>
- <br><br>
- <center><img src="girada.jpg" height="100" width="100"/></center>
- <br><b><center>Benvenuto in Girada Free </center></b>
- <div class="jumbotron">
- <div class="container">
- <form class="form-signin" method="POST" action="">
- <center><h2 class="form-signin-heading">Accedi alla piattaforma</h2></center>
- <br>
- <label for="inputEmail" class="sr-only">Username</label>
- <input type="text" name="username" id="inputEmail" class="form-control" placeholder="Username" required="" autofocus=""><br><br>
- <label for="inputPassword" class="sr-only">Password</label>
- <input type="password" name="password" id="inputPassword" class="form-control" placeholder="Password" required="">
- <br><br>
- <button class="btn btn-lg btn-primary btn-block" type="submit" name="invia" value="Login">Accedi</button>
- </form>
- </div>
- </div>
- <!--
- <form method="POST" action="" class="form-horizontal" role="form">
- <div class="form-group">
- <label class="control-label col-sm-2" for="email">
- username</label>
- <div class="col-sm-10">
- <input type="text" name="username" required>
- </div></div><br><br>
- <div class="form-group">
- <label class="control-label col-sm-2" for="email">
- password</label>
- <div class="col-sm-10">
- <input type="password" name="password" required>
- </div></div><br><br>
- <div class="form-group">
- <div class="col-sm-offset-2 col-sm-10">
- <input type="submit" class="btn btn-default" name="invia" value="Login">
- </div>
- </div>
- </form>
- -->
- <?php
- if(isset($_POST['username'])){
- $_SESSION['username']=$_POST['username'];
- }
- // nome di host
- $host = "localhost";
- // nome del database
- $db = "my_giradafree";
- // username dell'utente in connessione
- $user = "giradafree";
- // password dell'utente
- $password = "";
- //blocco try/catch di gestione delle eccezioni
- try {
- // stringa di connessione al DBMS
- $connessione = new PDO("mysql:host=$host;dbname=$db", $user, $password);
- // notifica in caso di connessione effettuata
- // echo "Connessione a MySQL tramite PDO effettuata.";
- }
- catch(PDOException $e)
- {
- // notifica in caso di errore nel tentativo di connessione
- echo $e->getMessage();
- }
- if(isset($_POST['invia'])){
- $_SESSION['username']=$_POST['username'];
- $sql = "SELECT username, password, ID FROM utenti WHERE username= :user AND password= :pass ";
- $count = $connessione->prepare($sql);
- $count->bindParam(':user', $_POST['username']);
- $count->bindParam(':pass', $_POST['password']);
- $count->execute();
- $result = $count->fetch();
- if($result['username']==$_POST['username'] && $result['password']==$_POST['password']){
- header("Location:\protocollo/registrazione.php");
- }
- else{
- ?>
- <br><h3><center>Dati errati. Riprovare</h3><center>
- <?php
- }
- }
- ?>
- <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
- <!-- Include all compiled plugins (below), or include individual files as needed -->
- <script src="js/bootstrap.min.js"></script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement