MBED HTTP client with web pages for server

Dependencies:   DS1820

Fork of J_HTTP_Client by Jan Kamidra

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers login_page.php Source File

login_page.php

00001 <?php
00002     session_start();
00003 
00004     $server = "sql.someweb.com";    // Here you place your MySQL server address
00005     $user = "johnybravo";           // Here you place your user name of your MySQL
00006     $pass = "bravo";                // Here you place your password of your MySQL
00007     $db = "dtb";                    // Here you place your name of your DTB
00008     
00009 
00010     $mysql = mysql_connect($server, $user, $pass); //Join to MySQL
00011     mysql_select_db($db);
00012 
00013     if(isset( $_POST["submit"]))
00014     {
00015         $uname = $_POST["username"];
00016         $upass = $_POST["password"];    
00017         $u_name = mysql_fetch_array(mysql_query('SELECT u_name FROM users WHERE u_name="'.$uname.'" AND u_password="'.$upass.'" '));
00018         $u_pass = mysql_fetch_array(mysql_query('SELECT u_password FROM users WHERE u_name="'.$uname.'" AND u_password="'.$upass.'" '));
00019 
00020         if($uname != $u_name['u_name'] and $upass != $u_pass['u_password'])
00021         {
00022             $messge = "Invalid Login!";
00023         }
00024         else
00025         {
00026             $_SESSION["uname"] = $uname;
00027             header('Location: control.php');
00028         }
00029     }
00030 ?>
00031 <!DOCTYPE html>
00032 <html>
00033     <head>
00034         <meta charset= "utf-8">
00035         <title>Login</title>
00036         <style>
00037             body
00038             {
00039                 margin: 0;
00040                 padding: 0;
00041                 font-family: sans-serif;
00042                 /*background: url(bg.jpg);*/
00043                 background-size: cover;
00044             }
00045             .box
00046             {
00047                 position: absolute;
00048                 top: 50%;
00049                 left: 50%;
00050                 transform: translate(-50%,-50%);
00051                 width: 400px;
00052                 padding: 40px;
00053                 background: rgba(0,0,0,.8);
00054                 box-sizing:border-box;
00055                 box-shadow: 0 15px 25px rgba(0,0,0,.5);
00056                 border-radius: 10px;
00057             }
00058             .box h2
00059             {
00060                 margin: 0 0 30px;
00061                 padding: 0;
00062                 color: #fff;
00063                 text-align: center;
00064             }
00065             .box .mess h3
00066             {
00067                 margin: 0 0 20px;
00068                 padding: 0;
00069                 color: #03a9f4;
00070                 text-align: center;
00071             }
00072             .box inputBox
00073             {
00074                 position: relative;
00075             }
00076             .box .inputBox input
00077             {
00078                 width: 100%;
00079                 padding: 10px 0;
00080                 font-size: 16px;
00081                 color: #fff;
00082                 letter-spacing: 1px;
00083                 margin-bottom: 30px;
00084                 border: none;
00085                 border-bottom: 1px solid #fff;
00086                 outline: none;
00087                 background: transparent;
00088             }
00089             .box .inputBox label
00090             {
00091                 padding: 10px 0;
00092                 font-size:16px;
00093                 color: #fff;
00094                 pointer-events: none;
00095             }
00096 
00097             .box input[type="submit"]
00098             {
00099                 background: transparent;
00100                 border: none;
00101                 outline: none;
00102                 color: #fff;
00103                 background: #03a9f4;
00104                 padding: 10px 30px;
00105                 cursor: pointer;
00106                 border-radius: 5px;
00107             }
00108             .box input[type="submit"]:hover
00109             {
00110                 cursor: pointer;
00111                 background: #92b6d5;
00112                 color: #fff;
00113             }
00114         </style>
00115     </head>
00116     <body>
00117         <div class="box">
00118             <h2>Login</h2>
00119             <form  method="POST" action="#">
00120                 <div class= "mess">
00121                     <h3><?php if(isset($messge)) { echo $messge; } ?></h3>
00122                 </div>
00123                 <div class= "inputBox">
00124                     <label for="username">Username</label>              
00125                     <input type="text" name="username" placeholder="Enter your User name" required="">
00126                 </div>
00127                 <div class= "inputBox">
00128                     <label for="password">Password</label>              
00129                     <input type="password" name="password" placeholder="Enter your Password" required="">
00130                 </div>
00131                 <input type="submit" name="submit" value="submit">
00132             </form>
00133         </div>
00134     </body>
00135 </html>