Advertisement
Guest User

Untitled

a guest
Aug 9th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.54 KB | None | 0 0
  1. <?php @session_start();?>
  2. <html>
  3. <head>
  4. <title>BijuArtes - Login</title>
  5. <link href="css/layout.css" rel="stylesheet" type="text/css"/>
  6. <style>
  7. body{background-color: #d6a619; margin:0px; background-image: url("img/principais/lr.jpg");
  8. background-size: cover;background-repeat: no-repeat;background-attachment: fixed;}
  9. label{display: inline-block; width: 100px;}
  10. </style>
  11. </head>
  12. <body>
  13.  
  14. <!-----------------------------PHP-------------------->
  15. <?php
  16. include("connection.php");
  17.  
  18. if(isset($_POST['submit'])) {
  19. $user = mysqli_real_escape_string($mysqli, $_POST['username']);
  20. $pass = mysqli_real_escape_string($mysqli, $_POST['password']);
  21.  
  22. if($user == "" || $pass == "") {
  23. echo "Os seus dados estão incorrectos. Tente novamente.";
  24. echo "<br/>";
  25. echo "<a href='login.php'>Voltar</a>";
  26. } else {
  27. $result = mysqli_query($mysqli, "SELECT * FROM login WHERE username='$user' AND password=md5('$pass')")
  28. or die("Não foi possível neste momento executar o seu pedido.");
  29. $row = mysqli_fetch_assoc($result);
  30. if(is_array($row) && !empty($row)) {
  31. $validuser = $row['username'];
  32. $_SESSION['validado'] = $validuser;
  33. $_SESSION['nome'] = $row['nome'];
  34. $_SESSION['id'] = $row['id'];
  35. $_SESSION['admin'] = $row['adm'];
  36. echo $_SESSION['id'];
  37. } else {
  38. echo "<p style="text-align: left; color: #d6a619; font-family: Pristina; font-size:30px; margin-top:100px; margin-left: 100px;">Username ou Palavra Pass errados";
  39. echo "<br/>";
  40. echo "<a href='login.php'>Voltar</a>";
  41. }
  42.  
  43. if(isset($_SESSION['validado'])) {
  44. header('Location: indexUser.php');
  45. }
  46. }
  47. } else {
  48. ?>
  49.  
  50. <!-----------------------------HTML-------------------->
  51. <header class="banner">
  52. <img src="img/principais/logo.png" alt="" style="float:left; height: 250px; width: 250px">
  53. <h1 style="font-family:'Pristina'; font-size:40px; color:#d6a619">
  54. Bijuterias e Artesanato</h1>
  55. <nav class="navegacao">
  56. <ul>
  57. <li><a href="index.html">Home</a></li>
  58. </ul>
  59. </nav>
  60. </header>
  61. <h2 style="text-align: left; color: #d6a619; font-family: Pristina; font-size:50px; margin-left:200px;">Login</h2>
  62. <form class="form" name="form1" method="post" action="">
  63. <div class="login">
  64. <label>Username</label>
  65. <input type="text" name="username" required pattern="[a-zA-z]{3,}" style="color: black">
  66. </div>
  67. <div class="login">
  68. <label>Password</label>
  69. <input id="password" name="password" type="password" title="Por Favor introduza uma palavra pass válida" required style="color: black">
  70. </div>
  71.  
  72. <div class="login">
  73. <input type="submit" name="submit" style="color: goldenrod; background-color: black; font-size:15px; font-weight: bold;" value="Login">
  74. <input type="reset" name="reset" style="color: black; background-color: #ffd966; font-size:15px; font-weight: bold;" value="Limpar">
  75. </div>
  76.  
  77. </form>
  78. <br/>
  79. <p style="text-align: center; color: #e6ac00; font-size: 15px; font-family: Verdana">Área reservada a utilizadores registados. Caso queira registar-se <a href="registo.php">Clique aqui</p>
  80.  
  81. <?php
  82. }
  83. ?>
  84.  
  85. <?php @session_start(); ?>
  86.  
  87. <html>
  88. <head>
  89. <title>BijuArtes - Área Utilizador</title>
  90. <meta charset="UTF-8">
  91. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  92. <link href="css/layout.css" rel="stylesheet" type="text/css"/>
  93. <style>
  94. body{background-color: #d6a619; margin:0px; background-image: url("img/principais/fundo.jpg");
  95. background-size: cover;background-repeat: no-repeat;background-attachment: fixed;}
  96. </style>
  97. </head>
  98. <body>
  99. <?php
  100. if(isset ($_SESSION['nome'])) {
  101. ?>
  102.  
  103. <?php
  104. } else {
  105. echo "Faça login para ver esta página.<br/><br/>";
  106. echo "<a href='login.php'>Login</a>";
  107. }
  108. ?>
  109. <header class="banner">
  110. <img src="img/principais/logo.png" alt="" style="float:left; height: 250px; width: 250px">
  111. <h1 style="font-family:'Pristina'; font-size:40px; color:#d6a619">
  112. Bijuterias e Artesanato <br/>
  113.  
  114.  
  115. <audio autoplay controls style='float: right'>
  116. <source src="audio/som.mp4" type="audio/mpeg">
  117. </audio>
  118.  
  119. <nav class="navegacao">
  120. <ul>
  121. <li><a href="index.html">Home</a></li>
  122. <li><a href="bijuterias.html">Bijuterias</a></li>
  123. <li><a href="artesanato.html">Artesanato</a></li>
  124. <li><a href="contactos.php">Contactos</a></li>
  125. <li style="float: right"><a href="logout.php">Logout</a></li>
  126. <li style="float: right" ><a href="dados.php">Ver meus dados</a></li>
  127. <li><br/></li>
  128. <?php
  129. if($_SESSION['admin'] == 1) {
  130. echo '<li><a href="vertodas.php">Caixa de mensagens</a></li>
  131. <li><a href="vernovas.php">Novas mensagens</a></li>
  132. <li style="float: right"><a href="produtos.php">Consultar/Adicionar Produtos</a></li>';
  133. }
  134. ?>
  135. </ul>
  136. <br/>
  137. <h1 style="font-family: Pristina; font-size: 40px; text-align: left; color: goldenrod; ">Olá <?php echo $_SESSION['nome']?> </h1>
  138. </nav>
  139.  
  140. </header>
  141.  
  142. <section class="moldura">
  143. <div class="artigo">
  144. <img src="img/principais/bijuterias.jpg" alt="" style="border-radius: 10%; width: 80%; height:80%; margin: 40px;"/>
  145. </div>
  146. <div class="artigo">
  147. <img src="img/principais/artesanato.jpg" alt="" style="border-radius: 10%; width: 80%; height:80%; margin: 40px;"/>
  148. </div>
  149.  
  150. <div class="artigo">
  151. <img src="img/principais/reciclar.jpg" alt="" style="border-radius: 10%; width: 80%; height:80%; margin: 40px;"/>
  152. </div>
  153. <div class="artigo">
  154. <img src="img/principais/bijux.jpg" alt="" style="border-radius: 10%; width: 80%; height:80%; margin: 40px;"/>
  155. </div>
  156. </section>
  157.  
  158.  
  159. </body>
  160. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement