-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
58 lines (56 loc) · 1.53 KB
/
login.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
session_start();
if(isset($_SESSION["logged"])){
header("Location: already_logged_in.php");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Login</title>
<link rel="stylesheet" type="text/css" href="navbar.css" />
<link rel="stylesheet" type="text/css" href="login.css" />
</head>
<body>
<nav>
<ul class="navigation">
<?php
if(isset($_SESSION["logged"])){
echo '<li><a href="choice.php">Home</a></li>';
}
else{
echo '<li><a href="home.php">Home</a></li>';
}
?>
<li><a href="contact.php">Contact</a></li>
<li><a href="about.php">About</a></li>
<li><a class="active" href="login.php">Login</a></li>
<li><a href="signup.php">Signup</a></li>
<?php
if(isset($_SESSION["logged"])){
echo '<li><a href="logout.php">Logout</a></li>';
}
?>
</ul>
</nav>
<section id="loginform">
<form id="myForm" method="post" action="connect.php" onsubmit="return myFunction()">
<input type="text" id="name" name="email" placeholder="E-mail" ><br>
<input type="password" id="surname" name="password" placeholder="Password" ><br>
<input type="submit" id="sub" value="Submit" >
<p class="message">Not registered? <a href="signup.php">Create an account</a></p>
</form>
</section>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myForm");
if(x.elements[0].value!=""&&x.elements[1].value!="") {return true;}
else{
document.getElementById("demo").innerHTML="All boxes must be filled";
return false;
}
}
</script>
</body>
</html>