-
Notifications
You must be signed in to change notification settings - Fork 0
/
loginPage.php
executable file
·159 lines (149 loc) · 5.42 KB
/
loginPage.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
155
156
157
158
159
<?php
session_start();
include("groupFunction.php");
include("main_ics_processer.php");
include("databaseconnection.php");
if(!isset($_SESSION['username'])){header('Location: index.php');}
$username=$_SESSION['username'];
$_SESSION['fullName']=gettingNameFromUsername($_SESSION['username']);
?>
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="main.js"></script>
<title>Cleeque | Dashboard</title>
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">
<meta name="theme-color" content="#ffffff">
<link type="text/css" rel="stylesheet" href="style.css"></link>
<!---Fonts-->
<link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Roboto:300' rel='stylesheet' type='text/css'>
</head>
<body>
<style>/* FOR LoginPage PAGE*/
input.newgroup[type=text], select {
width: 20%;
padding: 6px 10px;
margin-right: 8px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
font-family: "Roboto";
font-size: 15px;
}
input.newgroupsubmit[type=submit] {
width: 20%;
background-color: #3498db;
color: white;
padding: 6px 10px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
font-family: "Roboto";
font-size: 15px;
}
input.newgroupsubmit[type=submit]:hover {
background-color: #2b3856;
transition: 0.2s;
color: white;
}
</style>
<div class="modal">
<div class="modal-content">
<div class="modalHeader">
<span class="close"> X </span>
<p id="modalCleeque">CLEEQUE</p>
</div>
<div class="modalBody">
<form method="post">
<input type="text" id="username" placeholder="Username"><br><br>
<input type="password" id="password" placeholder="Password"><br>
<p id="errorMessage" style="color:red"></p>
<input type="submit" name="submit" value="Sign In" id="loginButton">
</form>
<br id="account"> Don't have an account? <a href="signup.php" id="modalSignup">Sign up!</a>
</div>
</div>
</div>
<div class="navbar">
<img id="logo" src="http://i.imgur.com/NXXGa4e.png" height="35" width="35" style="float: left; margin-top: 6.4px;"><p id= "cleeque" style="margin-top:0px;" > CLEEQUE</p>
<div class="menu" style="float:right;">
<div class="mainMenu">
<p><a href="index.php">Home</a></p>
<p><a href="about.php">About</a></p>
</div>
<a id="usernameNav" style="text-decoration:none;" href="logout.php">Log Out</a>
<p id="responsiveNavButton"> ☰ Menu</p>
</div>
</div>
<div class="main">
<div class="mainHeaderdashboard">
<h1 id="welcomeHeader"><?php echo $_SESSION['username'];?></h1>
<h6 id="welcomeHeaderFullName"><?php echo $_SESSION['fullName'];?></h6>
</div>
<div class="uploadFile">
<p id="fileDownloadHelp">Get your iCalendar file from <a href="https://nusmods.com" target="_blank" style="text-decoration: none">NUSMods</a></p>
<p style="color: white;font-family: 'Montserrat'; margin-top:0;font-size:17px;display: block; text-align: center; margin-bottom: 33px">Just refer to the picture below for help!</p>
<img src="http://i.imgur.com/rYzz7eb.jpg"></img>
<p id="uploadFileHeader">Then, upload your iCalendar file (.ics) below!</p>
<form id="uploadForm" method="POST" action="upload2.php" enctype="multipart/form-data">
<input type="file" class="uploadBox" id="uploadBox" name="fileToUpload" style="display:none" />
<label for='uploadBox' id="chooseFileButton"><strong>Choose a file to upload</strong></label>
<button id="uploadButton" type="submit" style="display:none">Upload</button>
</form>
</div>
<div class="uploadButton">
</div>
<div class="timetable">
<p>Your Timetable</p>
<div class="showingTable">
<?php
$username=$_SESSION['username'];
$sql= "SELECT filename FROM userid WHERE username='$username' ";
$stmt = $database->prepare($sql);
$stmt->execute();
$result= $stmt->fetchColumn();
if(count($result)==1){
$result = unserialize($result);
printTableArray($result,1);
} else {
echo "<p id='noTimetableError'>Please upload the timetable above!</p>";
}
?>
</div>
<a id="editTimetableButton" href="showedited2.php" style="float: center;">Edit timetable</a>
</div>
<div class="showingGroup">
<p>Groups</p>
<?php
listingAllGroups($_SESSION['username']);
?>
</div>
<div class="newgroup">
<form action="<?php $_SERVER['PHP_SELF'];?>" method="POST">
<p id="newGroupInput"> New Group Name: </p><input class="newgroup" type="text" name="groupName" placeholder="Group Name" />
<input class= "newgroupsubmit" type="submit" name="submit" value="Create a new group">
</form>
<?php
if(!isset($_POST['groupName'])){
exit();
} else {
if($_POST['groupName']==''){
echo "No name is input";
} else {
$usernameSession=$_SESSION['username'];
$groupName=$_POST['groupName'];
creatingGroup($usernameSession, $groupName);
echo "<script>console.log($usernameSession)</script>";
echo "<script>window.location='$PHP_SELF'</script>";
}
}
?>
</div>
</div>
</body>
</html>