Commit a0b74af7 by mhasan

Last commit, removed the echoing of errors,

parent 5a8dbc7d
...@@ -33,7 +33,7 @@ require "php/db_conn.php"; ...@@ -33,7 +33,7 @@ require "php/db_conn.php";
<a class="nav-link" href="view.php"> View List</a>&nbsp; &nbsp; <a class="nav-link" href="view.php"> View List</a>&nbsp; &nbsp;
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="faq.php"> FAQ </a>&nbsp; &nbsp; <a class="nav-link" href="faq.php"> About us </a>&nbsp; &nbsp;
</li> </li>
</ul> </ul>
<ul style='text-align:end;' class="navbar-nav ml-auto"> <ul style='text-align:end;' class="navbar-nav ml-auto">
......
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-US"> <html lang="en-US">
<head> <head>
<link rel="stylesheet" href= "css/view.css"> <link rel="stylesheet" href="css/bootstrap.css">
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="description" content="ICD0007 Project, Todo List"> <meta name="description" content="ICD0007 Project, Todo List">
<title> FAQ</title> <title> FAQ</title>
</head> </head>
<body> <body style='background-image:url("img/back.jpg"); background-repeat: no-repeat;'>
<nav class="nav"> <nav class="navbar navbar-expand-lg navbar-dark bg-primary" id="navbarColor01">
<a href = "index.php"> Index </a> &nbsp; &nbsp; <ul class="navbar-nav mr-auto">
<a href = "register.php"> Register </a>&nbsp; &nbsp; <li class="nav-item">
<a href = "create.php"> Create List </a>&nbsp; &nbsp; <a class="nav-link" href="index.php"> Index </a> &nbsp; &nbsp;
<a href = "view.php"> View List</a>&nbsp; &nbsp; </li>
<a href = "faq.php"> FAQ </a>&nbsp; &nbsp; <li class="nav-item">
<a class="nav-link" href="register.php"> Register </a>&nbsp; &nbsp;
</li>
<li class="nav-item">
<a class="nav-link" href="create.php"> Create List </a>&nbsp; &nbsp;
</li>
<li class="nav-item">
<a class="nav-link" href="view.php"> View List</a>&nbsp; &nbsp;
</li>
<li class="nav-item">
<a class="nav-link" href="faq.php"> About us </a>&nbsp; &nbsp;
</li>
</ul>
<ul style=' text-align:end;' class="navbar-nav ml-auto">
<li class="nav-item">
<form method="GET" action="php/logout.php">
<input class='btn btn-info' type = 'submit' name =' logout' value = 'logout'>
</form>
</li>
</ul>
</nav> </nav>
<h2> Frequently Asked QUestions</h2>
<h2 style="text-align: center; margin-top:80px"> About us</h2>
<p style="text-align: center;"> A relatively simple website containing your daily todo list! To use, first register, then log in and create, edit delete and most importantly view your to do's for the day! </p>
<p style="text-align: center;"> The website was created by Tanveer Hasan and Ahmed Joyon, both first year cyber security engineering students as part of the ICD0007 Web technologies course </p>
<p style="text-align: center;"> This modest website is built using mainly PHP for the backend, running on a apache server and connected to a MySQL database. A bit of javascript is used for the front end user
interactivity </p>
</body> </body>
......
...@@ -28,7 +28,7 @@ function searchUser() { ...@@ -28,7 +28,7 @@ function searchUser() {
if (userName.length == 0) { if (userName.length == 0) {
document.getElementById("suggest").innerHTML = "Enter your user name"; document.getElementById("suggest").innerHTML = "Enter your user name";
document.getElementById("submit").disabled = true; document.getElementById("submit").disabled = true;
} else { } else { //Executes the block only when a change in username has occured.
var xmlhttp = new XMLHttpRequest(); // new request obejct var xmlhttp = new XMLHttpRequest(); // new request obejct
// document.getElementById("suggest").innerHTML = "request object created"; // document.getElementById("suggest").innerHTML = "request object created";
xmlhttp.onreadystatechange = function () { //on a change of request state, execute this function xmlhttp.onreadystatechange = function () { //on a change of request state, execute this function
......
...@@ -22,7 +22,7 @@ if( isset($_POST['submit'])) ...@@ -22,7 +22,7 @@ if( isset($_POST['submit']))
} }
catch(PDOException $e) catch(PDOException $e)
{ {
echo("querry error ". $e -> getMessage(). " ". $e -> getLine(). " "); // echo("querry error ". $e -> getMessage(). " ". $e -> getLine(). " ");
} }
} }
?> ?>
\ No newline at end of file
...@@ -12,7 +12,7 @@ if (isset($arr)) { ...@@ -12,7 +12,7 @@ if (isset($arr)) {
$pdo->exec($query_st); $pdo->exec($query_st);
header("location: ../view.php"); header("location: ../view.php");
} catch (PDOException $e) { } catch (PDOException $e) {
echo ($e->getMessage() . " " . $e->getLine()); // echo ($e->getMessage() . " " . $e->getLine());
} }
} }
......
...@@ -13,6 +13,6 @@ if (isset($_SESSION['userName'])) { ...@@ -13,6 +13,6 @@ if (isset($_SESSION['userName'])) {
$pdo_st->setFetchMode(PDO::FETCH_ASSOC); $pdo_st->setFetchMode(PDO::FETCH_ASSOC);
$row = $pdo_st->fetch(); $row = $pdo_st->fetch();
} catch (PDOException $ex) { } catch (PDOException $ex) {
echo ($ex->getMessage() . " " . $ex->getLine()); // echo ($ex->getMessage() . " " . $ex->getLine());
} }
} }
<?php
require "db_conn.php";
$e = null;
if (isset($_POST['submit'])) {
try {
$querry = sprintf("SELECT passHash FROM login WHERE userName = '%s' ;", $_POST['userName']);
$pdo_st = $pdo->query($querry);
$pdo_st->setFetchMode(PDO::FETCH_ASSOC);
$array = $pdo_st->fetch();
$isMatch = password_verify($_POST['pass'], $array['passHash']);
if ($isMatch == true) {
session_start();
$_SESSION['userName'] = $_POST['userName']; //Starts the session with the username!
// header("location: ../view.php"); //redirects user to view page upon successful login!
}
else {
header("location: ../index.php"); //redirects to the index page upon login failure.
}
} catch (PDOException $e) {
echo ($e->getMessage() . " " . $e->getLine());
}
}
?>
\ No newline at end of file
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
header("location: ../index.php"); header("location: ../index.php");
} catch (PDOException $e) { } catch (PDOException $e) {
echo "User name is taken, please choose something else."; echo "User name is taken, please choose something else.";
echo ("querry failiure " . $e->getMessage() . " " . $e->getLine()); // echo ("querry failiure " . $e->getMessage() . " " . $e->getLine());
} }
} }
?> ?>
\ No newline at end of file
...@@ -16,6 +16,6 @@ if (isset($_REQUEST['name'])) { ...@@ -16,6 +16,6 @@ if (isset($_REQUEST['name'])) {
} }
} catch (PDOException $e) { } catch (PDOException $e) {
echo ($e->getMessage()); // echo ($e->getMessage());
} }
} }
...@@ -90,25 +90,25 @@ if ($amount == 'all') { ...@@ -90,25 +90,25 @@ if ($amount == 'all') {
try { try {
all($pdo,$taskArray, $completion); all($pdo,$taskArray, $completion);
} catch (PDOException $p) { } catch (PDOException $p) {
echo ($p->getMessage() . " " . $p->getLine()); // echo ($p->getMessage() . " " . $p->getLine());
} }
} elseif ($amount == 'today'){ } elseif ($amount == 'today'){
try { try {
today($pdo,$taskArray, $completion); today($pdo,$taskArray, $completion);
} catch (PDOException $p) { } catch (PDOException $p) {
echo ($p->getMessage() . " " . $p->getLine()); // echo ($p->getMessage() . " " . $p->getLine());
} }
} elseif( $amount == 'custom') { } elseif( $amount == 'custom') {
try { try {
custom($pdo,$taskArray,$custom, $completion); custom($pdo,$taskArray,$custom, $completion);
} catch (PDOException $p) { } catch (PDOException $p) {
echo ($p->getMessage() . " " . $p->getLine()); // echo ($p->getMessage() . " " . $p->getLine());
} }
} else { } else {
try { try {
today($pdo,$taskArray, 0); today($pdo,$taskArray, 0);
} catch (PDOException $p) { } catch (PDOException $p) {
echo ($p->getMessage() . " " . $p->getLine()); // echo ($p->getMessage() . " " . $p->getLine());
} }
} }
...@@ -9,6 +9,6 @@ if (isset($arr)) { ...@@ -9,6 +9,6 @@ if (isset($arr)) {
$pdo -> exec($query); $pdo -> exec($query);
header("location: ../view.php"); header("location: ../view.php");
}catch (PDOException $e) { }catch (PDOException $e) {
echo ($e->getMessage() . " " . $e->getcode()); // echo ($e->getMessage() . " " . $e->getcode());
} }
} }
...@@ -9,7 +9,7 @@ if (isset($_POST['save'])) { ...@@ -9,7 +9,7 @@ if (isset($_POST['save'])) {
$pdo->exec($querry); $pdo->exec($querry);
header("location: ../view.php"); header("location: ../view.php");
} catch (PDOException $e) { } catch (PDOException $e) {
echo ($e->getMessage() . " " . $e->getLine()); // echo ($e->getMessage() . " " . $e->getLine());
} }
} }
?> ?>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en-US">
<head>
<link rel="stylesheet" href="css/bootstrap.css">
<meta charset="UTF-8">
<meta name="description" content="ICD0007 Project, Todo List">
<title> View Tasks</title>
<?php
session_start();
require "php/db_conn.php";
if (isset($_SESSION['userName'])) {
try {
$querry = sprintf("SELECT * FROM %s", $_SESSION['userName']);
$pdo_st = $pdo->query($querry);
$pdo_st->setFetchMode(PDO::FETCH_ASSOC);
} catch (PDOException $p) {
echo ($p->getMessage() . " " . $p->getLine());
}
}
?>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary" id="navbarColor01">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="index.php"> Index </a> &nbsp; &nbsp;
</li>
<li class="nav-item">
<a class="nav-link" href="register.php"> Register </a>&nbsp; &nbsp;
</li>
<li class="nav-item">
<a class="nav-link" href="create.php"> Create List </a>&nbsp; &nbsp;
</li>
<li class="nav-item">
<a class="nav-link" href="view.php"> View List</a>&nbsp; &nbsp;
</li>
<li class="nav-item">
<a class="nav-link" href="faq.php"> FAQ </a>&nbsp; &nbsp;
</li>
</ul>
</nav>
<h2> View Tasks for today</h2>
<table class="table table-success table-hover">
<tr>
<th class="table-info"> STATUS </th>
<th class="table-info"> TASK ID </th>
<th class="table-info"> DATE </th>
<th class="table-info"> TIME</th>
<th class="table-info"> TASKS</th>
<th class="table-info"> </th>
<th class="table-info"> EDIT Task </th>
<th class="table-info"> DELETE Task </th>
</tr>
<form method="POST" action="./php/taskComplete.php" id='done' onsubmit="return confirm('Are you sure you want to mark task as Done?');"> </form>
<form method="POST" action="edit.php" id='edit'> </form>
<form method="POST" action="./php/delete.php" id='delete' onsubmit="return confirm('Do you really want to Delete the task?');"> </form>
<?php
while ($row = $pdo_st->fetch()) // Takes 1 row of the data table, stores into an assoc array called row, elements of each row can be called by column name.
{
if ($row['task_completion'] == true) {
echo "<tr class = 'table-danger'> <td> DONE </td>";
} else {
echo "<tr> <td> TO DO </td>";
}
echo ("<td>" . $row['taskID'] . "</td>" . "<td>" . $row['t_date'] . "</td>" . "<td>" . $row['t_time'] . "</td>" . "<td>" . $row['task'] . "</td>");
echo "<td> <input type = 'submit' form = 'done' name = '", $row['taskID'], "' value = 'done?' > </input> </td>";
echo "<td> <input type = 'submit' form = 'edit' value = 'edit', name ='", $row['taskID'], "'> </td>";
echo "<td> <input type = 'submit' form = 'delete' value = 'delete' name ='", $row['taskID'], "' > </td>";
echo "</tr>";
}
?>
</table>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>
\ No newline at end of file
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<a class="nav-link" href="view.php"> View List</a>&nbsp; &nbsp; <a class="nav-link" href="view.php"> View List</a>&nbsp; &nbsp;
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="faq.php"> FAQ </a>&nbsp; &nbsp; <a class="nav-link" href="faq.php"> About us </a>&nbsp; &nbsp;
</li> </li>
</ul> </ul>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<a class="nav-link" href="view.php"> View List</a>&nbsp; &nbsp; <a class="nav-link" href="view.php"> View List</a>&nbsp; &nbsp;
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="faq.php"> FAQ </a>&nbsp; &nbsp; <a class="nav-link" href="faq.php"> About us </a>&nbsp; &nbsp;
</li> </li>
</ul> </ul>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<a class="nav-link" href="view.php"> View List</a>&nbsp; &nbsp; <a class="nav-link" href="view.php"> View List</a>&nbsp; &nbsp;
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="faq.php"> FAQ </a>&nbsp; &nbsp; <a class="nav-link" href="faq.php"> About us </a>&nbsp; &nbsp;
</li> </li>
</ul> </ul>
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
<td>{{ task.t_date }}</td> <td>{{ task.t_date }}</td>
<td>{{ task.t_time }}</td> <td>{{ task.t_time }}</td>
<td>{{ task.task }}</td> <td>{{ task.task }}</td>
<td> <input class="btn btn-warning" type='submit' form='done' value='done?' name={{task.taskID}}> </input></td> <td> <!---<input class="btn btn-warning" type='submit' form='done' value='done?' name={{task.taskID}}> </input> --></td>
<td> <input class="btn btn-primary" type='submit' form='edit' value='edit' name={{task.taskID}}> </td> <td> <input class="btn btn-primary" type='submit' form='edit' value='edit' name={{task.taskID}}> </td>
<td> <input class="btn btn-danger" type='submit' form='delete' value='delete' name={{task.taskID}}> </td> <td> <input class="btn btn-danger" type='submit' form='delete' value='delete' name={{task.taskID}}> </td>
</tr> </tr>
......
<!DOCTYPE html>
<html lang="en-US">
<head>
<link rel="stylesheet" href="css/bootstrap.css">
<meta charset="UTF-8">
<meta name="description" content="ICD0007 Project, Todo List">
<title> View Tasks</title>
</head>
<body style='background-image:url("img/back.jpg"); background-repeat: no-repeat;'>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary" id="navbarColor01">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="index.php"> Index </a> &nbsp; &nbsp;
</li>
<li class="nav-item">
<a class="nav-link" href="register.php"> Register </a>&nbsp; &nbsp;
</li>
<li class="nav-item">
<a class="nav-link" href="create.php"> Create List </a>&nbsp; &nbsp;
</li>
<li class="nav-item">
<a class="nav-link" href="view.php"> View List</a>&nbsp; &nbsp;
</li>
<li class="nav-item">
<a class="nav-link" href="faq.php"> FAQ </a>&nbsp; &nbsp;
</li>
</ul>
</nav>
{% if tasks is null %}
<h2 style="text-align: center; margin-top:80px"> Please log in </h2>
{% endif %}
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment