Guest User

Untitled

a guest
Nov 18th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. <?php
  2. if (!isset($_SESSION)){
  3. session_start();
  4. }
  5. require('connect.php');
  6.  
  7. if (isset($_POST['username']) and isset($_POST['password'])){
  8.  
  9. $username = $_POST['username'];
  10. $password = $_POST['password'];
  11. $query = "SELECT * FROM `user` WHERE username='$username' and password='$password'";
  12.  
  13. $result = mysqli_query($connection, $query) or die(mysqli_error($connection));
  14. $count = mysqli_num_rows($result);
  15.  
  16. if ($count == 1){
  17. $_SESSION['username'] = $username;
  18. }else{
  19.  
  20. ?>
  21. <script>alert("Nome de usuario ou e-mail, inexistentes por favor tente novamente ...");</script>
  22. <?php
  23. }
  24. }
  25.  
  26. if (isset($_SESSION['username'])){
  27. ?>
  28.  
  29. <script>
  30. location.href="dashboard.php"
  31. </script>
  32.  
  33. <?php }else{ ?>
  34.  
  35. <div class="container-left-loginregister">
  36.  
  37. </div>
  38.  
  39. <div class="container-rigth-loginregister">
  40.  
  41. <img src="img2.png">
  42.  
  43. <div class="links">
  44. <a class="btn-loginregister btn-act" href="login.php">Login</a>
  45. <a class="btn-loginregister" href="register.php">Cadastrar</a>
  46. <p></p>
  47. </div>
  48.  
  49. <form class="form-signin" method="POST">
  50. <div class="input-group">
  51. <span class="input-group-addon"><i class="fa fa-user"></i></span>
  52. <input type="text" name="username" class="form-control" placeholder="Nome de usuário" required>
  53. </div>
  54. <span class="input-group-addon"><i class="fa fa-key"></i></span>
  55. <input type="password" name="password" id="inputPassword" class="form-control" placeholder="Senha" required>
  56. <button class="btn btn-lg btn-primary btn-enviar" type="submit">Enviar</button>
  57. </form>
  58.  
  59. </div>
  60.  
  61. <?php } ?>
  62.  
  63. <?php
  64.  
  65. if (!isset($_SESSION)){
  66. session_start();
  67. }
  68.  
  69. require('connect.php');
  70.  
  71. if (isset($_SESSION['username'])){
  72. $username = $_SESSION['username'];
  73.  
  74. include 'menus.php';
  75. ?>
  76.  
  77. <header>
  78. <h1>Painel dashboard</h1>
  79. <h4><?php echo $username; ?> / Dashboard</h4>
  80. </header>
  81.  
  82. <div class="box-dashboard">
  83.  
  84. <h1>Bem vindo(a) a Invest Amigo!</h1>
  85.  
  86. <p>Aqui voce pode adicionar seus produtos, ofertas e relatorio para termos em nossa base e investidores poderem saber sobre seu rendimento ...</p>
  87.  
  88. <a href="produtos.php">Adicionar um produto</a>, <a href="ofertas.php">Adicionar oferta</a> ou <a href="relatorio.php">relatorio</a>
  89. </div>
  90.  
  91. <?php }else{ ?>
  92.  
  93. <script>
  94. location.href="login.php"
  95. </script>
  96.  
  97. <?php } ?>
Add Comment
Please, Sign In to add comment