Advertisement
Guest User

exam

a guest
Aug 6th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.38 KB | None | 0 0
  1. LOGIN
  2. <!DOCTYPE html>
  3. <html>
  4. <Title>Login Page</Title>
  5. <head>
  6. <meta name = "viewport" content = "width=device-with, initial-scale=1.0">
  7. <link rel = "stylesheet" type = "text/css" href = "CSS/Style.css">
  8.  
  9. </head>
  10.  
  11. <body>
  12.  
  13. <form action="log-in.php" id = "Login_Form" method="POST">
  14.  
  15.  
  16. <div class="container">
  17. <label><b>Username</b></label>
  18. <input type="text" placeholder="Enter Username" name="Username" autocomplete="off" required>
  19.  
  20. <label><b>Password</b></label>
  21. <input type="password" placeholder="Enter Password" name="Password" autocomplete="off" required>
  22.  
  23. <button type="submit" form = "Login_Form" >Login</button>
  24.  
  25. </div>
  26.  
  27.  
  28. </form>
  29.  
  30.  
  31.  
  32. </body>
  33. </html>
  34.  
  35.  
  36.  
  37. log-in
  38. <?php
  39. include 'Database/Database.php';
  40. session_start();
  41.  
  42. $Username = $_POST['Username'];
  43. $Password = $_POST['Password'];
  44. echo $Username . " - " .$Password;
  45. $sql = "SELECT Account_ID, Acc_Username, Acc_Password
  46. FROM Account
  47. WHERE Acc_Username = '$Username' AND Acc_Password = '$Password' ";
  48. $result = mysqli_query($conn, $sql);
  49. if(!$result){
  50. echo 'Could not run query: ' . mysqli_error();
  51. $message = "Login error. Please try again. ";
  52. echo "<script type='text/javascript'>
  53. alert('$message');
  54. window.location.href= 'login.php';
  55. </script>";
  56. exit(0);
  57. }
  58. if($result){
  59. $row = mysqli_fetch_assoc($result);
  60. if($row > 0){
  61. echo "Login Success";
  62. } else {
  63. $message = "Invalid username or password. ";
  64. echo "<script type='text/javascript'>
  65. alert('$message');
  66. window.location.href= 'login.php';
  67. </script>";
  68. exit(0);
  69. }
  70. }
  71. ?>
  72.  
  73. <?php
  74. session_start();
  75. header("location:index.php");
  76. ?>
  77.  
  78.  
  79. index
  80. <!DOCTYPE html>
  81.  
  82. <html>
  83. <Title> index </Title>
  84.  
  85. <head>
  86. <link rel = "stylesheet" type = "text/css" href= "css/indexstyle.css">
  87. </head>
  88.  
  89. <body class = "page2body">
  90. <header>
  91. <h1>aa<h1>
  92. </header>
  93.  
  94. <section><h1> </h1><section>
  95.  
  96. <nav><p></p></nav>
  97.  
  98. <article><p></p></article>
  99.  
  100. <aside><p></p></aside>
  101.  
  102. <article></article>
  103.  
  104.  
  105.  
  106. <footer><h1>1111</h1>
  107.  
  108. </footer>
  109.  
  110.  
  111. </body>
  112.  
  113.  
  114. </html>
  115.  
  116.  
  117.  
  118.  
  119. database
  120.  
  121. <?php
  122. $servername = "localhost";
  123. $username = "root";
  124. $password = "";
  125. $dbname = "exam";//Database name
  126.  
  127. // Create connection
  128. $conn = new mysqli($servername, $username, $password,$dbname);
  129.  
  130. // Check connection
  131. try{
  132. if ($conn->connect_error) {
  133. die("Connection failed: " . $conn->connect_error);
  134. }
  135. // echo "Connected successfully </br>";
  136. } catch (Exception $e){
  137. echo "Error connection";
  138.  
  139. }
  140. ?>
  141.  
  142.  
  143.  
  144.  
  145. sql
  146. CREATE TABLE Account (
  147. Account_ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
  148. Acc_Fname VARCHAR (50) NOT NULL,
  149. Acc_Lname VARCHAR (50) NOT NULL,
  150. Acc_MI VARCHAR (50) NOT NULL,
  151. Acc_Username VARCHAR (50) NOT NULL,
  152. Acc_Password VARCHAR (50) NOT NULL
  153. );
  154.  
  155.  
  156.  
  157.  
  158. index
  159. .page2body{
  160. padding-top: 0px;
  161.  
  162. }
  163. *{
  164. box-sizing: border-box;
  165. }
  166.  
  167. header {
  168. height:125px;
  169. padding: 1em 0em 1em 0em;
  170. background-color:#660000;
  171. text-align:center;
  172. font-size: 35px;
  173. color: white;
  174.  
  175. }
  176.  
  177. nav {
  178. float:left;
  179. width:20%;
  180. height: 400px;
  181. background-color: #6bc8ff;
  182. border : 5px solid #9e8fa3;
  183.  
  184.  
  185. }
  186. article{
  187. float: left;
  188. width: 60%;
  189. height: 200px;
  190. background-color:#9933ff;
  191. border: 5px solid #ff6633;
  192.  
  193.  
  194. }
  195. aside {
  196. float: right;
  197. width: 20%;
  198. height: 400px;
  199. background-color: #ccff33;
  200. border: 5px solid #ff0000;
  201.  
  202. }
  203.  
  204. section: after{
  205. content:"";
  206. display:table;
  207. clear:both
  208. background-color: #ff0000;
  209.  
  210.  
  211. }
  212.  
  213. footer{
  214. padding: 2em 2em 2em 2em;
  215. background-color: #6bc8ff;
  216. text-align: center;
  217. height: 125px;
  218.  
  219.  
  220. }
  221.  
  222. @media(max-width: 600px){
  223. nav, article, aside {
  224. width: 100%;
  225.  
  226.  
  227. }
  228.  
  229. }
  230.  
  231.  
  232.  
  233. login style
  234.  
  235. body{
  236. background-color: #6bc8ff;
  237. padding-top: 50px;
  238. text-align: center;
  239. color: #56636b;
  240. }
  241.  
  242. form{
  243. display: inline-block;
  244. padding-top:20px;
  245. width: 300px;
  246. height: 400px;
  247. background-color: #e8f2f2;
  248.  
  249. }
  250.  
  251. input[type=text],
  252. input[type=password]
  253. {
  254. width: 100%;
  255. padding: 12px 20px;
  256. margin: 8px 0;
  257. display: line-block;
  258. border: 1px solid #ccc;
  259. box-sizing: border-box;
  260.  
  261.  
  262. }
  263.  
  264. button{
  265. background-color: #1ea8ff;
  266. padding: 14px 20px;
  267. margin: 8px0;
  268. border: none;
  269. cursor: pointer;
  270. width: 100%;
  271.  
  272.  
  273. }
  274.  
  275. button:hover{
  276. opacity: 0:8;
  277.  
  278.  
  279. }
  280. .container{
  281. padding: 16px;
  282.  
  283. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement