<?php /* Trip Report Generator, part of MedLog. This file displays all the entries belonging to a date, waits for input on which entries to include to the report and then generates it. */ require_once "./include/entries.php"; require_once "./include/usercontrol.php"; require_once "./include/static.php"; require_once "./include/tripify.php"; $u = new UserControl(); $dry = new DRYHelper(); if (!$u->CheckLogin()) { // Not logged in. header("Location: index.php"); die; } // Get the username and generate its entries controller $sess_user = $_SESSION[$u->GetLoginSessionVar()]; $e = new EntriesController($sess_user); // Are we done yet? $done = $_POST["done"]; if ($done == "no") { // No, so let's display all the entries belonging to this date. $date = $_POST["date"]; $dry->build_header("Generate Trip Report"); ?> <h1>Generate Trip Report</h1> <div id="content"> <p class="warning">Please select the entries you want to include in this trip report</p> <?php $res = $e->FindEntries(null, $date);
<?php require_once "./include/usercontrol.php"; require_once "./include/static.php"; $u = new UserControl(); $dry = new DRYHelper(); $dry->build_header("Registration"); ?> <h1>Registration</h1> <div id="content"> <!-- File-specific script --> <script> // Main function $(document).ready(function() { // Validate the form mjm.setForm("#reg-form"); mjm.watchForm(); }); </script> <!-- /File-specific script --> <form id="reg-form"> <fieldset> <label for="username">Username: </label> <input type="text" id="username" name="username" required min-length="3"/> <br /> <label for="password">Password: </label> <input type="password" id="password" name="password" required min-length="3"/> <br />
<?php require_once "./include/usercontrol.php"; require_once "./include/entries.php"; require_once "./include/static.php"; $u = new UserControl(); $dry = new DRYHelper(); if (!$u->CheckLogin()) { // Not logged-in, redirect to index header("Location: index.php"); die; } $sess_user = $_SESSION[$u->GetLoginSessionVar()]; $e = new EntriesController($sess_user); $dry->build_header("My Journal"); ?> <h1>My Journal</h1> <div id="site-info"> <p>This is your journal, it contains all the data you've logged in MedLog.</p> </div> <div id="content"> <?php $res = $e->FindEntries(); if ($res != false) { $dry->build_table_header(); //$rows = []; while ($row = $res->fetch_assoc()) { //array_push($rows, $row); $dry->build_table_row($row); } echo "</table>";
<?php /* MedLog MANAGE Module ~~~~~ Add, Delete and Edit MedLog edits. Check login firstly... */ require_once "./include/usercontrol.php"; require_once "./include/entries.php"; require_once "./include/static.php"; $u = new UserControl(); $dry = new DRYHelper(); if (!$u->CheckLogin()) { // Not logged-in, redirect to index header("Location: index.php"); die; } // Now we assume we're logged in! Get the username. $sess_user = $_SESSION[$u->GetLoginSessionVar()]; $op = $_GET["op"]; // Start the HTML love $dry->build_header("Manage"); ?> <h1>MedLog MANAGE</h1> <div id="content"> <?php // Let's try and find out what we're trying to do. if ($op == "add") { /* Add a new entry to the journal */ ?> <h2>Add new entry</h2> <div id="content"> <!-- File-specific script --> <script>
<?php /* Main page of MedLog. Displays the brief site details, login form and last entries of the user */ require_once "./include/usercontrol.php"; require_once "./include/entries.php"; require_once "./include/static.php"; $u = new UserControl(); $dry = new DRYHelper(); // Check login before sending headers $checklogin = $u->CheckLogin(); $dry->build_header(); if (!empty($_GET["message"])) { ?> <div id="message"><?php echo $_GET["message"]; ?> </div> <?php } ?> <h1>MedLog</h1> <div id="site-info"> <p>MedLog provides an easy-to-use medication/drug log for our users. Log every drug you take! MedLog also analyses your logged data to create powerful statistics regarding your drug use.</p> </div> <div id="content"> <?php /* Check if the user has already logged in */ if (!$checklogin) { /* Log-in form */
<?php /* Generate a trip report and return a downloadable file */ require_once "./include/entries.php"; require_once "./include/usercontrol.php"; require_once "./include/static.php"; require_once "./include/tripify.php"; $u = new UserControl(); $dry = new DRYHelper(); if (!$u->CheckLogin()) { // Not logged in. header("Location: index.php"); die; } $sess_user = $_SESSION[$u->GetLoginSessionVar()]; $e = new EntriesController($sess_user); $ids = explode(",", $_GET["ids"]); $tripify = new Tripify($sess_user, $ids); if ($_GET["format"] == "html") { header("Content-type: text/html"); header("Content-Disposition: attachment; filename=trip.html"); // HTML file to download here. $dry->build_header("Trip Report"); $tripify->generate_html_header(); $tripify->generate_html(); $tripify->generate_html_footer(); $dry->build_footer(); } else { if ($_GET["format"] == "txt") { header("Content-type: text/plain"); header("Content-Disposition: attachment; filename=trip.txt");