Advertisement
Guest User

Untitled

a guest
Nov 5th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.58 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <?php
  4. session_start();
  5.  
  6. ?>
  7. <html lang="it">
  8. <head>
  9. <meta charset="utf-8">
  10. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  11. <meta name="viewport" content="width=device-width, initial-scale=1">
  12. <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
  13. <meta name="description" content="">
  14. <meta name="author" content="">
  15. <link rel="icon" href="docs/favicon.ico">
  16.  
  17. <title>Pagina di login</title>
  18.  
  19. <!-- Bootstrap -->
  20. <link href="css/bootstrap.min.css" rel="stylesheet">
  21.  
  22. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  23. <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  24. <!--[if lt IE 9]>
  25. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  26. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  27. <![endif]-->
  28.  
  29.  
  30. <!-- Custom CSS **************************************
  31. <link href="css/freelancer.css" rel="stylesheet">
  32.  
  33. Custom Fonts
  34. <link href="/bootstrap/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
  35. <link href="http://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
  36. <link href="http://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic" rel="stylesheet" type="text/css">
  37.  
  38.  
  39.  
  40.  
  41. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  42. <link href="docs/assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">
  43. <link href="jumbotron-narrow.css" rel="stylesheet">
  44. <!-- Custom styles for this template -->
  45. <link href="signin.css" rel="stylesheet">
  46.  
  47. <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
  48. <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
  49. <script src="docs/assets/js/ie-emulation-modes-warning.js"></script><style type="text/css"></style>
  50.  
  51. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  52. <!--[if lt IE 9]>
  53. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  54. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  55. <![endif]-->
  56.  
  57.  
  58. </head>
  59. <body>
  60.  
  61. <br><br>
  62. <center><img src="girada.jpg" height="100" width="100"/></center>
  63. <br><b><center>Benvenuto in Girada Free </center></b>
  64.  
  65.  
  66.  
  67.  
  68. <div class="jumbotron">
  69. <div class="container">
  70.  
  71. <form class="form-signin" method="POST" action="">
  72. <center><h2 class="form-signin-heading">Accedi alla piattaforma</h2></center>
  73. <br>
  74. <label for="inputEmail" class="sr-only">Username</label>
  75. <input type="text" name="username" id="inputEmail" class="form-control" placeholder="Username" required="" autofocus=""><br><br>
  76. <label for="inputPassword" class="sr-only">Password</label>
  77. <input type="password" name="password" id="inputPassword" class="form-control" placeholder="Password" required="">
  78. <br><br>
  79. <button class="btn btn-lg btn-primary btn-block" type="submit" name="invia" value="Login">Accedi</button>
  80. </form>
  81.  
  82. </div>
  83. </div>
  84.  
  85.  
  86.  
  87.  
  88.  
  89. <!--
  90.  
  91. <form method="POST" action="" class="form-horizontal" role="form">
  92. <div class="form-group">
  93. <label class="control-label col-sm-2" for="email">
  94. username</label>
  95. <div class="col-sm-10">
  96. <input type="text" name="username" required>
  97. </div></div><br><br>
  98. <div class="form-group">
  99. <label class="control-label col-sm-2" for="email">
  100. password</label>
  101. <div class="col-sm-10">
  102. <input type="password" name="password" required>
  103. </div></div><br><br>
  104. <div class="form-group">
  105. <div class="col-sm-offset-2 col-sm-10">
  106. <input type="submit" class="btn btn-default" name="invia" value="Login">
  107.  
  108. </div>
  109. </div>
  110. </form>
  111.  
  112. -->
  113. <?php
  114. if(isset($_POST['username'])){
  115. $_SESSION['username']=$_POST['username'];
  116. }
  117. // nome di host
  118. $host = "localhost";
  119. // nome del database
  120. $db = "my_giradafree";
  121. // username dell'utente in connessione
  122. $user = "giradafree";
  123. // password dell'utente
  124. $password = "";
  125. //blocco try/catch di gestione delle eccezioni
  126. try {
  127. // stringa di connessione al DBMS
  128. $connessione = new PDO("mysql:host=$host;dbname=$db", $user, $password);
  129. // notifica in caso di connessione effettuata
  130. // echo "Connessione a MySQL tramite PDO effettuata.";
  131. }
  132. catch(PDOException $e)
  133. {
  134. // notifica in caso di errore nel tentativo di connessione
  135. echo $e->getMessage();
  136. }
  137.  
  138.  
  139. if(isset($_POST['invia'])){
  140. $_SESSION['username']=$_POST['username'];
  141. $sql = "SELECT username, password, ID FROM utenti WHERE username= :user AND password= :pass ";
  142.  
  143. $count = $connessione->prepare($sql);
  144. $count->bindParam(':user', $_POST['username']);
  145. $count->bindParam(':pass', $_POST['password']);
  146.  
  147. $count->execute();
  148. $result = $count->fetch();
  149.  
  150. if($result['username']==$_POST['username'] && $result['password']==$_POST['password']){
  151. header("Location:\protocollo/registrazione.php");
  152. }
  153. else{
  154. ?>
  155. <br><h3><center>Dati errati. Riprovare</h3><center>
  156. <?php
  157. }
  158.  
  159.  
  160.  
  161.  
  162. }
  163.  
  164.  
  165. ?>
  166.  
  167. <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
  168. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  169. <!-- Include all compiled plugins (below), or include individual files as needed -->
  170. <script src="js/bootstrap.min.js"></script>
  171. </body>
  172. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement