Advertisement
Guest User

Untitled

a guest
May 28th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.92 KB | None | 0 0
  1.  
  2. html{
  3. width: 100%;
  4. height: 100%;
  5. padding: 0;
  6. margin: 0;
  7. }
  8.  
  9. body{
  10. width: 100%;
  11. height: 100%;
  12. padding: 0;
  13. margin: 0;
  14. font-family: 'Roboto',sans-serif;
  15. background-color: #C0C0C0;
  16. }
  17.  
  18.  
  19.  
  20.  
  21.  
  22. .big-box{
  23. border-color: #808080;
  24. width: 28%;
  25. height: 70%;
  26. top: 50%;
  27. left: 50%;
  28. position: absolute;
  29. background-color: white;
  30. transform: translate(-50%,-50%);
  31. box-sizing:border-box;
  32.  
  33. }
  34. h1{
  35. border-left-color: red;
  36. border-left-style: solid;
  37. height: 10%;
  38. color: red;
  39. font-size: 225%;
  40. padding-top: 2.5%;
  41. padding-bottom: 2.5%;
  42. padding-left:10%;
  43. box-sizing:border-box;
  44. margin-top: 15%;
  45.  
  46.  
  47. }
  48. .image1{
  49. width: 30%;
  50. height: 25%;
  51. border-radius: 50%;
  52. position: absolute;
  53. top: 5%;
  54. left: calc(50% + 35%);
  55. overflow: hidden;
  56.  
  57. }
  58. p{
  59. margin-bottom: 0%;
  60. margin-top: 12%;
  61. margin-left: 10%;
  62. width: 80%;
  63. height: 5%;
  64. color: red;
  65. padding-bottom: 3.5%;
  66.  
  67. }
  68.  
  69.  
  70. input:focus{
  71. visibility: visible;
  72. }
  73.  
  74. input{
  75. background:transparent;
  76. padding-top: 3.75%;
  77. padding-bottom: 3.75%;
  78. margin-left:10%;
  79. border-bottom-style: solid;
  80. border-top-style: none;
  81. border-left-style: none;
  82. border-right-style: none;
  83. border-color: #C0C0C0;
  84. width: 80%;
  85. height: 15%;
  86. }
  87. input:focus::-webkit-input-placeholder{
  88. color: white;
  89. }
  90. input:focus{
  91. color: red;
  92. border-color: red;
  93. outline: none;
  94.  
  95.  
  96.  
  97. }
  98. input::placeholder-shown{
  99. color: white;
  100. }
  101. .box{
  102. margin-top: 8%;
  103. color:#C0C0C0;
  104. background-color: white;
  105. border-color: #C0C0C0;
  106. border-style: solid;
  107. height: 22.5%;
  108. width:60%;
  109. margin-left: 20%;
  110. margin-right: 20%;
  111. margin-bottom:7%;
  112.  
  113.  
  114. }
  115. .box:hover{
  116. color:red;
  117. border-color: red;
  118. }
  119. #forgot1{
  120. margin: auto;
  121. box-sizing:border-box;
  122. width: 100%;
  123. text-align: center;
  124. }
  125. #forgot{
  126. height: 15%;
  127. width: 100%;
  128. margin: auto;
  129. text-decoration:none;
  130. padding: 5%;
  131. color: #C0C0C0;
  132. font-size: 1rem;
  133.  
  134.  
  135.  
  136. }
  137. #forgot:hover{
  138. color: red;
  139. }
  140.  
  141. p:focus{
  142. visibility:visible;
  143. }
  144. @media only screen and (max-width:500px) {
  145. /
  146.  
  147.  
  148. }
  149. @media screen and (min-device-width: 0px) and (max-device-width: 799px) {
  150. @media (orientation: portrait){
  151. .big-box {
  152. width: 80%;
  153. height: 67%;
  154. }
  155. #forgot{
  156. padding: 2%;
  157. margin-bottom: 2%;
  158. }
  159. }
  160. @media (orientation: landscape){
  161. .big-box {
  162. margin-top: 2%;
  163. margin-bottom: 1%;
  164. width: 45%;
  165. height: 115%;
  166.  
  167. }
  168. }}
  169.  
  170.  
  171.  
  172. @media screen and (min-width: 750px) {
  173. @media (orientation: portrait){
  174. .big-box {
  175. width: 78%;
  176. height: 72%;
  177. }
  178. }
  179. @media (orientation: landscape){
  180. .big-box {
  181. margin-top: 2%;
  182. margin-bottom: 2%;
  183. width: 45%;
  184. height: 80%;
  185.  
  186. }
  187. }}
  188.  
  189. <?php
  190. session_start();
  191. // inicjowanie sesji
  192. $host = "localhost";
  193. $db_user = "root";
  194. $db_password="";
  195. $db_name = "osadnicy";
  196. $con = @new mysqli($host,$db_user,$db_password, $db_name);
  197. //polaczenie z baza
  198. if(!$con)
  199. //sprawdzenie polaczenia z baza nie spelni sie jezeli true
  200. {
  201. echo "Error";
  202. }
  203. else
  204. {
  205. $uname=$_POST['username'];
  206. $pass=$_POST['password'];
  207. //przypisujemy do zmiennej dane z formularza
  208. echo"you are logged in";
  209. $zap="select * from uzytkownicy where user='$uname' AND pass='$pass'";
  210. //zapytanie do bazy o pobranie i zweryfikowanie loginu i hasla
  211. $wynik = @mysqli_query($con, $zap);
  212. //wykonanie zapytania na polaczeniu con
  213. if($wynik){
  214. $ile_wynikow=mysql_num_rows($wynik);
  215. //sprawdzenie czy uzytkownik jest w bazie
  216. if($ile_wynikow == 1){
  217. //udalo sie zalogowac
  218. $dane=mysql_fetch_assoc($wynik);
  219. //utworzenie tablicy i przypisanie im wartosci assoc bo odczytywane po indexach
  220. $_SESSION['user']=$dane['user'];
  221. //przypisanie danych przez sesje
  222. @mysql_free_result($wynik);
  223. //pozbywanie sie niepotrzebnych danych
  224. header('Location: mojekonto.php');
  225. }
  226. else{
  227. //nie udalo sie zalogowac
  228. $_SESSION['ERROR'] ='<span style="color:red"&gt;Wrong Username or Password</span&gt';
  229.  
  230.  
  231. }
  232. }
  233. mysqli_free_result($wynik);
  234. //wyczyszczenie ramu serwera z aktualnych wynikow
  235. mysqli_close($con);
  236. //zamkniecie polaczenia
  237. }
  238. ?>
  239. <!DOCTYPE html>
  240. <html lang="pl_PL">
  241. <head>
  242. <meta charset="utf-8">
  243. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  244. <link rel="Stylesheet" type="text/css" href="style.css" />
  245. </head>
  246. <body>
  247.  
  248.  
  249. <div id="bigbox" class="big-box">
  250. <a href="">
  251. <img src="image1.png" class="image1">
  252. </a>
  253. <h1>Login</h1>
  254. <form action="login.php" method="post">
  255. <p id="f1">Username</p>
  256. <input type="text" name="username" id="username" class="input" placeholder="Username">
  257. <p id="f2">Password</p>
  258. <input type="password" name="password" class="input" id="password" placeholder="Password">
  259. <input type="submit" class="box" value="GO"><br>
  260.  
  261. </form>
  262. <?php
  263. if(isset($_SESSION['ERROR']))
  264. echo $_SESSION['ERROR'];
  265. //error logowania
  266. ?>
  267. <div id="forgot1">
  268. <a id="forgot" href="">Forgot your password?</a>
  269. </div>
  270.  
  271.  
  272.  
  273.  
  274. </div>
  275.  
  276.  
  277.  
  278. </body>
  279. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement