Bug 37 has been fixed for the index page as this page is now optimized and dynamic CSS has been used

Applying DRY principles and better coding practices to index.php

Separating the CSS and applying DRY principles to the CSS in index.php so that they are all in main.css
Refactor-Moyo
MOYO NKOSANA THABO 2022-12-19 14:12:43 +08:00
parent deac064cf5
commit 518e1eef1a
8 changed files with 216 additions and 124 deletions

View File

@ -570,7 +570,7 @@ where course_group_members_table.Course_Group_id=$id");
<?php
}
include 'Footer.php';
include 'Footer.html';
?>

3
Footer.html Normal file
View File

@ -0,0 +1,3 @@
<div id="footer">
LRR was originally developed as a <a href="http://lanlab.org/course/2018f/se/homepage.html" style="color:white;">software engineering course project</a> by Mohamed Nor and Elmahdi Houzi. Please submit your suggestions or bug reports to lanhui. Last updated on 18/04/2020 by Ashly. <a href="./homepage" style="color:white;">More information ...</a>
</div>

View File

@ -1,4 +0,0 @@
<br><br><br><br><br><br><br><br><br>
<div style="background-color:white;width:100%di">
</div>

View File

@ -409,7 +409,7 @@ where course_group_members_table.Course_Group_id=$id");
<?php
}
include 'Footer.php';
include 'Footer.html';
?>
<script src="http://118.25.96.118/nor/css/jquery-1.11.1.min.js"></script>

File diff suppressed because one or more lines are too long

View File

@ -9,3 +9,139 @@
cursor:auto
}
/* This is the CSS for the Header. */
.nav-item {
border-color: #00ff66;
}
.nav-tabs {
border-color: #00ff66;
}
.btn-default {
border: 2px solid #00ff66;
width: 100%;
text-align: left;
margin: 3px auto;
font-weight: bold;
font-size: 13pt;
}
.table-bordered {
padding: 5px !important;
}
.alert {
font-weight: bold;
}
h1,
h2,
h3,
h4 {
color: #03407B;
font-weight:normal;
font-family: Poppins-Regular,serif;
}
a {
color: #03407B;
}
.break-word {
word-wrap: break-word;
/*CSS property sets how white space inside an element is handled.*/
white-space: pre-wrap;
word-break: break-all;
}
.ui-widget-content.ui-dialog {
border: 2px solid #03488B;
}
.ui-dialog>.ui-widget-header {
background: #03488B;
color: white
}
.ui-button {
background: #03488B;
color: white
}
.btn-primary {
color: white;
border-radius: 5px;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
background: #04519b;
padding:5px 100px;
font-family: Poppins-Regular, serif;;
font-size: 23px;
line-height: 1.5;
}
#footer{
position:fixed;
bottom:0;
left:0;
background-color:#03417C;
color:#FFF;
text-align:center;
width:100%;
}
.txt1 {
font-family: Poppins-Regular, serif;
font-size: 18px;
line-height: 1.5;
color: #666666;
}
.txt2 {
font-family: Poppins-Regular, serif;
font-size: 19px;
line-height: 1.5;
color: #2471A3;
}
/* CSS for the footer */
.footer{
font-weight:normal;
color:#2471A3;
font-family: Poppins-Regular, Serif;
font-size: 17px;
}
/* CSS for index Page */
/* CSS for LRR Word Logo */
.logolabel {
padding-top: 30%;
}
.lrrwordlog {
width:20%;
position:relative;
right:-90px;
font-family: Poppins-Regular, serif;
color: #03407B;
}
img {
max-width:100%;
height: auto;
position:relative;
right:-95px;
top:1px;"
}
/* CSS for Signup */
.signup-form{
margin: 20px;
}
/* Footer */
.footer{
background-color:white;width:100%
}

View File

@ -1,5 +1,4 @@
<?php
$csv = array_map('str_getcsv', file('./../../lrr_submission/KeepItSafe.txt'));
$mysql_username = $csv[0][0];
$mysql_password = $csv[0][1];
$mysql_username = 'root';
$mysql_password = '';
?>

152
index.php
View File

@ -1,128 +1,86 @@
<?php
$page='Home';
require 'Header.php';
session_start();
$page = 'Home';
require 'Header.php';
session_start();
?>
<?php
// if the user has already logged in, then clicking the LRRS icon should not display the login page (i.e., index.php).
// if the user has already logged in, then clicking the LRRS icon should not display the login page (i.e., index.php).
if (isset($_SESSION["user_fullname"])) {
header("Location: Courses.php");
}
?>
<!--Container for the logo label and Signup Form split into two 6columns-->
<div class="container">
<div class="row">
<!--Divide the page by 6 columns for the first section-->
<div class="col">
<br><br><br>
<!---Index Page Logo and Labeling on the left hand side -->
<section class="logolabel">
<div>
<img src="logo.png" alt="LRR Logo">
</div>
<div>
<h1 class="lrrwordlog">Lab Report Repository</h1>
</div>
</section>
</div>
<div class="row" style="width:85%;margin:auto;">
<div class="col-md-4">
<br><br>
<img src="logo.png" style="width:40%; position:relative; right:-95px; top:1px;">
<br><br>
<div style="width:20%; position:relative; right:-90px; font-family: Poppins-Regular;">
<h1>Lab Report Repository</h1>
<br><br>
</div>
</div>
<br>
<div style = "position:relative; left:240px; top:-2px;">
<h4 class="list-group-item active" style="font-weight:normal;font-family: Poppins-Regular;"> Sign in </h4>
<!--Divide the page by 6 columns for the last section-->
<div class="col">
<!--Index Page Signup form on the right hand side-->
<section class="signup-form">
<h4 class="list-group-item active"> Sign in </h4>
<div class="list-group-item">
<div class="panel-body">
<form method="post" action="Script.php" name="frm_login">
<input type="hidden" name="frm_login" value="true"/>
Student ID / Instructor Email
<input type="hidden" name="frm_login" value="true" />
<label>Student ID / Instructor Email</label>
<input type="text" name="user" placeholder="Email / Student Number" class="form-control" required="required" id="user_name" />
<br>
Password
<label>Password</label>
<input type="password" class="form-control" name="password" placeholder="password" required="required" id="user_password" />
<div class="text-center">
<br><input type="submit" class="btn-primary" value="Login" id="login_btn">
</div>
<br> <a href="recover_password.php" style="font-weight:normal;color:#2471A3; font-family: Poppins-Regular;
font-size: 17px;">Reset my password</a>
<div class="text-center">
<br><span class="txt1">Don't have an account?</span>
<a class="txt2" href="signup.php" style="font-weight:normal" id="signup_link">Sign Up</a>
</a>
</div>
<button type="submit" class="btn-primary" name="Login" id="login_btn" style="margin: 20px">Login</button>
<label>
<!---Warning labels-->
<?php
// wrong pass
if (isset($_SESSION['wrong_pass'])) {
echo '<hr><div class="alert alert-danger" role="alert">' . $_SESSION['wrong_pass'] . '</div>';
$_SESSION['wrong_pass'] = null;
}
error_reporting(E_ALL);
if(isset($_SESSION['info_login'])) {
echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['info_login'].'</div>';
$_SESSION['info_login']=null;
if (isset($_SESSION['info_login'])) {
echo '<hr><div class="alert alert-danger" role="alert">' . $_SESSION['info_login'] . '</div>';
$_SESSION['info_login'] = null;
}
// wrong pass
if(isset($_SESSION['wrong_pass'])) {
echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['wrong_pass'].'</div>';
$_SESSION['wrong_pass']=null;
}
if(isset($_SESSION['infoChangePassword'])) {
echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['infoChangePassword'].'</div>';
$_SESSION['infoChangePassword']=null;
if (isset($_SESSION['infoChangePassword'])) {
echo '<hr><div class="alert alert-danger" role="alert">' . $_SESSION['infoChangePassword'] . '</div>';
$_SESSION['infoChangePassword'] = null;
}
?>
</label>
</div>
<label class="footer" href="recover_password.php" ">Reset my password</label>
<div class=" text-center">
<br><span class="txt1">Don't have an account?</span>
<a class="txt2" href="signup.php" style="font-weight:normal" id="signup_link">Sign Up</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div id="footer">
LRR was originally developed as a <a href="http://lanlab.org/course/2018f/se/homepage.html" style="color:white;">software engineering course project</a> by Mohamed Nor and Elmahdi Houzi. Please submit your suggestions or bug reports to lanhui. Last updated on 18/04/2020 by Ashly. <a href="./homepage" style="color:white;">More information ...</a>
</div>
</section>
</div>
</body>
</div>
<style>
/*------------------------------------------------------------------
[ Login Button ]*/
.btn-primary {
color: white;
border-radius: 5px;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
background: rgb(75, 184, 240);
padding:5px 100px;
font-family: Poppins-Regular;
font-size: 23px;
line-height: 1.5;
}
#footer{
position:fixed;
bottom:0;
left:0;
background-color:#03417C;
color:#FFF;
text-align:center;
width:100%;
}
.txt1 {
font-family: Poppins-Regular;
font-size: 18px;
line-height: 1.5;
color: #666666;
}
.txt2 {
font-family: Poppins-Regular;
font-size: 19px;
line-height: 1.5;
color: #2471A3;
}
</style>
</html>
<?php
include 'footer.html'
?>