-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
154 lines (150 loc) · 5.89 KB
/
index.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<!DOCTYPE html>
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=ABeeZee|Open+Sans" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<title>Save-A-Grade</title>
<style>
body{
background-color:#382e2e;
}
svg{
margin-left:40%;
margin-right:40%;
}
#top{
background-color:#382e2e;
position: fixed;
top:0px;
left:0px;
right:0px;
height: 55px;
text-align: right;
z-index:-1;
font-size: 12pt;
}
#logo{
margin-top:-10px;
}
text, .title{
font-family: 'Open Sans', sans-serif;
font-size: 12pt;
}
.Aplus{
font-size: 17pt;
}
.center{
margin-top:150px;
margin-left:40%;
margin-right:40%;
text-align:center;
border-radius: 10px;
width:20%;
padding:10px;
background-color:white;
color:#ff4949;
font-family: 'Open Sans', sans-serif;
}
form{
color:black;
}
input{
margin:5px;
}
.title:hover{
text-decoration:underline;
text-decoration-color:#ff4949;
cursor: pointer;
}
.descrip{
color:black;
font-size:18px;
}
#login{
border-right-color:#ff4949;
border-right-style:solid;
}
.error{
font-size:18px;
color:#ff4949;
text-align:center;
}
</style>
</head>
<body>
<div id = "top">
<div id = "logo" class = "container"><?php include "logo/logo.php" ?></div>
</div>
<div id = "mainbody">
<?php
session_start();
$conn = new PDO("mysql:host=localhost;dbname=hacknyu", "root", "");
$error = "";
if(isset($_SESSION["text"])){
$error = "<div class = 'error'>".$_SESSION['text']."</div>";
unset($_SESSION["text"]);
}
if (!isset($_SESSION["email"])) {
echo "
<div class = 'container center'>
<div class = 'row'>
<div id = 'login' class = 'title col-md-6'>Login</div>
<div id = 'register' class = 'title col-md-6'>Register</div>
</div>
<br />
<span class = 'descrip formlog'>Log in</span>
<br class = 'formlog'/><br class = 'formlog'/>
<form class = 'formlog' action='include/logIn.php' method='POST'>
<input name='email' type='text' placeholder='Email'> <br>
<input name='password' type='password' placeholder='Password'> <br><br>
<input type='submit'>
</form>
<span class = 'descrip formreg'>Register</span>
<br class = 'formreg'/><br class = 'formreg'/>
<form class = 'formreg' action='include/register.php' method='POST'>
<input name = 'FName' placeholder = 'First Name' type = 'text' /> <br>
<input name = 'LName' placeholder = 'Last Name' type = 'text' /> <br>
<input name = 'email' placeholder = 'Email' type = 'text' /> <br>
<input name = 'password' type= 'password' placeholder = 'Password'/> <br>
<input name = 'IsStudent' value = 1 checked = 'checked' type = 'radio'> Student
<input name = 'IsStudent' value = 0 type = 'radio'> Professor <br><br>
<input type='submit'>
</form>
".$error."</div>";
}
else {
header("Location: include/myclasses.php");
}
?>
</div>
<script>
// getting the divs for login and register to see which is active
$(document).ready(function() {
<?php
if(isset($_GET["error"])){
echo"$('.formlog').hide();
$('.formreg').show();";
}
else
echo "$('.formreg').hide();";// by default, want to log in
?>
// when logging in, hide register form
$("#login").click(function() {
$(".formlog").show();
$(".formreg").hide();
$(".error").hide();
});
// when registering, hide login form
$("#register").click(function() {
$(".formlog").hide();
$(".formreg").show();
$(".error").hide();
})
});
</script>
</body>
</html>