Advertisement
Guest User

Untitled

a guest
Jan 16th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. <?php
  2. session_start();
  3. if(empty($_SESSION['login']))
  4. {
  5. $_SESSION['login']="1";
  6. };
  7. if(!empty($_POST['submit']))if($_POST['submit']=="Zarejestruj"){$_SESSION['login']="2";};
  8.  
  9.  
  10. if(!empty($_POST['dany'])){
  11. $servername = "localhost";
  12. $username = "17760";
  13. $password = "95070803910";
  14. $dbname = "17760";
  15. $conn = new mysqli($servername, $username, $password, $dbname);
  16. if ($conn->connect_error) {
  17. die("Connection failed: " . $conn->connect_error);
  18. }
  19. $logon = "INSERT INTO `logowanie`(login, haslo) VALUES ('".$_POST['Login']."', '".$_POST['Password']."')";
  20. if (mysqli_query($conn, $logon)) {
  21. echo "Pomyślne utworzenie konta";
  22. } else {
  23. echo "Error: " . mysqli_error($conn);
  24. }
  25. $_SESSION['login']="1";};
  26.  
  27.  
  28. if(!empty($_POST['submit']))if($_POST['submit']=="Login"){
  29. $servername = "localhost";
  30. $username = "17760";
  31. $password = "95070803910";
  32. $dbname = "17760";
  33. $conn = new mysqli($servername, $username, $password, $dbname);
  34. if ($conn->connect_error) {
  35. die("Connection failed: " . $conn->connect_error);
  36. }
  37. $sql = "SELECT * FROM `logowanie`";
  38. $result = $conn->query($sql);
  39. if ($result->num_rows > 0)
  40. {
  41. while($row = $result->fetch_assoc()) {
  42. If($row["login"]==$_POST['LoginL']&&$row["haslo"]==$_POST['PasswordL']){$_SESSION['login']="3";};
  43. }
  44. }
  45. $conn->close();
  46. };
  47. ?>
  48. <!doctype html>
  49. <html>
  50. <head>
  51. <style>
  52. body {
  53. background:url("http://d75822.medialib.glogster.com/eyisrael1/media/78/784420e8a5b9f5e53daec27e89b5b84559e17bc9/adventure-time-1.png") no-repeat center center fixed;
  54. background-size: 100% 100%;
  55. color:BlueViolet;
  56. text-align:center;
  57. }
  58. h1
  59. {
  60. margin-top:150px;
  61. margin-bottom:70px;
  62. font-size:2.5em;
  63. }
  64. main
  65. {
  66. display: inline-block;
  67. }
  68. figure {
  69. float:left;
  70. margin:20px;
  71. width:200px;
  72. }
  73. img
  74. {
  75. width:200px;
  76. height:124px;
  77. }
  78. figcaption
  79. {
  80. font-size:150%;
  81. }
  82. form{
  83. margin:0 auto;
  84. margin-top:150px;
  85. margin-bottom:70px;
  86. width:200px;
  87. border:1px solid black;
  88. }
  89. </style>
  90. </head>
  91. <body>
  92. <?php
  93.  
  94. switch ($_SESSION['login']) {
  95. case "1":
  96. {?>
  97. <form action="" method="post">
  98. Login: <input type="text" name="LoginL"><br>
  99. Password: <input type="password" name="PasswordL"><br>
  100. <input type="submit" name="submit" value="Login">
  101. <input type="submit" name="submit" value="Zarejestruj">
  102. </form>
  103. <?php };
  104. break;
  105. case "2":
  106. {?>
  107. <form action="" method="post">
  108. Rejestracja<br>
  109. Login: <input type="text" name="Login"><br>
  110. Password: <input type="password" name="Password"><br>
  111. <input type="submit" name="dany" value="Rejestracja">
  112. </form>
  113. <?php };
  114. break;
  115. case "3":
  116. {?>
  117. <h1>*CHOOSE YOUR LANGUAGE*</h1>
  118. <main>
  119. <figure>
  120. <a href="ang/"><img src="Ukball.jpg"></a>
  121. <figcaption>ENGLISH</figcaption>
  122. </figure>
  123. <figure>
  124. <a href="pl/"><img src="Polandball.jpg"></a>
  125. <figcaption>POLSKI</figcaption>
  126. </figure>
  127. </main>
  128. <?php };
  129. break;
  130. default:
  131. echo "Error";
  132. }
  133. ?>
  134. </body>
  135. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement