MBED HTTP client with web pages for server

Dependencies:   DS1820

Fork of J_HTTP_Client by Jan Kamidra

Committer:
JohnnyK
Date:
Wed May 23 06:47:56 2018 +0000
Revision:
1:920482bc63f4
Parent:
0:d90e1f7bda1f
Repair

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JohnnyK 0:d90e1f7bda1f 1 <?php
JohnnyK 0:d90e1f7bda1f 2 session_start();
JohnnyK 0:d90e1f7bda1f 3
JohnnyK 1:920482bc63f4 4 $server = "sql.someweb.com"; // Here you place your MySQL server address
JohnnyK 1:920482bc63f4 5 $user = "johnybravo"; // Here you place your user name of your MySQL
JohnnyK 1:920482bc63f4 6 $pass = "bravo"; // Here you place your password of your MySQL
JohnnyK 1:920482bc63f4 7 $db = "dtb"; // Here you place your name of your DTB
JohnnyK 0:d90e1f7bda1f 8
JohnnyK 0:d90e1f7bda1f 9
JohnnyK 0:d90e1f7bda1f 10 $mysql = mysql_connect($server, $user, $pass); //Join to MySQL
JohnnyK 0:d90e1f7bda1f 11 mysql_select_db($db);
JohnnyK 0:d90e1f7bda1f 12
JohnnyK 0:d90e1f7bda1f 13 if(isset( $_POST["submit"]))
JohnnyK 0:d90e1f7bda1f 14 {
JohnnyK 0:d90e1f7bda1f 15 $uname = $_POST["username"];
JohnnyK 0:d90e1f7bda1f 16 $upass = $_POST["password"];
JohnnyK 0:d90e1f7bda1f 17 $u_name = mysql_fetch_array(mysql_query('SELECT u_name FROM users WHERE u_name="'.$uname.'" AND u_password="'.$upass.'" '));
JohnnyK 0:d90e1f7bda1f 18 $u_pass = mysql_fetch_array(mysql_query('SELECT u_password FROM users WHERE u_name="'.$uname.'" AND u_password="'.$upass.'" '));
JohnnyK 0:d90e1f7bda1f 19
JohnnyK 0:d90e1f7bda1f 20 if($uname != $u_name['u_name'] and $upass != $u_pass['u_password'])
JohnnyK 0:d90e1f7bda1f 21 {
JohnnyK 0:d90e1f7bda1f 22 $messge = "Invalid Login!";
JohnnyK 0:d90e1f7bda1f 23 }
JohnnyK 0:d90e1f7bda1f 24 else
JohnnyK 0:d90e1f7bda1f 25 {
JohnnyK 0:d90e1f7bda1f 26 $_SESSION["uname"] = $uname;
JohnnyK 0:d90e1f7bda1f 27 header('Location: control.php');
JohnnyK 0:d90e1f7bda1f 28 }
JohnnyK 0:d90e1f7bda1f 29 }
JohnnyK 0:d90e1f7bda1f 30 ?>
JohnnyK 0:d90e1f7bda1f 31 <!DOCTYPE html>
JohnnyK 0:d90e1f7bda1f 32 <html>
JohnnyK 0:d90e1f7bda1f 33 <head>
JohnnyK 0:d90e1f7bda1f 34 <meta charset= "utf-8">
JohnnyK 0:d90e1f7bda1f 35 <title>Login</title>
JohnnyK 0:d90e1f7bda1f 36 <style>
JohnnyK 0:d90e1f7bda1f 37 body
JohnnyK 0:d90e1f7bda1f 38 {
JohnnyK 0:d90e1f7bda1f 39 margin: 0;
JohnnyK 0:d90e1f7bda1f 40 padding: 0;
JohnnyK 0:d90e1f7bda1f 41 font-family: sans-serif;
JohnnyK 0:d90e1f7bda1f 42 /*background: url(bg.jpg);*/
JohnnyK 0:d90e1f7bda1f 43 background-size: cover;
JohnnyK 0:d90e1f7bda1f 44 }
JohnnyK 0:d90e1f7bda1f 45 .box
JohnnyK 0:d90e1f7bda1f 46 {
JohnnyK 0:d90e1f7bda1f 47 position: absolute;
JohnnyK 0:d90e1f7bda1f 48 top: 50%;
JohnnyK 0:d90e1f7bda1f 49 left: 50%;
JohnnyK 0:d90e1f7bda1f 50 transform: translate(-50%,-50%);
JohnnyK 0:d90e1f7bda1f 51 width: 400px;
JohnnyK 0:d90e1f7bda1f 52 padding: 40px;
JohnnyK 0:d90e1f7bda1f 53 background: rgba(0,0,0,.8);
JohnnyK 0:d90e1f7bda1f 54 box-sizing:border-box;
JohnnyK 0:d90e1f7bda1f 55 box-shadow: 0 15px 25px rgba(0,0,0,.5);
JohnnyK 0:d90e1f7bda1f 56 border-radius: 10px;
JohnnyK 0:d90e1f7bda1f 57 }
JohnnyK 0:d90e1f7bda1f 58 .box h2
JohnnyK 0:d90e1f7bda1f 59 {
JohnnyK 0:d90e1f7bda1f 60 margin: 0 0 30px;
JohnnyK 0:d90e1f7bda1f 61 padding: 0;
JohnnyK 0:d90e1f7bda1f 62 color: #fff;
JohnnyK 0:d90e1f7bda1f 63 text-align: center;
JohnnyK 0:d90e1f7bda1f 64 }
JohnnyK 0:d90e1f7bda1f 65 .box .mess h3
JohnnyK 0:d90e1f7bda1f 66 {
JohnnyK 0:d90e1f7bda1f 67 margin: 0 0 20px;
JohnnyK 0:d90e1f7bda1f 68 padding: 0;
JohnnyK 0:d90e1f7bda1f 69 color: #03a9f4;
JohnnyK 0:d90e1f7bda1f 70 text-align: center;
JohnnyK 0:d90e1f7bda1f 71 }
JohnnyK 0:d90e1f7bda1f 72 .box inputBox
JohnnyK 0:d90e1f7bda1f 73 {
JohnnyK 0:d90e1f7bda1f 74 position: relative;
JohnnyK 0:d90e1f7bda1f 75 }
JohnnyK 0:d90e1f7bda1f 76 .box .inputBox input
JohnnyK 0:d90e1f7bda1f 77 {
JohnnyK 0:d90e1f7bda1f 78 width: 100%;
JohnnyK 0:d90e1f7bda1f 79 padding: 10px 0;
JohnnyK 0:d90e1f7bda1f 80 font-size: 16px;
JohnnyK 0:d90e1f7bda1f 81 color: #fff;
JohnnyK 0:d90e1f7bda1f 82 letter-spacing: 1px;
JohnnyK 0:d90e1f7bda1f 83 margin-bottom: 30px;
JohnnyK 0:d90e1f7bda1f 84 border: none;
JohnnyK 0:d90e1f7bda1f 85 border-bottom: 1px solid #fff;
JohnnyK 0:d90e1f7bda1f 86 outline: none;
JohnnyK 0:d90e1f7bda1f 87 background: transparent;
JohnnyK 0:d90e1f7bda1f 88 }
JohnnyK 0:d90e1f7bda1f 89 .box .inputBox label
JohnnyK 0:d90e1f7bda1f 90 {
JohnnyK 0:d90e1f7bda1f 91 padding: 10px 0;
JohnnyK 0:d90e1f7bda1f 92 font-size:16px;
JohnnyK 0:d90e1f7bda1f 93 color: #fff;
JohnnyK 0:d90e1f7bda1f 94 pointer-events: none;
JohnnyK 0:d90e1f7bda1f 95 }
JohnnyK 0:d90e1f7bda1f 96
JohnnyK 0:d90e1f7bda1f 97 .box input[type="submit"]
JohnnyK 0:d90e1f7bda1f 98 {
JohnnyK 0:d90e1f7bda1f 99 background: transparent;
JohnnyK 0:d90e1f7bda1f 100 border: none;
JohnnyK 0:d90e1f7bda1f 101 outline: none;
JohnnyK 0:d90e1f7bda1f 102 color: #fff;
JohnnyK 0:d90e1f7bda1f 103 background: #03a9f4;
JohnnyK 0:d90e1f7bda1f 104 padding: 10px 30px;
JohnnyK 0:d90e1f7bda1f 105 cursor: pointer;
JohnnyK 0:d90e1f7bda1f 106 border-radius: 5px;
JohnnyK 0:d90e1f7bda1f 107 }
JohnnyK 0:d90e1f7bda1f 108 .box input[type="submit"]:hover
JohnnyK 0:d90e1f7bda1f 109 {
JohnnyK 0:d90e1f7bda1f 110 cursor: pointer;
JohnnyK 0:d90e1f7bda1f 111 background: #92b6d5;
JohnnyK 0:d90e1f7bda1f 112 color: #fff;
JohnnyK 0:d90e1f7bda1f 113 }
JohnnyK 0:d90e1f7bda1f 114 </style>
JohnnyK 0:d90e1f7bda1f 115 </head>
JohnnyK 0:d90e1f7bda1f 116 <body>
JohnnyK 0:d90e1f7bda1f 117 <div class="box">
JohnnyK 0:d90e1f7bda1f 118 <h2>Login</h2>
JohnnyK 0:d90e1f7bda1f 119 <form method="POST" action="#">
JohnnyK 0:d90e1f7bda1f 120 <div class= "mess">
JohnnyK 0:d90e1f7bda1f 121 <h3><?php if(isset($messge)) { echo $messge; } ?></h3>
JohnnyK 0:d90e1f7bda1f 122 </div>
JohnnyK 0:d90e1f7bda1f 123 <div class= "inputBox">
JohnnyK 0:d90e1f7bda1f 124 <label for="username">Username</label>
JohnnyK 0:d90e1f7bda1f 125 <input type="text" name="username" placeholder="Enter your User name" required="">
JohnnyK 0:d90e1f7bda1f 126 </div>
JohnnyK 0:d90e1f7bda1f 127 <div class= "inputBox">
JohnnyK 0:d90e1f7bda1f 128 <label for="password">Password</label>
JohnnyK 0:d90e1f7bda1f 129 <input type="password" name="password" placeholder="Enter your Password" required="">
JohnnyK 0:d90e1f7bda1f 130 </div>
JohnnyK 0:d90e1f7bda1f 131 <input type="submit" name="submit" value="submit">
JohnnyK 0:d90e1f7bda1f 132 </form>
JohnnyK 0:d90e1f7bda1f 133 </div>
JohnnyK 0:d90e1f7bda1f 134 </body>
JohnnyK 0:d90e1f7bda1f 135 </html>