MBED HTTP client with web pages for server

Dependencies:   DS1820

Fork of J_HTTP_Client by Jan Kamidra

ForServer/login_page.php

Committer:
JohnnyK
Date:
2018-05-23
Revision:
1:920482bc63f4
Parent:
0:d90e1f7bda1f

File content as of revision 1:920482bc63f4:

<?php
	session_start();

	$server = "sql.someweb.com";	// Here you place your MySQL server address
	$user = "johnybravo";			// Here you place your user name of your MySQL
	$pass = "bravo";				// Here you place your password of your MySQL
	$db = "dtb";					// Here you place your name of your DTB
	

	$mysql = mysql_connect($server, $user, $pass); //Join to MySQL
	mysql_select_db($db);

	if(isset( $_POST["submit"]))
	{
		$uname = $_POST["username"];
		$upass = $_POST["password"];	
		$u_name = mysql_fetch_array(mysql_query('SELECT u_name FROM users WHERE u_name="'.$uname.'" AND u_password="'.$upass.'" '));
		$u_pass = mysql_fetch_array(mysql_query('SELECT u_password FROM users WHERE u_name="'.$uname.'" AND u_password="'.$upass.'" '));

		if($uname != $u_name['u_name'] and $upass != $u_pass['u_password'])
		{
			$messge = "Invalid Login!";
		}
		else
		{
            $_SESSION["uname"] = $uname;
			header('Location: control.php');
		}
	}
?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset= "utf-8">
		<title>Login</title>
		<style>
			body
			{
				margin: 0;
				padding: 0;
				font-family: sans-serif;
				/*background: url(bg.jpg);*/
				background-size: cover;
			}
			.box
			{
				position: absolute;
				top: 50%;
				left: 50%;
				transform: translate(-50%,-50%);
				width: 400px;
				padding: 40px;
				background: rgba(0,0,0,.8);
				box-sizing:border-box;
				box-shadow: 0 15px 25px rgba(0,0,0,.5);
				border-radius: 10px;
			}
			.box h2
			{
				margin: 0 0 30px;
				padding: 0;
				color: #fff;
				text-align: center;
			}
			.box .mess h3
			{
				margin: 0 0 20px;
				padding: 0;
				color: #03a9f4;
				text-align: center;
			}
			.box inputBox
			{
				position: relative;
			}
			.box .inputBox input
			{
				width: 100%;
				padding: 10px 0;
				font-size: 16px;
				color: #fff;
				letter-spacing: 1px;
				margin-bottom: 30px;
				border: none;
				border-bottom: 1px solid #fff;
				outline: none;
				background: transparent;
			}
			.box .inputBox label
			{
				padding: 10px 0;
				font-size:16px;
				color: #fff;
				pointer-events: none;
			}

			.box input[type="submit"]
			{
				background: transparent;
				border: none;
				outline: none;
				color: #fff;
				background: #03a9f4;
				padding: 10px 30px;
				cursor: pointer;
				border-radius: 5px;
			}
			.box input[type="submit"]:hover
			{
				cursor: pointer;
				background: #92b6d5;
				color: #fff;
			}
		</style>
	</head>
	<body>
		<div class="box">
			<h2>Login</h2>
			<form  method="POST" action="#">
				<div class= "mess">
					<h3><?php if(isset($messge)) { echo $messge; } ?></h3>
				</div>
				<div class= "inputBox">
					<label for="username">Username</label>				
					<input type="text" name="username" placeholder="Enter your User name" required="">
				</div>
				<div class= "inputBox">
					<label for="password">Password</label>				
					<input type="password" name="password" placeholder="Enter your Password" required="">
				</div>
				<input type="submit" name="submit" value="submit">
			</form>
		</div>
	</body>
</html>