Advertisement
Guest User

Untitled

a guest
Jan 24th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. <?php
  2. session_start();
  3. //mysql_connect("localhost", "admin", "admin");
  4. $conn = mysql_connect("localhost", "root");
  5. mysql_select_db("baza");
  6.  
  7.  
  8. ?>
  9. <!DOCTYPE html>
  10. <!--
  11. To change this license header, choose License Headers in Project Properties.
  12. To change this template file, choose Tools | Templates
  13. and open the template in the editor.
  14. -->
  15.  
  16. <html>
  17. <head>
  18. <title>Najlepszy przyjaciel!</title>
  19. <link href="newcss.css" rel="stylesheet" type="text/css"/>
  20. <meta charset="UTF-8">
  21. <script src="js/libs/jquery/jquery.js" type="text/javascript"></script>
  22. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  23. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
  24. </head>
  25. <body>
  26. <div id="container">
  27. <div id="logo">
  28. Najlepszy przyjaciel
  29. </div>
  30. <ul id="menu">
  31. <li class="option"><a href="index.php">Strona główna</a></li>
  32. <li class='option'><a href="galeria.php">Galeria</a></li>
  33. <li class='option'><a href="kontakt.php">Kontakt</a></li>
  34. <li class='option'><a href="logowanie.php">Logowanie</a></li>
  35. <li style='clear:both'></li>
  36. </ul>
  37. <div id="topbar">
  38. <div id="top2">
  39. <br>
  40. <form method="POST" action="logowanie.php">
  41. <b>Login:</b> <input type="text" name="login"><br>
  42. <b>Haslo:</b> <input type="password" name="pass"><br>
  43. <input type="submit" value="Zaloguj" name="loguj">
  44. </form>
  45. </div>
  46. <div class="fadein">
  47. <img src="1.jpg" alt="" >
  48. <img src="tlo.jpg" alt="">
  49. <img src="3.jpg" alt="">
  50. <img src="4.jpg" alt="">
  51. <img src="5.jpg" alt="">
  52. </div>
  53.  
  54.  
  55. <?php
  56. if (isset($_POST['loguj'])) {
  57. $db = mysql_connect("localhost", "root")
  58. or die("<h1> Nie mozna połączyć się z serwerem</h1>");
  59. mysql_select_db("user", $db);
  60. $user = $_POST['login'];
  61. $password = $_POST['pass'];
  62. $pass=hash('sha256', $password);
  63. $sql = "select * from user where login='$user' and pass='$pass'";
  64. $wynik = mysql_query($sql);
  65. $ile_rek = mysql_num_rows($wynik);
  66. if ($ile_rek <> 1) {
  67. echo "Nie wlasciwa nazw lub haslo";
  68. } else { //$ile_rek=1
  69. echo "<h4> Haslo zaakceptowane!</h4>";
  70. $_SESSION['zalogowany'] = true;
  71. $_SESSION['login'] = $login;
  72. }
  73. }
  74. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement