Example #1
0
<h2>Login to access:</h2>
<form method="post">
  <p>
    <input type="radio" id="format1" name="format" value="preview" checked><label for="format1">Preview</label>
    <br />
    <input type="radio" id="format2" name="format" value="download"><label for="format2">Download</label>
  </p>
  <p><label for="password">Password: </label>
      <input name="password" id="password" type="password" /></p>
  <p><input type="submit" name="submit" value="Submit" /></p>
</form>

<?php 
} else {
    $dbconn = db_openDB();
    $sql = "SELECT * FROM reports WHERE finalized IS NOT NULL";
    $result = mysqli_query($dbconn, $sql);
    $fields = mysqli_fetch_fields($result);
    $header = "";
    $first = true;
    foreach ($fields as $val) {
        if ($first) {
            $first = false;
        } else {
            $header .= ",";
        }
        $header .= $val->name;
    }
    $data = "";
    while ($row = mysqli_fetch_row($result)) {
Example #2
0
function checkPurge()
{
    if (isset($_REQUEST["purgeIncomplete"])) {
        $x = min($_REQUEST["purgeIncomplete"] * 60, 2 * 60 * 60);
        $dbconn = db_openDB();
        // TODO:  if image uploads being done, need to purge associated images?
        $sql = "DELETE FROM reports WHERE (now() - created) > {$x} AND finalized IS NULL";
        //print($sql);
        $result = mysqli_query($dbconn, $sql);
        //printf("Select returned %d rows.\n", mysqli_num_rows($result));
    }
}