Commit ee2547e7 by zekena

touches

parent afb01805
@import url('https://fonts.googleapis.com/css?family=Dosis|Passion+One|Roboto+Slab');
* { * {
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
...@@ -92,13 +93,14 @@ ...@@ -92,13 +93,14 @@
} }
#login form input[type=text], input[type=password]{ #login form input[type=text], input[type=password]{
background-color: #25405f; background-color: #a6b2d085;
border-radius: 60px 60px 60px 60px;
color: #30363b; color: #30363b;
margin-bottom: 1em; margin-bottom: 1em;
padding: 25px; padding: 25px;
width: 225px; width: 280px;
margin-left: 25px; border-block: radius:3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
} }
input[type=button] { input[type=button] {
...@@ -109,16 +111,20 @@ ...@@ -109,16 +111,20 @@
color: rgb(234, 182, 182); color: rgb(234, 182, 182);
font-weight: bold; font-weight: bold;
margin-bottom: 2em; margin-bottom: 2em;
width: 280px; width: 280px;
font-family: 'Dosis',serif;
} }
#login form input[type="submit"]:hover { input[type=button]:hover {
background-color: #be3636; background-color: #a6b2d085;
opacity: 0.7; opacity: 0.7;
color: #100f0f; color: #100f0f;
font-family: 'Passion one',cursive;
font-size:30px;
} }
#login form input[type=text], input[type=password]{
outline: none;
box-shadow: 0.2rem 0.8rem 1.6rem var(--colorPrimary600)}
#login > p { #login > p {
text-align: center; text-align: center;
} }
...@@ -126,4 +132,6 @@ ...@@ -126,4 +132,6 @@
#login > p span { #login > p span {
padding-left: 5px; padding-left: 5px;
} }
#login form input[type=text]:focus::placeholder-shown, input[type=password]:focus::placeholder-shown {
\ No newline at end of file color: transparent;
}
<?php
$from_value = $_POST['from_value'];
$from_unit = $_POST['from_unit'];
$to_unit = $_POST['to_unit'];
if (is_numeric(($from_unit))){
echo "Must be a digit";
};
?>
<?php
//connection variables
define('DB_NAME','loginsystem');
define('DB_USER', 'root');
define('DB_PASSWORD','root');
define('DB_HOST','localhost');
$link = new mysqli(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME) or die("Error " . mysqli_error($link));
/*
if(mysqli_connect_error()){
die('Connect Error ('. mysqli_connect_errno().')'.mysqli_connect_error());
}
*/
?>
\ No newline at end of file
<?php
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Signup</title>
<link rel="stylesheet" href="../css/login_style.css" media="screen" type="text/css" />
</head>
<body>
<html lang="en-US">
<head>
<meta charset="utf-8">
<title>Login</title>
</head>
<body>
<div class="container">
<div id="login">
<form action="" method="get">
<fieldset class="clearfix">
<p><input type="text" name="sign_username" placeholder="Username"></p>
<p><input type="password" name="sign_password" placeholder="Password"></p>
<p><input type="submit" name="submit" placeholder="Submit"></p>
</fieldset>
</form>
</div>
</div>
</body>
</html>
</body>
</html>
\ No newline at end of file
<?php <?php
require('db.php'); require('db.php');
function protect($string){ function protect($string)
{
$string = mysql_real_escape_string(trim(strip_tags(addslashes($string)))); $string = mysql_real_escape_string(trim(strip_tags(addslashes($string))));
return $string; return $string;
} }
session_start(); session_start();
if (isset($_SESSION['loggedIN'])){ if (isset($_SESSION['loggedIN'])) {
header('Location: ../home.php'); header('Location: ../home.php');
exit(); exit();
} }
if (isset($_POST['login'])){ if (isset($_POST['login'])) {
$username = $link->real_escape_string($_POST['usernamePHP']); $username = $link->real_escape_string($_POST['usernamePHP']);
$email = $link->real_escape_string($_POST['emailPHP']); $email = $link->real_escape_string($_POST['emailPHP']);
$password = $link->real_escape_string($_POST['passwordPHP']); $password = $link->real_escape_string($_POST['passwordPHP']);
$data = $link->query("SELECT id FROM users WHERE username='$username' AND email='$email' AND password='$password'"); $data = $link->query("SELECT id FROM users WHERE username='$username' AND email='$email' AND password='$password'");
if ($data->num_rows > 0){ if ($data->num_rows > 0) {
$_SESSION['loggedIN'] = '1'; $_SESSION['loggedIN'] = '1';
$_SESSION['username'] = $username; $_SESSION['username'] = $username;
$_SESSION['email']= $email; $_SESSION['email'] = $email;
$_SESSION['password']= $password; $_SESSION['password'] = $password;
exit('Success..'); exit('Success..');
} else {
} else{ exit('failed');
exit('failed');
}
} }
}
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
...@@ -36,65 +36,62 @@ function protect($string){ ...@@ -36,65 +36,62 @@ function protect($string){
<title>Login</title> <title>Login</title>
<link rel="stylesheet" href="../css/login_style.css" media="screen" type="text/css" /> <link rel="stylesheet" href="../css/login_style.css" media="screen" type="text/css" />
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<div id="login">
<form action="login.php" method="POST" >
<p><input type="text" id="username" name="username" placeholder="Username"></p>
<p><input type="text" id="email" name="email" placeholder="Email"></p>
<p><input type="password" id="password" name="password" placeholder="Password"></p>
<p><input type="button" name="submit" value="Sign in" id="login"></p>
<p><a href="signup.php">SIGN UP NOW</a></p>
<p><button id="continue">Continue without Logging in</button></p>
</form>
<p id="response"></p>
</div>
<div id="login">
<form action="login.php" method="POST">
<p><input type="text" id="username" name="username" placeholder="Username"></p>
<p><input type="text" id="email" name="email" placeholder="Email"></p>
<p><input type="password" id="password" name="password" placeholder="Password"></p>
<p><input type="button" name="submit" value="Sign in" id="login"></p>
<p><button id="continue">Continue without Logging in</button></p>
</form>
<p id="response"></p>
</div> </div>
</div>
<script src="../js/jquery.js"></script> <script src="../js/jquery.js"></script>
<script type="text/javascript"> <script type="text/javascript">
// document.getElementById("continue").onclick = function () { // document.getElementById("continue").onclick = function () {
// }; // };
$(document).ready(function(){ $(document).ready(function() {
$("#continue").on('click',function(){ $("#continue").on('click', function() {
window.location="../home.php"; window.location = "../home.php";
}); });
$("#login").on('click',function(){ $("#login").on('click', function() {
var username = $("#username").val(); var username = $("#username").val();
var email = $("#email").val(); var email = $("#email").val();
var password = $("#password").val(); var password = $("#password").val();
if (email.length == 0 || password.length == 0 || username.length == 0) if (email.length == 0 || password.length == 0 || username.length == 0)
alert('Please check input'); alert('Please check input');
else{ else {
$.ajax( $.ajax({
{ url: 'login.php',
url: 'login.php', method: 'POST',
method: 'POST', data: {
data: { login: 1,
login: 1, emailPHP: email,
emailPHP : email, usernamePHP: username,
usernamePHP : username, passwordPHP: password
passwordPHP : password },
}, success: function(response) {
success: function (response) { $("#response").html(response);
$("#response").html(response); if (response.indexOf('success') > -1) {
if(response.indexOf('success')> -1){ window.location = '../home.php';
window.location = '../home.php'; }
} },
}, dataType: 'text'
dataType: 'text' });
}
);
} }
}); });
}); });
</script> </script>
</body> </body>
</html>
</html>
\ No newline at end of file
<?php
session_start();
unset($_SESSION['loggedIN']);
session_destroy();
header('Location: login.php');
exit();
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment