-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
96 lines (88 loc) · 4.17 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
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Class Notifier</title>
</head>
<body>
<center><h1>UBCO Class Notifier</h1></center>
<center><h2 style="padding-top: 25px;" class="goAway">Pick a course name</h2></center>
<center><h2 style="display:none;" id="end_dis" class="later_vis">Type in the details for the course you want to track</h2></center>
<?php
$conn = new mysqli("localhost","root","","Hackathon");
if($conn->connect_error){
die("Connection failed: ".$conn->connect_error);
}
$sql="SELECT * FROM Course_Names";
$res = $conn->query($sql);
$result = "<div class=\"container\" id=\"dissapear\">
<div style=\"height:500px;\" class=\"row\">
<div style=\"height:100%;\" class=\"col-sm-4 goAway\"><br class=\"goAway\"><br class=\"goAway\"><p class=\"goAway\">A</p>";
$counter = 0;
$letter = "A";
while($row = $res->fetch_assoc()){
$letters = str_split($row["Course_Name"]);
$letter1 = $letters[0];
if ($letter1 != $letter){
$result .= "<br class=\"goAway\"><br class=\"goAway\"><p class=\"goAway\">";
$result .= $letter1;
$result .= "</p>";
}
$letter = $letter1;
$result .= "<form id=\"frm1\"><input type=\"button\" id=\"course\" onClick=\"showAndSave(this.value)\" name=\"course\" value=\"";
$result .= ($row["Course_Name"]."\" ");
$result .= "style=\"margin:5px;\" class=\"btn btn-info goAway\">";
$counter ++;
if($counter==30){
$result .= "</div><center><input type=\"number\" placeholder=\"Course Number\" class=\"later_vis\" style=\"display:none; margin-top:25px;\" id = \"number\" name=\"number\" value=\"\"></center>
<input type=\"number\" placeholder=\"Section Number\" class=\"later_vis\" style=\"display:none;\" id=\"section\" name=\"section\" value=\"\">
<input type=\"email\" placeholder=\"[email protected]\" class=\"later_vis\" style=\"display:none;\" id = \"email\"name=\"email\" value=\"\">
<input type=\"button\" class=\"btn btn-success later_vis\" style=\"display:none;\" onClick=\"submitter()\" id=\"later_vis\" name=\"\" value=\"Submit\"></center>
<div class=\"col-sm-4\">";
}
if($counter == 49){
$result .= "</div>
<div class=\"col-sm-4\"> ";
}
}
$result .= "</div>
</div></form>
</div>
<center><h2 style=\"display:none;\" id=\"end_appear\">Click the link below and send the email to track a course</h2></center><br id=\"end_appear3\">
<center><a href=\"\" id=\"end_link\"><h2 style=\"display:none;\" id=\"end_appear2\">Click here</h2></a></center>
";
echo $result;
?>
<script type="text/javascript">
var course = "";
function showAndSave(val){
var x = document.getElementsByClassName("goAway");
var i;
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
var y = document.getElementsByClassName("later_vis");
var j;
for (j = 0; j < y.length; j++) {
y[j].style.display = "inline";
}
course = val;
}
function submitter(){
var number = document.getElementById("number").value;
var section = document.getElementById("section").value;
var email = document.getElementById("email").value;
var email_body = course+" "+number+" "+section+" "+email;
document.getElementById("dissapear").style.display = "none";
document.getElementById("end_appear").style.display = "inline";
document.getElementById("end_link").href = "https://mail.google.com/mail/?view=cm&fs=1&[email protected]&su=ClassNotifierRequest&body="+email_body;
document.getElementById("end_appear2").style.display = "inline";
document.getElementById("end_appear3").style.display = "inline";
document.getElementById("end_dis").style.display = "none";
//document.getElementById("frm1").submit();
}
</script>
</body>
</html>