Initial commit

This commit is contained in:
Tanner Collin 2019-02-17 19:40:33 -07:00
commit 409e32659b
49 changed files with 9621 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
realData/*
pictures/*
usercss/*
setup/*

29
License Normal file
View File

@ -0,0 +1,29 @@
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

181
addPicture.php Normal file
View File

@ -0,0 +1,181 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "adminUtils.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if ($_SESSION['login'] === TRUE)
{
$targetID = NULL;
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* Process form here
*/
if (returnAdminStatus($_SESSION['MemberID']))
if (isset($_POST['target']))
$targetID = $_POST['target'];
if (isset($_POST['submit']))
{
if ($_FILES['filename']['error'] === UPLOAD_ERR_OK)
{
$finfo = finfo_open(FILEINFO_MIME);
$destination = tempnam("pictures", "pic");
if (move_uploaded_file($_FILES['filename']['tmp_name'], $destination));
{
$fileInfo = finfo_file($finfo, $destination);
//print($destination);
if (is_null($targetID))
if (registerNewPicture($_SESSION['MemberID'], basename($destination), $_FILES['filename']['name'], $fileInfo) === FALSE)
{
print("Picture not added to database.");
}
else
{
}
else
if (registerNewPicture($targetID, basename($destination), $_FILES['filename']['name'], $fileInfo) === FALSE)
print ("Picture not added to database for member ID: " .$targetID);
}
}
else
{
print($_FILES['filename']['error']);
}
}
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
$_SESSION['subNav'] = NULL;
$body->appendChild(generateSelectedMenuBar($doc));
/*
* Insert content here.
*/
$editorDiv = $doc->createElement('div');
//$editorDiv->setAttribute('id', 'CourseEditorDiv');
$form = createForm($doc, 'addPicture.php');
$img = NULL;
if (is_null($targetID))
$img = returnPictureForMember($_SESSION['MemberID']);
else
if (returnAdminStatus($_SESSION['MemberID']) || returnDirectorStatus($_SESSION['MemberID']))
{
$img = returnPictureForMember($targetID);
$form->appendChild(createHiddenInput($doc, 'target', $targetID));
}
if (!is_null($img))
{
$label = $doc->createElement('H3');
$label->appendChild($doc->createTextNode("Current picture"));
$form->appendChild($label);
$form->appendChild(createBr($doc));
$form->appendChild(createImg($doc, $pictureDir . $img));
}
$label = $doc->createElement('H3');
$label->appendChild($doc->createTextNode("Add a picture"));
$form->appendChild($label);
$fieldSet = $doc->createElement('fieldset');
//$fieldSet->setAttribute('style', 'width:200px; max-width:300px;'); //margin-top:0.5em;');
$fieldSetDiv = $doc->createElement('div');
$label = $doc->createElement('label', 'File:');
$label->setAttribute('for', 'filename');
$label->setAttribute('class', 'CourseEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'file');
$input->setAttribute('name', 'filename');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$input = $doc->createElement('input');
$input->setAttribute('type', 'submit');
$input->setAttribute('value', 'upload');
$input->setAttribute('name', 'submit');
$fieldSetDiv->appendChild($input);
$form->appendChild($fieldSetDiv);
$editorDiv->appendChild($form);
$body->appendChild($editorDiv);
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
outputDoc($doc);
}
else
generateIndexRedirect();
?>

94
admin-template.php Normal file
View File

@ -0,0 +1,94 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "adminUtils.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE) && returnAdminStatus($_SESSION['MemberID']))
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* Process form here
*/
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
$_SESSION['subNav'] = 1;
$body->appendChild(generateSelectedMenuBar($doc, 1));
/*
* Insert content here.
*/
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
outputDoc($doc);
}
else
generateIndexRedirect();
?>

795
admin.php Normal file
View File

@ -0,0 +1,795 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "adminUtils.php";
include_once "formUtils.php";
include_once "sql.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE) && returnAdminStatus($_SESSION['MemberID']))
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* validate form data.
*/
if (isset($_POST['id']))
try
{
//print_r(PDO::getAvailableDrivers());
$dbh = returnDatabaseHandel();
//$dbh->beginTransaction();
//$sth = $dbh->prepare("SELECT * FROM members WHERE id = ?");
$sth = $dbh->prepare($statement204);
$count = 0;
if ($sth->execute(array($_POST['id'])))
{
if ($row = $sth->fetch(PDO::FETCH_ASSOC))
{
if (($row['first_name'] === $_POST['first_name']) && ($row['last_name'] === $_POST['last_name']))
{
//print_r($_POST);
if (isset($_POST['Vet_Now']) && ($_POST['Vet_Now'] === "Vet Now"))
{
//print ("Vetting...");
$stb = $dbh->prepare($statement287);
$stb->execute(array($_POST['id'], $_POST['first_name'], $_POST['last_name']));
}
else
{
/*
* All optional variable need to be checked.
*/
if (isset($_POST['current_start']))
$currStart = $_POST['current_start'];
else
if (isset($row['current_start_date']))
$currStart = $row['current_start_date'];
else
$currStart = "";
if (isset($_POST['street_address']))
$streetAddr = $_POST['street_address'];
else
if (isset($row['street_address']))
$streetAddr = $row['street_address'];
else
$streetAddr = "";
if (isset($_POST['guardian']))
$guardian = $_POST['guardian'];
else
$guardian = "";
if (isset($_POST['emergency_contact_name']))
$emergContactName = $_POST['emergency_contact_name'];
else
$emergContactName = "";
if (isset($_POST['emergency_contact_number']))
$emergContactNumber = $_POST['emergency_contact_number'];
else
$emergContactNumber = "";
if (isset($_POST['instructor']))
$instCheck = TRUE;
else
$instCheck = FALSE;
if (isset($_POST['administrator']))
$adminCheck = TRUE;
else
$adminCheck = FALSE;
if (isset($_POST['director']))
$dirCheck = TRUE;
else
$dirCheck = FALSE;
if (isset($_POST['minor']))
$minorCheck = TRUE;
else
$minorCheck = FALSE;
/*
$sth = $dbh->prepare("UPDATE members SET preferred_name = ?, nickname = ?, email = ?, expire_date = ?, " .
"current_start_date = ?, application_date = ?, status = ?, monthly_fees = ?, proto_cash = ?, " .
"minor = ?, birthdate = ?, guardian_name = ?, street_address = ?, city = ?, province = ?, " .
"postal_code = ?, phone = ?, emergency_contact_name = ?, emergency_contact_phone = ?, " .
"new_member_notes = ?, instructor = ?, administrator = ?, director = ? WHERE id = ? AND first_name = ? " .
"AND last_name = ?");
*/
//print ("curr start: " . $currStart);
$sth = $dbh->prepare($statement222);
$sth->execute(array($_POST['prefered_name'], $_POST['nick_name'], $_POST['email'], $_POST['expire'],
$currStart, $_POST['application_date'], $_POST['status'], $_POST['monthly_fees'],
$_POST['proto_cash'], $minorCheck, $_POST['birth_date'], $_POST['guardian'], $streetAddr,
$_POST['city'], $_POST['province'], $_POST['postal_code'], $_POST['phone'], $emergContactName,
$emergContactNumber, $_POST['member_notes'], $instCheck, $adminCheck,
$dirCheck, $row['id'], $row['first_name'], $row['last_name']));
}
}
}
}
}
catch (Exception $e)
{
print ("Fail! " . $e->getMessage() . "\n");
}
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
/*
$body->appendChild(generateMemberNavigationBar($doc));
$body->appendChild(generateAdminNavigationBar($doc));
$_SESSION['sub_nav'] = "Admin";*/
$_SESSION['subNav'] = 1;
$body->appendChild(generateSelectedMenuBar($doc, 1));
$tableDiv = $doc->createElement('div');
//$tableDiv->setAttribute('display', 'block');
$tableDiv->setAttribute('class', 'FloatLeft50Div');
$table = $doc->createElement('table');
//$table.setAttribute('class'
//$table->setAttribute('class', 'FloatLeft50Div');
$thead = $doc->createElement('thead');
$tr = $doc->createElement('tr');
$th = $doc->createElement('th');
$a = $doc->createElement('a');
$a->appendChild($doc->createTextNode('ID'));
$th->appendChild($a);
$tr->appendChild($th);
$th = $doc->createElement('th');
$a = $doc->createElement('a');
$a->appendChild($doc->createTextNode('First Name'));
$th->appendChild($a);
$tr->appendChild($th);
$th = $doc->createElement('th');
$a = $doc->createElement('a');
$a->appendChild($doc->createTextNode('Last Name'));
$th->appendChild($a);
$tr->appendChild($th);
$th = $doc->createElement('th');
$th->appendChild($doc->createTextNode('Vetted'));
$tr->appendChild($th);
$th = $doc->createElement('th');
$th->appendChild($doc->createTextNode('Status'));
$tr->appendChild($th);
$thead->appendChild($tr);
$table->appendChild($thead);
$tbody = $doc->createElement('tbody');
$tint = false;
$edit = NULL;
try
{
//print_r(PDO::getAvailableDrivers());
$dbh = returnDatabaseHandel();
$dbh->beginTransaction();
//$sth = $dbh->prepare("SELECT * FROM members"); /* SORT BY first_name;*/
$sth = $dbh->prepare($statement101);
$count = 0;
if ($sth->execute())
{
while ($row = $sth->fetch(PDO::FETCH_ASSOC))
{
if (isset($_GET['id']))
if ($row['id'] === $_GET['id'])
$edit = $row;
$count++;
$tr = $doc->createElement('tr');
/*
if ($tint === true)
{
$tr->setAttribute('class', 'AlternateRow');
}*/
/*
try
{
$stg = $dbh->prepare("SELECT name FROM courses WHERE id = ?");
if ($stg->execute(array($row['course_id'])))
{
$innerRow = $stg->fetch(PDO::FETCH_ASSOC);
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($innerRow['name']));
$tr->appendChild($td);
}
}
catch (Exception $f)
{
echo "Fail! " . $f->getMessage() . "\n";
}
*/
/*
$tint = !$tint;
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($course['Subject']));
$tr->appendChild($td);*/
$td = $doc->createElement('td');
$rr = $doc->createElement('a');
$rr->setAttribute('href', "admin.php?id=${row['id']}");
$rr->appendChild($doc->createTextNode($row['id']));
$td->appendChild($rr);
$tr->appendChild($td);
/*
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($row['id']));
$tr->appendChild($td);*/
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($row['first_name']));
$tr->appendChild($td);
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($row['last_name'])); //$row['Confirmed']));
$tr->appendChild($td);
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($row['vetted_date'])); //$course['Open']));
$tr->appendChild($td);
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode(returnMemberStatusByID($row['id']))); //$course['Open']));
$tr->appendChild($td);
/* $rr = $doc->createElement('a');
$rr->setAttribute('href', "admin.php?id=${row['id']}");
$rr->appendChild($tr);*/
$tbody->appendChild($tr);
}
}
$table->appendChild($tbody);
$tableDiv->appendChild($table);
$body->appendChild($tableDiv);
}
catch (Exception $e)
{
echo "Failed!" . $e->getMessage() . "\n";
}
if (!($edit === NULL))
{
$editorDiv = $doc->createElement('div');
$editorDiv->setAttribute('id', 'MemberEditorDiv');
$titleSpan = createSpan($doc);
$label = $doc->createElement('H3');
$label->appendChild($doc->createTextNode($edit['first_name'] . " " . $edit['middle_name'] . " " . $edit['last_name']));
$picture = returnPictureForMember($edit['id']);
if (!is_null($picture))
{
$img = createImg($doc, $pictureDir . $picture, $edit['first_name'] . " " . $edit['last_name'], "MemberEditorIconPicture");
$label->appendChild($img);
}
$titleSpan->appendChild($label);
$editorDiv->appendChild($titleSpan);
$form = createForm($doc, 'password-reset.php', 'GET');
$input = createHiddenInput($doc, 'id', (string)$edit['id'], NULL, NULL, TRUE);
$form->appendChild($input);
$input = createSubmitInput($doc, $text0012, $text0012, NULL, NULL);
$form->appendChild($input);
$editorDiv->appendChild($form);
$form = createForm($doc, 'addPicture.php', 'POST');
$input = createHiddenInput($doc, 'target', (string)$edit['id'], NULL, NULL, TRUE);
$form->appendChild($input);
$input = createSubmitInput($doc, 'Change Picture', 'Change Picture');
$form->appendChild($input);
$editorDiv->appendChild($form);
/*
$form = $doc->createElement('form');
$form->setAttribute('action', 'admin.php');
$form->setAttribute('method', 'post');
*/
$form = createForm($doc, 'admin.php');
$input = createHiddenInput($doc, 'id', $edit['id'], NULL, NULL, TRUE);
$form->appendChild($input);
$input = createHiddenInput($doc, 'first_name', $edit['first_name'], NULL, NULL, TRUE);
$form->appendChild($input);
$input = createHiddenInput($doc, 'last_name', $edit['last_name'], NULL, NULL, TRUE);
$form->appendChild($input);
$fieldSet = $doc->createElement('fieldset');
//$fieldSet->setAttribute('style', 'width:200px; max-width:300px;'); //margin-top:0.5em;');
$fieldSetDiv = $doc->createElement('div');
$label = $doc->createElement('label', 'Prefered Name:');
$label->setAttribute('for', 'prefered_name');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'prefered_name');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['prefered_name']))
$input->setAttribute('value', $edit['prefered_name']);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Nick Name:');
$label->setAttribute('for', 'nick_name');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'nick_name');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['nick_name']))
$input->setAttribute('value', $edit['nick_name']);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'EMail Address:');
$label->setAttribute('for', 'email');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'email');
$input->setAttribute('name', 'email');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('class', 'MemberEditorInputField');
if (isset($edit['email']))
$input->setAttribute('value', $edit['email']);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Expiration Date:');
$label->setAttribute('for', 'expire');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'date');
$input->setAttribute('name', 'expire');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['expire_date']))
$input->setAttribute('value', $edit['expire_date']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Current Start Date:');
$label->setAttribute('for', 'current_start');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'date');
$input->setAttribute('name', 'current_start');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['current_start_date']))
$input->setAttribute('value', $edit['current_start_date']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Application Date:');
$label->setAttribute('for', 'application_date');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'date');
$input->setAttribute('name', 'application_date');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['application_date']))
$input->setAttribute('value', $edit['application_date']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Vetted Date:');
$label->setAttribute('for', 'vetted');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$now = date_create('now');
$startDate = date_create($edit['current_start_date']); //, $dbDateFormat);
$startDate = date_add($startDate, DateInterval::createFromDateString('4 weeks'));
$expireDate = date_create($edit['expire_date']);
if (isset($edit['vetted_date']))
{
if (is_null($edit['vetted_date']))
{
if (($startDate < $now) && ($now < $expireDate))
{
$input = createSubmitInput($doc, 'Vet Now', 'Vet Now');
$fieldSetDiv->appendChild($input);
}
else
{
$input = createSubmitInput($doc, 'Not Vetable', 'Not Vetable');
$fieldSetDiv->appendChild($input);
}
}
else
{
$input = $doc->createElement('input');
$input->setAttribute('type', 'date');
$input->setAttribute('name', 'vetted');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['vetted_date']))
$input->setAttribute('value', $edit['vetted_date']);
//$input->setAttribute('required', 'required');
$input->setAttribute('readonly', 'readonly');
}
$fieldSetDiv->appendChild($input);
}
else
{
if (($startDate < $now) && ($now < $expireDate))
{
$input = createSubmitInput($doc, 'Vet Now', 'Vet Now');
$fieldSetDiv->appendChild($input);
}
else
{
$input = createSubmitInput($doc, 'Not Vetable', 'Not Vetable');
$fieldSetDiv->appendChild($input);
}
}
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Status:');
$label->setAttribute('for', 'status');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'status');
//$input->setAttribute('autocomplete', 'off');
if (isset($edit['status']))
$input->setAttribute('value', $edit['status']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Monthly Fees:');
$label->setAttribute('for', 'monthly_fees');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'number');
$input->setAttribute('name', 'monthly_fees');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('step', '0.01');
$input->setAttribute('pattern', '^\d+(\.|\,)\d{2}$');
if (isset($edit['monthly_fees']))
$input->setAttribute('value', $edit['monthly_fees']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Protospace Cash:');
$label->setAttribute('for', 'proto_cash');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'number');
$input->setAttribute('name', 'proto_cash');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['proto_cash']))
$input->setAttribute('value', $edit['proto_cash']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Minor:');
$label->setAttribute('for', 'minor');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'checkbox');
$input->setAttribute('name', 'minor');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['minor']))
$input->setAttribute('checked', 'checked');
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Birth Date:');
$label->setAttribute('for', 'birth_date');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'date');
$input->setAttribute('name', 'birth_date');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['birth_date']))
$input->setAttribute('value', $edit['birth_date']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Guardian:');
$label->setAttribute('for', 'guardian');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'guardian');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['guardian']))
$input->setAttribute('value', $edit['guardian']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Street Address:');
$label->setAttribute('for', 'address');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'address');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['street_address']))
$input->setAttribute('value', $edit['street_address']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'City:');
$label->setAttribute('for', 'city');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'city');
//$input->setAttribute('autocomplete', 'off');
if (isset($edit['city']))
$input->setAttribute('value', $edit['city']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Province:');
$label->setAttribute('for', 'province');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'province');
//$input->setAttribute('autocomplete', 'off');
if (isset($edit['province']))
$input->setAttribute('value', $edit['province']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Postal Code:');
$label->setAttribute('for', 'postal_code');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'postal_code');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['postal_code']))
$input->setAttribute('value', $edit['postal_code']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Phone:');
$label->setAttribute('for', 'phone');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'phone');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['phone']))
$input->setAttribute('value', $edit['phone']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Emergency Contact Name:');
$label->setAttribute('for', 'emergency_name');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'emergency_name');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['emergency_contact_name']))
$input->setAttribute('value', $edit['emergency_contact_name']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Emergency Contact Number:');
$label->setAttribute('for', 'emergency_number');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'emergency_number');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['emergency_contact_number']))
$input->setAttribute('value', $edit['emergency_contact_number']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Instructor:');
$label->setAttribute('for', 'instructor');
$label->setAttribute('class', 'MemberEditorInputLabelTight');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'checkbox');
$input->setAttribute('name', 'instructor');
$input->setAttribute('class', 'MemberEditorInputFieldTight');
$input->setAttribute('autocomplete', 'off');
if (returnInstructorStatus($edit['id']))
$input->setAttribute('checked', 'checked');
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('label', 'Administrator:');
$label->setAttribute('for', 'administrator');
$label->setAttribute('class', 'MemberEditorInputLabelTight');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'checkbox');
$input->setAttribute('name', 'administrator');
$input->setAttribute('class', 'MemberEditorInputFieldTight');
$input->setAttribute('autocomplete', 'off');
if (returnAdminStatus($edit['id']))
$input->setAttribute('checked', 'checked');
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('label', 'Director:');
$label->setAttribute('for', 'director');
$label->setAttribute('class', 'MemberEditorInputLabelTight');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'checkbox');
$input->setAttribute('name', 'director');
$input->setAttribute('class', 'MemberEditorInputFieldTight');
$input->setAttribute('autocomplete', 'off');
if (returnDirectorStatus($edit['id']))
$input->setAttribute('checked', 'checked');
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('label', 'Member Notes:');
$label->setAttribute('for', 'member_notes');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'textarea');
$input->setAttribute('name', 'member_notes');
$input->setAttribute('rows', '3');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['member_notes']))
$input->setAttribute('value', $edit['member_notes']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$fieldSet->appendChild($fieldSetDiv);
$form->appendChild($fieldSet);
$input = $doc->createElement('input');
$input->setAttribute('type', 'reset');
$form->appendChild($input);
$input = $doc->createElement('input');
$input->setAttribute('type', 'submit');
$form->appendChild($input);
$editorDiv->appendChild($form);
$body->appendChild($editorDiv);
}
$body->appendChild(generateFooter($doc));
outputDoc($doc);
}
else
generateIndexRedirect();
?>

245
appReadMeFirst.php Normal file
View File

@ -0,0 +1,245 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
include_once 'DOMUtils.php';
include_once 'utils.php';
$doc = returnDoc();
$root = returnRoot($doc);
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$mastHead = $doc->createElement('h1');
$mastHead->appendChild($doc->createTextNode("Read Me"));
$mastHead->setAttribute('class', 'mastHead');
$body->appendChild($mastHead);
$div = $doc->createElement('div');
$div->setAttribute('class', 'readMe');
$body->appendChild($div);
$str = <<<EOD
This is the read me file for the member portal. It details some of
the critical files an administrator needs to know about during setup
and maintanance in no particular order.
EOD;
$para = $doc->createElement('p');
$para->appendChild($doc->createTextNode($str));
$div->appendChild($para);
$str = <<<EOD
The consts.php file contains all the constants used throughout the
system including the password for the database. It should be moved
out of the document root (automagically by setup) in to an include
directory. Every admin should check that these constants are correct
for their site. Just about every file has an include_once for this
file.
EOD;
$header = $doc->createElement('h3');
$header->appendChild($doc->createTextNode('consts.php'));
$div->appendChild($header);
$para = $doc->createElement('p');
$para->appendChild($doc->createTextNode($str));
$div->appendChild($para);
$str = <<<EOD
The sql.php file contains all the SQL statements. Alternate statments
for database engines other than MySQL should go in the appropirate
place reserved for them in the switch statement at the bottom. The
default statements are for MySQL but all the engines supported by the
PDO driver should have a spot reserved for them. This file should be
moved out of the document root in to an include directory.
EOD;
$header = $doc->createElement('h3');
$header->appendChild($doc->createTextNode('sql.php'));
$div->appendChild($header);
$para = $doc->createElement('p');
$para->appendChild($doc->createTextNode($str));
$div->appendChild($para);
$str = <<<EOD
The database.php file contains all the database access functions. These
typically have names like populateThisTable or generateThatForm. The
SQL statements are pulled from the sql.php file. This file should be
moved out of the document root in to an include directory.
EOD;
$header = $doc->createElement('h3');
$header->appendChild($doc->createTextNode('database.php'));
$div->appendChild($header);
$para = $doc->createElement('p');
$para->appendChild($doc->createTextNode($str));
$div->appendChild($para);
$str = <<<EOD
Utility functions obviously. This file was created very early and
has a bit of a mish mash of functions. This file should be moved out
of the document root in to an include directory.
EOD;
$header = $doc->createElement('h3');
$header->appendChild($doc->createTextNode('utils.php'));
$div->appendChild($header);
$para = $doc->createElement('p');
$para->appendChild($doc->createTextNode($str));
$div->appendChild($para);
$str = <<<EOD
The DOMUtils.php file was created after a bunch of pages were already
written and I had gained an understanding of the DOM API. A lot of
tedious coding could have been saved with this file and it makes for
a much more uniform approach to things like formatting and changing
between HTML and XML output. This file should be moved out of the
document root and in to an include directory.
EOD;
$header = $doc->createElement('h3');
$header->appendChild($doc->createTextNode('DOMUtils.php'));
$div->appendChild($header);
$para = $doc->createElement('p');
$para->appendChild($doc->createTextNode($str));
$div->appendChild($para);
$str = <<<EOD
The setup.php file is meant to be run once (but was run constantly
during development) to initialize the database and configure the
system including moving include files out of the document root
(eventually). I'm not sure if this file should self emolate or move
its self somewhere or what. For now it remains in the document root
which is probably a security flaw of some kind....
EOD;
$header = $doc->createElement('h3');
$header->appendChild($doc->createTextNode('setup.php'));
$div->appendChild($header);
$para = $doc->createElement('p');
$para->appendChild($doc->createTextNode($str));
$div->appendChild($para);
$str = <<<EOD
This file has a few utility functions most pages don't need. This
file should be moved out of the document root in to an include
directory.
EOD;
$header = $doc->createElement('h3');
$header->appendChild($doc->createTextNode('formUtils.php'));
$div->appendChild($header);
$para = $doc->createElement('p');
$para->appendChild($doc->createTextNode($str));
$div->appendChild($para);
$str = <<<EOD
Template files are the skeletons for making new pages. They provide
a blank functioning page ready to be filled with content respective
to their name.
EOD;
$header = $doc->createElement('h3');
$header->appendChild($doc->createTextNode('*-template.php'));
$div->appendChild($header);
$para = $doc->createElement('p');
$para->appendChild($doc->createTextNode($str));
$div->appendChild($para);
$str = <<<EOD
The only file that relies on a library (fpdf.php) so far. The
library can go in an include subdirectory or not. That should
eventually be part of the setup process. This page is also the
only one that doesn't output html or xml, instead it generates
a PDF of the application form for the currently logged in user.
This needs to be tested and adjusted for the case of a new sign
up.
EOD;
$header = $doc->createElement('h3');
$header->appendChild($doc->createTextNode('applicationForm.php'));
$div->appendChild($header);
$para = $doc->createElement('p');
$para->appendChild($doc->createTextNode($str));
$div->appendChild($para);
$str = <<<EOD
Most other files are the actual pages that make up the site. Most
are based on a template file but the templates changed during
development and so they are by no means consistant. A code audit
should include fixing that.
EOD;
$header = $doc->createElement('h3');
$header->appendChild($doc->createTextNode('other php files'));
$div->appendChild($header);
$para = $doc->createElement('p');
$para->appendChild($doc->createTextNode($str));
$div->appendChild($para);
$str = <<<EOD
The style sheet for the website.
EOD;
$header = $doc->createElement('h3');
$header->appendChild($doc->createTextNode('members.css'));
$div->appendChild($header);
$para = $doc->createElement('p');
$para->appendChild($doc->createTextNode($str));
$div->appendChild($para);
$str = <<<EOD
That is all I have for now. Hope this helps make this system easier
to understand.
EOD;
$header = $doc->createElement('h3');
$header->appendChild($doc->createTextNode('End Of Line'));
$div->appendChild($header);
$para = $doc->createElement('p');
$para->appendChild($doc->createTextNode($str));
$div->appendChild($para);
outputDoc($doc);
?>

98
applicationForm.php Normal file
View File

@ -0,0 +1,98 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "consts.php";
include_once "database.php";
include_once "adminUtils.php";
include_once "formUtils.php";
include_once "applicationFormUtils.php";
if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if ($_SESSION['login'] === TRUE)
if (returnAdminStatus($_SESSION['MemberID']))
{
$pdf = new ApplicationForm(getMemberRowData($_SESSION['MemberID']));
$pdf->Output();
//generateForm($_SESSION['MemberID']);
/*
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
$body->appendChild(generateMemberNavigationBar($doc));
$body->appendChild(generateAdminNavigationBar($doc));
*/
/*
* Insert content here.
*/
/*
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
echo $doc->saveXML();
*/
}
else
{
$pdf = new ApplicationForm(getMemberRowData($_SESSION['MemberID']));
$pdf->Output();
}
else
generateIndexRedirect();
?>

432
applicationFormUtils.php Normal file
View File

@ -0,0 +1,432 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
include_once "utils.php";
include_once "consts.php";
include_once "database.php";
include_once "adminUtils.php";
include_once "formUtils.php";
include_once "applicationFormUtils.php";
if ($localHost)
include_once "fpdf.php";
else
include_once "fpdf/fpdf.php";
/*
$doc = new DOMDocument('1.0');
$root = $doc->createElement('html');
*/
class ApplicationForm extends FPDF
{
private $memberData = NULL;
private $inset = 5;
private $topMargin = 2.5;
function __construct($data)
{
global $timeZone;
parent::__construct("P", "mm", "Letter");
date_default_timezone_set($timeZone);
$doubleNewLine = "\n\n";
$initial = "\n\n\n(initial)";
$firstLine = "I confirm that the information I have provided is true and correct. I promise to be excellent to people.";
$secondLine = 'I am aware of, and will abide by, the member responsibilities listed in the Bylaws of Calgary Protospace, Ltd. I have signed or will sign a "Release of Liability, Waiver of Claims, Assumption of Risks and Indemnity Agreement". I release Calgary Protospace Limited, its members, directors, staff and agents from any and all liability arising out of this application, my use of equipment, tools or space at Protospace and my participation in any Protospace program, facility or event."';
$thirdLine = "I agree to pay the required dues for membership. I understand that failure to do this may result in termination of my membership. I understand that dues will continue to be charged unless I request to end my membership.";
$fourthLine = "I am also aware that my application is subject to review and a probationary period before my membership becomes active";
$riskOne = 'I acknowledge that inherent risks, dangers and hazards exist when using hand tools, power tools, supplies, and other equipment commonly used in electronics construction, fabrication, software design and other activities hosted by Calgary Protospace Inc. ("Protospace"). Participation in such activities and/or the use of equipment associated with technology design, manufacture and experimentation may result in injury, illness, death or damage to personal property. These risks and dangers may be caused by other people, including Protospace members, participants, or guests, or by accidents, acts of nature or other causes. Risks and dangers may arise from foreseeable or unforeseeable causes including, but not limited to, electrocution, burns, impalement, and injury from slips or falls.';
$riskTwo = "I am responsible for my own safety during Protospace's activities. This includes ensuring that tools are in proper working order, and that tools are used safely and responsibly. I agree not to use any tools I do not know how to use. I agree not to use tools or equipment while under the influence of drugs or alcohol.";
$riskThree = "I acknowledge that a Protospace member who may be acting as my host or Sponsor and other Members of Protospace may advise me on safe work practices, but this does not constitute training, nor a supervisory relationship. I further acknowledge that responsibility for safely using Protospace's facilities, tools or equipment lies entirely on myself. Failure to follow reasonable safety protocols or wilful violation of reasonable safety protocols may result in expulsion from Protospace facilities. If I am currently a Protospace member, or become one, wilful violation of reasonable safety protocols may result in the termination of my membership and/or access rights.";
$riskFour = "Until and unless I apply for and am accepted as a full member of Calgary Protospace, I understand that as a Guest, in order to access Protospace facilities or space, I must be accompanied by a member of Protospace, and I will not seek to access nor to remain in the space unaccompanied, until and unless I have become a member and have been issued my own key, key fob, or access card.";
$waiverZero = "In consideration of Protospace allowing me to participate in Protospace's activities, and for other good and valuable consideration, the receipt and sufficiency of which is acknowledged, I hereby agree as follows:";
$waiverOne = "1. RELEASE OF LIABILITY: The Participant (me), fully assumes all risks associated with participation in events, and exempts and releases Protospace, its members, officers, agents, and directors, from any and all liability arising out of any damage, expense, loss or injury including death to the participant or the participant's property while upon Protospace's premises, or using any of Protospace's equipment, or while participating in any of Protospace's activities, whether such loss, damage, or injury results from the negligence of Protospace, its members, its agents, or from some other cause.";
$waiverTwo = "2. COVENANT NOT TO SUE: The Participant agrees never to institute any suit or action at law or otherwise against Protospace, its members, officers, board members, agents, nor to initiate or any way assist in the prosecution of any claim for damages or course of action that the member, member's heirs, executors or administrators hereafter may have by reason of injury to the person of the member or to the participant's property arising from the activities contemplated by this agreement.";
$waiverThree = "3. THIRD PARTY INDEMNIFICATION: The Participant will indemnify, save and hold harmless Protospace, its members, officers, directors, or agents from any and all losses, claims, actions, or proceedings of every kind and character which may be presented or initiated by any Third Party and which arise directly or indirectly from the actions of the Participant while engaged in the activities contemplated by this agreement.";
$waiverFour = "4. ACCEPTABLE SPEECH AND BEHAVIOUR: Protospace is accepting of all races, creeds, genders, orientations, religions and any other type of identifier. While Protospace is encouraging of freedom of speech and the open sharing of ideas of all types, hateful speech, harassment, threats or violence will not be tolerated. Use of Protospace or Protospace Members' equipment while intoxicated or otherwise impaired is forbidden for reasons of safety. Such actions or speech may result in consequences including warnings, membership suspension or termination, or expulsion from the facility (temporarily or permanently).";
$waiverFive = "5. This Release Agreement shall be effective and binding upon my heirs, next of kin, executors, administrators, assigns and representatives, in the event of my death or incapacity.";
$waiverSix = "6. This Release Agreement and any rights, duties and obligations as between myself and Protospace, its members, officers, directors or agents shall be governed by and interpreted solely in accordance with the laws of Alberta and no other jurisdiction.";
$waiverSeven = "7. Any litigation involving myself and Protospace, its members, officers, directors, or agents shall be brought solely in Alberta and shall be within the exclusive jurisdiction of the Courts of Alberta.";
$waiverEight = "8. I hereby acknowledge that I have CAREFULLY read all of the provisions above, fully understand the terms and conditions expressed there, and do freely choose acceptance of the provisions of the foregoing paragraphs relating to assumption of risk, release of liability, covenant not to sue, and third party indemnification. I am aware that this is a release of liability and a contract between myself and Protospace, and sign it of my own free will.";
$waiverNine = "9. I hereby acknowledge the danger involved in participating at Protospace, and agree to assume any and all risks of bodily injury, death or property damage, whether those risks are known or unknown.";
$waiverTen = "10. I hereby acknowledge that I have been shown the safety equipment in the space.";
$waiverEleven = "In entering into this Release Agreement, I am not relying on any oral or written representations or statements made by Protospace, its members, officers, board members, or agents with the respect to the safety of Protospace's activities, other than what is set forth in this Release Agreement.";
$waiverTwelve = "I CONFIRM THAT I HAVE READ AND UNDERSTOOD THIS RELEASE AGREEMENT PRIOR TO SIGNING IT, AND I AM AWARE THAT BY SIGNING THIS RELEASE AGREEMENT I AM WAIVING CERTAIN LEGAL RIGHTS WHICH I OR MY HEIRS, NEXT OF KIN, EXECUTORS, ADMINISTRATORS, ASSIGNS, AND REPRESENTATIVES MAY HAVE AGAINST CALGARY PROTOSPACE LTD, ITS MEMBERS, OFFICERS, DIRECTORS, OR AGENTS.";
$tour = "The following member certifies that the participant has been shown the emergency exits and safety equipment in the facility, and has been given an opportunity to examine this document and appears to understand its contents";
$guardian = "In the case of a participant who is a minor:\nI acknowledge and agree to be bound by the terms of this agreement both for myself, and on the part of the minor named as the participant.";
$this->SetTopMargin($this->topMargin);
$this->memberData = arrayCopy($data);
$this->AddPage();
$this->SetFont('Arial', 'B', 20);
$this->Cell(0, 9, "Protospace Membership Application", 0, 1, "C");
$this->Line($this->inset, 18, $this->GetPageWidth() - $this->inset, 18);
$this->SetFont('Times','',16);
$this->Cell(0, 10, "Welcome", 0, 1);
$this->SetFont('Times', '', 12);
$this->Cell($this->inset, 0, "Thank you for your interest.", 0, 1);
$this->SetY($this->GetY() + 3);
$lineX = $this->GetX();
$lineY = $this->GetY();
$this->drawDataEntryBox(65, 10, "First Name", $this->memberData['first_name']);
$this->drawDataEntryBox(65, 10, "Last Name", $this->memberData['last_name']);
$this->drawDataEntryBox(65, 10, "Nick Name (Optional)", $this->memberData['nickname']);
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawDataEntryBox(85, 10, "Mailing Address", $this->memberData['street_address']);
$this->drawDataEntryBox(65, 10, "City, Province", $this->memberData['city'] . ", " . $this->memberData['province']);
$this->drawDataEntryBox(45, 10, "Postal Code", $this->memberData['postal_code']);
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawDataEntryBox(105, 10, "Email Address", $this->memberData['email']);
$this->drawDataEntryBox(90, 10, "Phone Number", $this->memberData['phone']);
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawDataEntryBox(195, 10, "How did you hear about Protospace?", "");
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawDataEntryBox(105, 10, "Emergency Contact Name (Optional)", $this->memberData['emergency_contact_name']);
$this->drawDataEntryBox(90, 10, "Emergency Contact Phone (Optional)", $this->memberData['emergency_contact_phone']);
$this->SetX($lineX + 40);
$this->SetY($lineY + 13);
$lineY = $this->GetY();
$this->drawDataEntryBox(120, 10, "Students - Institution Name and Course of Study (Optional)", "");
$this->SetX($lineX);
$this->SetY($lineY + 13);
$lineY = $this->GetY();
$this->SetFont('Arial', '', 10);
$this->Write(4, $firstLine);
$this->SetX($lineX);
$this->SetY($lineY + 8);
$lineY = $this->GetY();
$this->Write(4, $secondLine);
$this->Write(4, $doubleNewLine);
$this->Write(4, $thirdLine);
$this->Write(4, $doubleNewLine);
$this->Write(4, $fourthLine);
$this->Write(4, $doubleNewLine);
$this->SetX($lineX);
$lineY = $this->GetY();
$this->drawDataEntryBox(145, 10, "Signature of Applicant or the Applicant's Parent or Guardian", ""); //$this->memberData['first_name'] . " " . $this->memberData['last_name']);
$this->drawDataEntryBox(50, 10, "Date Signed", date("Y-m-d"));
$this->SetX($lineX);
$this->SetY($lineY + 12);
$lineY = $this->GetY();
$this->drawDataEntryBox(195, 15, "Notes or Comments", "");
$this->SetX($lineX);
$this->SetY($lineY + 18);
$lineY = $this->GetY();
$this->Line($lineX, $lineY, $lineX + 195, $lineY);
$this->SetX($lineX);
$this->SetY($lineY + 6);
$lineY = $this->GetY();
$this->SetFont('Arial', '', 16);
$this->Text($lineX, $lineY, "Payment of your first dues is required with this application.");
$this->SetX($lineX);
$this->SetY($lineY + 2);
$lineY = $this->GetY();
$this->drawDataEntryBox(55, 10, "Payment Amount", "");
$this->drawDataEntryBox(45, 10, "Payment Date", "");
$this->drawDataEntryBox(95, 10, "Recipt Number (For Cheque or Cash)", "");
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawPaymentChoiceBox(195, 18, "Where will we find your payment?");
$this->SetX($lineX);
$this->SetY($lineY + 22);
$lineY = $this->GetY();
$this->Line($lineX, $lineY, $lineX + 195, $lineY);
$this->SetX($lineX);
$this->SetY($lineY + 6);
$lineY = $this->GetY();
$this->SetFont('Arial', '', 16);
$this->Text($lineX, $lineY, "Sponsors and Approval");
$this->SetX($lineX);
$this->SetY($lineY + 3);
$lineY = $this->GetY();
$this->drawDataEntryBox(95, 10, "Sponsor 1 - Name", "");
$this->drawDataEntryBox(55, 10, "Signature", "");
$this->drawDataEntryBox(45, 10, "Date Signed", "");
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawDataEntryBox(95, 10, "Sponsor 2 - Name", "");
$this->drawDataEntryBox(55, 10, "Signature", "");
$this->drawDataEntryBox(45, 10, "Date Signed", "");
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawDataEntryBox(65, 10, "ID checked by:", "");
$this->drawDataEntryBox(65, 10, "Application checked by:", "");
$this->drawDataEntryBox(65, 10, "Liability form checked by:", "");
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawDataEntryBox(95, 10, "Confirmed by (Director)", "");
$this->drawDataEntryBox(55, 10, "Signature", "");
$this->drawDataEntryBox(45, 10, "Date Signed", "");
$this->AddPage();
$this->SetFont('Arial', '', 16);
$this->Cell(0, 6, "Calgary Protospace Ltd.", 0, 1, "C");
$this->Cell(0, 6, "Release of Liability, Waiver of Claims,", 0, 1, "C");
$this->Cell(0, 6, "Assumption of Risks and Indemnity Agreement", 0, 1, "C");
$this->SetFont('Arial', '', 12);
$this->Cell(0, 3, '("Release Agreement")', 0, 1, "C");
$this->Write(2, $doubleNewLine);
$this->SetFont('Times', '', 14);
$this->Write(5, "Assumption of Risks");
$this->SetFont('Times', '', 12);
//$this->Write(2, $doubleNewLine);
$this->Write(4, $doubleNewLine . $riskOne);
//$this->Write(2, $doubleNewLine);
$this->Write(4, $doubleNewLine . $riskTwo);
$this->Write(4, $doubleNewLine . $riskThree);
$this->Write(4, $doubleNewLine . $riskFour);
$this->Write(4, $initial);
$this->Line($this->GetX() + 2, $this->GetY() + 4, $this->GetX() + 25, $this->GetY() + 4);
$this->SetFont('Times', '', 14);
$this->Write(5, "\n\nRelease of Liability, Waiver of Claims and Indemnity Agreement");
$this->SetFont('Times', '', 12);
$this->Write(4, $doubleNewLine . $waiverZero);
$this->Write(4, $doubleNewLine . $waiverOne);
$this->Write(4, $doubleNewLine . $waiverTwo);
$this->Write(4, $doubleNewLine . $waiverThree);
$this->Write(4, $doubleNewLine . $waiverFour);
$this->Write(4, $doubleNewLine . $waiverFive);
$this->Write(4, $doubleNewLine . $waiverSix);
$this->Write(4, $doubleNewLine . $waiverSeven);
$this->Write(4, $doubleNewLine . $waiverEight);
$this->Write(4, $initial);
$this->Line($this->GetX() + 2, $this->GetY() + 4, $this->GetX() + 25, $this->GetY() + 4);
$this->Write(4, $doubleNewLine . $waiverNine);
$this->Write(4, $initial);
$this->Line($this->GetX() + 2, $this->GetY() + 4, $this->GetX() + 25, $this->GetY() + 4);
$this->Write(4, $doubleNewLine . $waiverTen);
$this->Write(4, $initial);
$this->Line($this->GetX() + 2, $this->GetY() + 4, $this->GetX() + 25, $this->GetY() + 4);
$this->Write(4, $doubleNewLine . $waiverEleven);
$this->Write(4, $doubleNewLine . $waiverTwelve);
$this->SetX($lineX);
$lineY = $this->GetY() + 6;
$this->SetY($lineY);
$this->drawDataEntryBox(55, 10, "Participant Name - Print", "");
$this->drawDataEntryBox(140, 10, "", $this->memberData['first_name'] . " " . $this->memberData['last_name']);
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawDataEntryBox(55, 10, "Signature", "");
$this->drawDataEntryBox(140, 10, "", "");
$this->SetX($lineX);
$this->SetY($lineY + 10);
$lineY = $this->GetY();
$this->drawDataEntryBox(55, 10, "Date (YYYY-MM-DD)", "");
$this->drawDataEntryBox(70, 10, "", date("Y-m-d"));
$this->drawDataEntryBox(70, 10, "Orignial signing date", "");
$this->SetFont('Times', '', 12);
$this->SetX($lineX);
$this->SetY($lineY + 12);
$lineY = $this->GetY();
$this->Write(4, $tour);
$this->SetX($lineX);
$lineY = $this->GetY() + 6;
$this->SetY($lineY);
$this->drawDataEntryBox(85, 10, "Touring Member - Print", "");
$this->drawDataEntryBox(110, 10, "Touring Member - Signature", "");
$this->SetFont('Times', '', 12);
$this->SetX($lineX);
$lineY = $this->GetY() + 12;
$this->SetY($lineY);
$this->Write(4, $guardian);
$this->SetX($lineX);
$lineY = $this->GetY() + 6;
$this->SetY($lineY);
$this->drawDataEntryBox(75, 10, "Name of Parent or Guardian", "");
$this->drawDataEntryBox(75, 10, "Signature of Parent or Guardian", "");
$this->drawDataEntryBox(45, 10, "Date", date("Y-m-d"));
$this->SetFont('Times', '', 12);
}
function drawDataEntryBox($w, $h, $label, $data)
{
$origX = $this->GetX();
$origY = $this->GetY();
$this->Rect($origX, $origY, $w, $h);
$this->SetFont('Arial', '', 8);
$this->Text($origX + 2, $origY + 3, $label);
$this->SetFont('Times', 'B', 14);
$this->Text($origX + 8, $origY + 8, $data);
$this->SetY($origY);
$this->SetX($origX + $w);
}
function drawPaymentChoiceBox($w, $h, $label)
{
$origX = $this->GetX();
$origY = $this->GetY();
$this->Rect($origX, $origY, $w, $h);
$this->SetFont('Arial', '', 8);
$this->Text($origX + 2, $origY + 3, $label);
$this->SetFont('Arial', '', 10);
$this->Rect($origX + 5, $origY + 6, 2, 2);
$this->Text($origX + 8, $origY + 8, "I made a one time payment via PayPal or email Interact");
$this->Rect($origX + 5, $origY + 12, 2, 2);
$this->Text($origX + 8, $origY + 14, "I set up a recuring PayPal payment");
$this->Rect($origX + 100, $origY + 6, 2, 2);
$this->Text($origX + 103, $origY + 8, "I paid by cheque");
$this->Rect($origX + 100, $origY + 12, 2, 2);
$this->Text($origX + 103, $origY + 14, "I paid by cash");
$this->Rect($origX + 135, $origY + 6, 2, 2);
$this->Text($origX + 138, $origY + 8, "I paid by a credit card (Square)");
/*
$this->drawCheckBoxChoice($origX + 5, $origY + 6, "I made a one time payment via PayPal or email Interact");
$this->drawCheckBoxChoice($origX + 5, $origY + 12, "I set up a recuring PayPal payment");
$this->drawCheckBoxChoice($origX + 55, $origY + 6, "I paid by cheque");
$this->drawCheckBoxChoice($origX + 55, $origY + 12, "I paid by cash");
$this->drawCheckBoxChoice($origX + 125, $origY + 6, "I paid by a credit card/n(Square)");
*/
$this->SetY($origY + $h);
$this->SetX($origX + $w);
}
function drawCheckBoxChoice($x, $y, $label)
{
$origX = $this->GetX();
$origY = $this->GetY();
//$this->SetX($origX + $x);
//$this->SetY($origY + $y);
//$this->Box($x, $y, 2, 2);
$this->Rect($x, $y, 2, 2);
//$this->SetX($origX + $x + 5);
//$this->SetY($origY + $y);
$this->SetFont('Arial', '', 10);
$this->Text($origX + $x + 5, $origY + $y, $label);
//$this->Write(4, $label);
$this->SetX($origX);
$this->SetY($origY);
}
/*
* Override of default
*/
function Header()
{
$this->SetFont('Times', '', 10);
$firstName = $this->memberData['first_name'];
$lastName = $this->memberData['last_name'];
$id = $this->memberData['id'];
$this->Cell(0, 6, "$firstName $lastName ($id)", 0, 1, "R");
}
/*
* Override of default
*/
function Footer()
{
}
}
function generateForm($memberID)
{
$member = getMemberRowData($memberID);
$pdf = new FPDF("P", "mm", "Letter");
$pdf->SetTopMargin(2.5);
$pdf->AddPage();
$inset = 5;
/*
$pdf->Line(0, 0, 100, 0);
$pdf->Line(0, 0, 0, 100);*/
$pdf->SetFont('Times','',12);
$pdf->Cell(0, 6, "${member['first_name']} ${member['last_name']} (${member['id']})", 0, 1, "R");
$pdf->SetFont('Arial', 'B', 20);
$pdf->Cell(0, 10, "Protospace Membership Application", 0, 1, "C");
$pdf->Line($inset, 20, $pdf->GetPageWidth() - $inset, 20);
$pdf->SetFont('Times','',16);
$pdf->Cell(0, 10, "Welcome", 0, 1);
$pdf->SetFont('Times', '', 12);
$pdf->Cell($inset, 0, "Thank you for your interest.", 0, 1);
//$pdf->
$pdf->Output();
}
?>

206
attendance.php Normal file
View File

@ -0,0 +1,206 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "adminUtils.php";
include_once "trainingUtils.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE) && returnAdminStatus($_SESSION['MemberID']))
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* validate form data.
*/
if (isset($_POST['classID']) && isset($_POST['Update']) && isset($_POST['status'])) // && isset($_POST['description']))
{
$classID = (int) cleanInput($_POST['classID']);
/*
try
{
$dbh = returnDatabaseHandel();
$dbh->beginTransaction();
$sth = $dbh->prepare("UPDATE class_registrants SET attendance_status = 'no'");
$sth->execute();
$sth = $dbh->prepare("UPDATE class_registrants SET attendance_status = 'yes' WHERE member_id = ?");
foreach ($_POST as $attendee => $status)
{
if ($status === "Attended")
$sth->execute(array($attendee));
}
$dbh->commit();
/*
$insert = TRUE;
//print_r(PDO::getAvailableDrivers());
$dbh = returnDatabaseHandel();
//$dbh->beginTransaction();
$sth = $dbh->prepare("SELECT * FROM courses");
$count = 0;
if ($sth->execute())
{
while ($row = $sth->fetch(PDO::FETCH_ASSOC))
{
if ($row['id'] === $_POST['id'])
{
$insert = FALSE;
}
}
//echo "here";
if ($insert)
{
$sth = $dbh->prepare("INSERT INTO courses (id, name, description) values (?, ?, ?)");
$sth->execute(array($_POST['id'], $_POST['name'], $_POST['description']));
}
else
{
$dbh->beginTransaction();
$sth = $dbh->prepare("UPDATE courses SET name = ?, description = ? WHERE id = ?");
$sth->execute(array($_POST['name'], $_POST['description'], $_POST['id']));
//print_r($sth->errorInfo());
$dbh->commit();
}
}
}
catch (Exception $e)
{
$dbh->rollBack();
print ("Fail! " . $e->getMessage() . "\n");
}*/
$status = cleanInput($_POST['status']);
if ($status === "NoShow" || $status === "Attended" ||
$status === "Rescheduled" || $status === "Confirmed" ||
$status === "Withdrawn" || $status === "Registered")
{
updateAttendenceTable($classID, $status);
}
}
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
/*$body->appendChild(generateMemberNavigationBar($doc));
if (returnInstructorStatus($_SESSION['MemberID']))
if ($_SESSION['sub_nav'] === "Admin")
$body->appendChild(generateAdminNavigationBar($doc));
else
if ($_SESSION['sub_nav'] === "Director")
$body->appendChild(generateDirectorNavigationBar($doc));
else
$body->appendChild(generateTrainingNavigationBar($doc));
else
if (returnAdminStatus($_SESSION['memberID']))
$body->appendChild(generateAdminNavigationBar($doc)); */
/*
* Do not set session sub nav
*/
$body->appendChild(generateSelectedMenuBar($doc));
/*
* Insert content here.
*/
//print_r($_POST);
$bodyDiv = $doc->createElement('div');
$bodyDiv->setAttribute('class', 'BodyDiv');
if (returnInstructorStatus($_SESSION['MemberID']) || returnAdminStatus($_SESSION['MemberID']) || returnDirectorStatus($_SESSION['MemberID']))
{
if (isset($_POST['classID']))
$bodyDiv->appendChild(generateClassSelector($doc, (int) cleanInput($_POST['classID']))); // $_POST is only used for comparison in this function
else
$bodyDiv->appendChild(generateClassSelector($doc));
$bodyDiv->appendChild($doc->createElement('hr'));
if (isset($_POST['classID']))
{
$classID = (int) cleanInput($_POST['classID']);
$bodyDiv->appendChild(generateAttendanceForm($doc, $classID));
$bodyDiv->appendChild($doc->createElement('br'));
$text = $doc->createElement('H3');
$text->appendChild($doc->createTextNode(getCourseTitleFromClassID($classID)));
$bodyDiv->appendChild($text);
$text = $doc->createElement('p');
$text->appendChild($doc->createTextNode(getCourseDescriptionFromClassID($classID)));
$bodyDiv->appendChild($text);
}
}
$body->appendChild($bodyDiv);
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
echo $doc->saveXML();
}
else
generateIndexRedirect();
?>

96
canteen.php Normal file
View File

@ -0,0 +1,96 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "adminUtils.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE) && returnAdminStatus($_SESSION['MemberID']))
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* Process form here
*/
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
$_SESSION['subNav'] = NULL;
$body->appendChild(generateSelectedMenuBar($doc));
/*
* Insert content here.
*/
$h3 = $doc->createElement('h3');
$h3->appendChild($doc->createTextNode("This is where members can track their pop purchases"));
$body->appendChild($h3);
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
outputDoc($doc);
}
else
generateIndexRedirect();
?>

199
classes.php Normal file
View File

@ -0,0 +1,199 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "text.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if ($_SESSION['login'] === TRUE)
{
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
$body->appendChild(generateSelectedMenuBar($doc));
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* process class signup
*
* check if a seat is available
* add a class_registrant record
*/
//print_r($_POST);
if (isset($_POST['register']))
{
if (isset($_POST['class_id']) && ($_POST['register'] === "Register"))
{
$classID = (int) cleanInput($_POST['class_id']);
registerMemberForClass($classID, $_SESSION['MemberID']);
$h3 = $doc->createElement('h3');
$h3->appendChild($doc->createTextNode("You have been registered for class " . $classID));
$body->appendChild($h3);
$p = $doc->createElement('p');
$p->appendChild($doc->createTextNode($text7000));
$body->appendChild($p);
}
}
else
if (isset($_POST['withdraw']))
{
if (isset($_POST['class_id']))
{
$classID = (int) cleanInput($_POST['class_id']);
}
}
}
else
{
try
{
if (isset($_GET['class_id']))
{
/*
* Get with class_id, show class details/signup
*/
$classID = (int) cleanInput($_GET['class_id']);
$classDiv = $doc->createElement('div');
$classDiv->setAttribute('class', 'FloatLeft50Div');
$dbh = returnDatabaseHandel();
$sth = $dbh->prepare($statement249);
if ($sth->execute(array($classID)))
{
$count = 0;
while ($row = $sth->fetch(PDO::FETCH_ASSOC))
{
$count++;
$h3 = $doc->createElement('h3');
$h3->appendChild($doc->createTextNode("Class Number " . $row['id']));
$classDiv->appendChild($h3);
//$classDiv->appendChild($doc->createElement('br'));
$h3 = $doc->createElement('h3');
$h3->appendChild($doc->createTextNode($row['name']));
$classDiv->appendChild($h3);
$h5 = $doc->createElement('h5');
$h5->appendChild($doc->createTextNode("Cost: " . money_format('%i', $row['cost'])));
$classDiv->appendChild($h5);
$h5 = $doc->createElement('h5');
$h5->appendChild($doc->createTextNode("Starting at: " . $row['start_datetime']));
$classDiv->appendChild($h5);
$p = $doc->createElement('p');
$p->appendChild($doc->createTextNode($row['description']));
$classDiv->appendChild($p);
/*
* Register, deregister?
*/
$form = createForm($doc, "classes.php");
$input = createHiddenInput($doc, 'class_id', (string)$row['id']);
/* $input = $doc->createElement('input');
$input->setAttribute('type', 'hidden');
$input->setAttribute('name', 'class_id');
$input->setAttribute('value', $row['id']); */
$form->appendChild($input);
$status = returnMemberStatusForClass($classID, $_SESSION['MemberID']);
if ($status === "Confirmed" || $status === "Registered")
{
$input = createSubmitInput($doc, 'withdraw', $text0020);
/* $input = $doc->createElement('input');
$input->setAttribute('type', 'submit');
$input->setAttribute('name', 'withdraw');
$input->setAttribute('value', 'Withdraw');*/
$form->appendChild($input);
}
else
{
$input = createSubmitInput($doc, 'register', $text0021);
/* $input = $doc->createElement('input');
$input->setAttribute('type', 'submit');
$input->setAttribute('name', 'register');
$input->setAttribute('value', 'Register'); */
$form->appendChild($input);
}
$classDiv->appendChild($form);
}
}
if ($count == 1)
$body->appendChild($classDiv);
else
$body->appendChild(generateTrainingTable($doc, 'classes.php'));
}
else
{
/*
* Get with no class_id, display table
*/
$body->appendChild(generateTrainingTable($doc, 'classes.php'));
}
}
catch (Exception $e)
{
$body->appendChild(generateTrainingTable($doc, 'classes.php'));
}
}
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
echo $doc->saveXML();
}
?>

430
courseEditor.php Normal file
View File

@ -0,0 +1,430 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "adminUtils.php";
include_once "trainingUtils.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE) && returnAdminStatus($_SESSION['MemberID']))
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* validate form data.
*/
if (isset($_POST['id']) && isset($_POST['name']) && isset($_POST['description']))
try
{
$insert = TRUE;
//print_r(PDO::getAvailableDrivers());
$dbh = returnDatabaseHandel();
//$dbh->beginTransaction();
$sth = $dbh->prepare("SELECT * FROM courses");
$count = 0;
if ($sth->execute())
{
while ($row = $sth->fetch(PDO::FETCH_ASSOC))
{
if ($row['id'] === $_POST['id'])
{
$insert = FALSE;
}
}
//echo "here";
if ($insert)
{
$sth = $dbh->prepare("INSERT INTO courses (id, name, description) values (?, ?, ?)");
$sth->execute(array($_POST['id'], $_POST['name'], $_POST['description']));
}
else
{
$dbh->beginTransaction();
$sth = $dbh->prepare("UPDATE courses SET name = ?, description = ? WHERE id = ?");
$sth->execute(array($_POST['name'], $_POST['description'], $_POST['id']));
//print_r($sth->errorInfo());
$dbh->commit();
}
}
}
catch (Exception $e)
{
print ("Fail! " . $e->getMessage() . "\n");
}
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
//$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
/*
$body->appendChild(generateMemberNavigationBar($doc));
if (returnInstructorStatus($_SESSION['MemberID']))
if ($_SESSION['sub_nav'] === "Admin")
$body->appendChild(generateAdminNavigationBar($doc));
else
if ($_SESSION['sub_nav'] === "Director")
$body->appendChild(generateDirectorNavigationBar($doc));
else
$body->appendChild(generateTrainingNavigationBar($doc));
else
if (returnAdminStatus($_SESSION['memberID']))
$body->appendChild(generateAdminNavigationBar($doc));
*/
/*
* do not set session sub nav
*/
//$body->appendChild(generateSelectedMenuBar($doc));
$body->appendChild(generateTopStickyDiv($doc, $baseDir));
/*
* Insert content here.
*/
$bodyDiv = $doc->createElement('div');
$bodyDiv->setAttribute('class', 'BodyDiv');
/*
$tableDiv = $doc->createElement('div');
//$tableDiv->setAttribute('display', 'block');
$tableDiv->setAttribute('class', 'FloatLeft50Div');
$table = $doc->createElement('table');
//$table.setAttribute('class'
//$table->setAttribute('class', 'FloatLeft50Div');
$thead = $doc->createElement('thead');
$tr = $doc->createElement('tr');
$th = $doc->createElement('th');
$a = $doc->createElement('a');
$a->appendChild($doc->createTextNode('ID'));
$th->appendChild($a);
$tr->appendChild($th);
$th = $doc->createElement('th');
$a = $doc->createElement('a');
$a->appendChild($doc->createTextNode('Course Name'));
$th->appendChild($a);
$tr->appendChild($th);
$th = $doc->createElement('th');
$a = $doc->createElement('a');
$a->appendChild($doc->createTextNode('Description'));
$th->appendChild($a);
$tr->appendChild($th);
$thead->appendChild($tr);
$table->appendChild($thead);
$tbody = $doc->createElement('tbody');
$tint = false;
$edit = NULL;
$highestID = 0;
try
{
//print_r(PDO::getAvailableDrivers());
$dbh = new PDO($dsn, $dbUserName, $dbPassWord, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
$dbh->beginTransaction();
$sth = $dbh->prepare("SELECT * FROM courses");
$count = 0;
if ($sth->execute())
{
while ($row = $sth->fetch(PDO::FETCH_ASSOC))
{
if (isset($_GET['id']))
if ($row['id'] === $_GET['id'])
$edit = $row;
$count++;
if ($row['id'] > $highestID)
$highestID = $row['id'];
$tr = $doc->createElement('tr');
if ($tint === true)
{
$tr->setAttribute('class', 'AlternateRow');
}
$td = $doc->createElement('td');
$rr = $doc->createElement('a');
$rr->setAttribute('href', "courseEditor.php?id=${row['id']}");
$rr->appendChild($doc->createTextNode($row['id']));
$td->appendChild($rr);
$tr->appendChild($td);
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($row['name']));
$tr->appendChild($td);
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($row['description']));
$tr->appendChild($td);
$tbody->appendChild($tr);
}
}
$table->appendChild($tbody);
$tableDiv->appendChild($table);
}
catch (Exception $e)
{
echo "Failed!" . $e->getMessage() . "\n";
}*/
if (isset($_GET['id']))
$edit = getCourseRowByID($_GET['id']);
else
$edit = NULL;
$highestID = getHighestCourseID();
$bodyDiv->appendChild(generateCourseTable($doc));
if (!($edit === NULL))
{
$editorDiv = $doc->createElement('div');
$editorDiv->setAttribute('id', 'CourseEditorDiv');
$form = $doc->createElement('form');
$form->setAttribute('action', 'courseEditor.php');
$form->setAttribute('method', 'post');
$label = $doc->createElement('H3');
$label->appendChild($doc->createTextNode("Course ID: " . $edit['id']));
$form->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'hidden');
$input->setAttribute('name', 'id');
$input->setAttribute('readonly', 'readonly');
$input->setAttribute('value', $edit['id']);
$form->appendChild($input);
$fieldSet = $doc->createElement('fieldset');
//$fieldSet->setAttribute('style', 'width:200px; max-width:300px;'); //margin-top:0.5em;');
$fieldSetDiv = $doc->createElement('div');
$label = $doc->createElement('label', 'Course Name:');
$label->setAttribute('for', 'name');
$label->setAttribute('class', 'CourseEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'name');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('required', 'required');
if (isset($edit['name']))
$input->setAttribute('value', $edit['name']);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
/*
$label = $doc->createElement('label', 'Description:');
$label->setAttribute('for', 'description');
$label->setAttribute('class', 'CourseEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'description');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('required', 'required');
if (isset($edit['description']))
$input->setAttribute('value', $edit['description']);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
*/
$label = $doc->createElement('label', 'Description:');
$label->setAttribute('for', 'description');
$label->setAttribute('class', 'CourseEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('textarea');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'description');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('rows', '6');
$input->setAttribute('required', 'required');
if (isset($edit['description']))
$input->appendChild($doc->createTextNode($edit['description']));
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$fieldSet->appendChild($fieldSetDiv);
$form->appendChild($fieldSet);
$input = $doc->createElement('input');
$input->setAttribute('type', 'reset');
$form->appendChild($input);
$input = $doc->createElement('input');
$input->setAttribute('type', 'submit');
$form->appendChild($input);
$editorDiv->appendChild($form);
$bodyDiv->appendChild($editorDiv);
}
else
{
$nextHighestID = $highestID + 1;
$editorDiv = $doc->createElement('div');
$editorDiv->setAttribute('id', 'CourseEditorDiv');
$editorDiv->setAttribute('class', 'sticky');
$form = $doc->createElement('form');
$form->setAttribute('action', 'courseEditor.php');
$form->setAttribute('method', 'post');
$input = $doc->createElement('input');
$input->setAttribute('type', 'hidden');
$input->setAttribute('value', 'Add');
$input->setAttribute('name', 'action');
$input->setAttribute('readonly', 'readonly');
$form->appendChild($input);
$label = $doc->createElement('H3');
$label->appendChild($doc->createTextNode("Add New Course"));
$form->appendChild($label);
$fieldSet = $doc->createElement('fieldset');
//$fieldSet->setAttribute('style', 'width:200px; max-width:300px;'); //margin-top:0.5em;');
$fieldSetDiv = $doc->createElement('div');
$fieldSet->appendChild($fieldSetDiv);
$label = $doc->createElement('label', 'Course ID:');
$label->setAttribute('for', 'id$');
$label->setAttribute('class', 'CourseEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'number');
$input->setAttribute('name', 'id');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('required', 'required');
$input->setAttribute('value', "$nextHighestID");
$input->setAttribute('min', "$nextHighestID");
$input->setAttribute('step', '1');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('label', 'Course Name:');
$label->setAttribute('for', 'name');
$label->setAttribute('class', 'CourseEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'name');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
/*
$label = $doc->createElement('label', 'Description:');
$label->setAttribute('for', 'description');
$label->setAttribute('class', 'CourseEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'description');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
*/
$label = $doc->createElement('label', 'Description:');
$label->setAttribute('for', 'description');
$label->setAttribute('class', 'CourseEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('textarea');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'description');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('rows', '6');
$input->setAttribute('required', 'required');
$input->appendChild($doc->createTextNode("")); /* a child node is needed to close the textarea */
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$form->appendChild($fieldSet);
$input = $doc->createElement('input');
$input->setAttribute('type', 'reset');
$form->appendChild($input);
$input = $doc->createElement('input');
$input->setAttribute('type', 'submit');
$form->appendChild($input);
$editorDiv->appendChild($form);
//$bodyDiv->appendChild($editorDiv);
$body->appendChild($editorDiv); // Needs to be in the body for sticky
}
$body->appendChild($bodyDiv);
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
echo $doc->saveXML();
}
else
generateIndexRedirect();
?>

88
courses.php Normal file
View File

@ -0,0 +1,88 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if ($_SESSION['login'] === TRUE)
{
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
//$body->appendChild(generateMemberNavigationBar($doc));
$body->appendChild(generateSelectedMenuBar($doc));
/* if (isset($_SESSION['FirstName']) && isset($_SESSION['LastName']))
{
if ($_SESSION['sub_nav'] === "Admin")
$body->appendChild(generateAdminNavigationBar($doc));
else
$body->appendChild(generateTrainingTable($doc, 'courses.php'));
} */
$body->appendChild(generateTrainingTable($doc, 'courses.php'));
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
echo $doc->saveXML();
}
?>

94
director-template.php Normal file
View File

@ -0,0 +1,94 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
//include_once "directorUtils.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE) && returnDirectorStatus($_SESSION['MemberID']))
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* Process form here
*/
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
$body->appendChild(generateMemberNavigationBar($doc));
$body->appendChild(generateDirectorNavigationBar($doc));
/*
* Insert content here.
*/
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
outputDoc($doc);
}
else
generateIndexRedirect();
?>

94
director.php Normal file
View File

@ -0,0 +1,94 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "directorUtils.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE) && returnDirectorStatus($_SESSION['MemberID']))
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* Process form here
*/
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
$body->appendChild(generateMemberNavigationBar($doc));
$body->appendChild(generateDirectorNavigationBar($doc));
/*
* Insert content here.
*/
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
echo $doc->saveXML();
}
else
generateIndexRedirect();
?>

130
index.php Normal file
View File

@ -0,0 +1,130 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
date_default_timezone_set($timeZone);
if (isset($_SESSION['cookieMonster']))
//if (true)
{
$doc = returnDoc();
$root = returnRoot($doc);
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
if (isset($_SESSION['login']))
if ($_SESSION['login'] === TRUE)
$body->appendChild(generateSelectedMenuBar($doc));
//$body->appendChild(generateMemberNavigationBar($doc));
//$body->appendChild($doc->createElement('hr'));
/*
* $welcome = $doc->createElement('div');
* $welcomeHeader = $doc->createElement('h3');
* $welcomeHeader->appendChild($doc->createTextNode('Welcome to the members database for Protospace'));
* $welcome->appendChild($welcomeHeader);
*
* $body->appendChild($welcome);
$body->appendChild(generateMenuList($doc, $baseDir, array (
array (
'index.php',
'My transactions' ),
array (
'login.php',
'Login for more options' ),
array (
'school.php',
'Classes, courses, seminars, events and fun for all!' ) )));
// $body->appendChild($welcome);*/
$bodyDiv = $doc->createElement('div');
$bodyDiv->setAttribute('id', 'BodyDiv');
$bodyDiv->appendChild(generateStatus($doc));
$briefTable = generateBriefTrainingTable($doc, 20);
if ($briefTable === FALSE)
{
}
else
$bodyDiv->appendChild($briefTable);
/*, array (
createCourseInfo("Monthly Cleanup and Group Lunch", 11257, "Sat, Jan 20, 9:30 AM", 11, 88),
createCourseInfo("New Members: Orientation and Basic Safety", 11245, "Sat, Jan 20, 2:00 PM", 11, 1),
createCourseInfo("Woodworking: Stationary Saws", 11266, "Sun, Jan 21, 12:00 PM", 5, 0),
createCourseInfo("Electronics: Creating PCBs with Free Software (Part 1)", 11261, "Sat, Jan 27, 10:00 AM", 8, 0),
createCourseInfo("Electronics: Creating PCBs with Free Software (Part 2)", 11262, "Sun, Jan 28, 10:00 AM", 8, 0),
createCourseInfo("Test: How to Donate!", 11258, "Wed, Jan 31, 11:45 PM", 1, 11) )));
*/
$body->appendChild($bodyDiv);
//$body->appendChild($doc->createElement('br'));
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
outputDoc($doc);
}
else
{
generateCookieMonster();
}
?>

143
ipn/PaypalIPN.php Normal file
View File

@ -0,0 +1,143 @@
<?php
class PaypalIPN
{
/** @var bool Indicates if the sandbox endpoint is used. */
private $use_sandbox = false;
/** @var bool Indicates if the local certificates are used. */
private $use_local_certs = false;
/** Production Postback URL */
const VERIFY_URI = 'https://ipnpb.paypal.com/cgi-bin/webscr';
/** Sandbox Postback URL */
const SANDBOX_VERIFY_URI = 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr';
/** Response from PayPal indicating validation was successful */
const VALID = 'VERIFIED';
/** Response from PayPal indicating validation failed */
const INVALID = 'INVALID';
/**
* Sets the IPN verification to sandbox mode (for use when testing,
* should not be enabled in production).
* @return void
*/
public function useSandbox()
{
$this->use_sandbox = true;
}
/**
* Sets curl to use php curl's built in certs (may be required in some
* environments).
* @return void
*/
public function usePHPCerts()
{
$this->use_local_certs = true;
}
/**
* Determine endpoint to post the verification data to.
*
* @return string
*/
public function getPaypalUri()
{
if ($this->use_sandbox) {
return self::SANDBOX_VERIFY_URI;
} else {
return self::VERIFY_URI;
}
}
/**
* Verification Function
* Sends the incoming post data back to PayPal using the cURL library.
*
* @return bool
* @throws Exception
*/
public function verifyIPN()
{
if ( ! count($_POST)) {
throw new Exception("Missing POST Data");
}
$raw_post_data = file_get_contents('php://input');
$raw_post_array = explode('&', $raw_post_data);
$myPost = array();
foreach ($raw_post_array as $keyval) {
$keyval = explode('=', $keyval);
if (count($keyval) == 2) {
// Since we do not want the plus in the datetime string to be encoded to a space, we manually encode it.
if ($keyval[0] === 'payment_date') {
if (substr_count($keyval[1], '+') === 1) {
$keyval[1] = str_replace('+', '%2B', $keyval[1]);
}
}
$myPost[$keyval[0]] = urldecode($keyval[1]);
}
}
// Build the body of the verification post request, adding the _notify-validate command.
$req = 'cmd=_notify-validate';
$get_magic_quotes_exists = false;
if (function_exists('get_magic_quotes_gpc')) {
$get_magic_quotes_exists = true;
}
foreach ($myPost as $key => $value) {
if ($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {
$value = urlencode(stripslashes($value));
} else {
$value = urlencode($value);
}
$req .= "&$key=$value";
}
// Post the data back to PayPal, using curl. Throw exceptions if errors occur.
$ch = curl_init($this->getPaypalUri());
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_SSLVERSION, 6);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
// This is often required if the server is missing a global cert bundle, or is using an outdated one.
if ($this->use_local_certs) {
curl_setopt($ch, CURLOPT_CAINFO, __DIR__ . "/cert/cacert.pem");
}
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'User-Agent: PHP-IPN-Verification-Script',
'Connection: Close',
));
$res = curl_exec($ch);
if ( ! ($res)) {
$errno = curl_errno($ch);
$errstr = curl_error($ch);
curl_close($ch);
throw new Exception("cURL error: [$errno] $errstr");
}
$info = curl_getinfo($ch);
$http_code = $info['http_code'];
if ($http_code != 200) {
throw new Exception("PayPal responded with http code $http_code");
}
curl_close($ch);
// Check if PayPal verifies the IPN data, and if so, return true.
if ($res == self::VALID) {
return true;
} else {
return false;
}
}
}
?>

423
ipn/ipn.php Normal file
View File

@ -0,0 +1,423 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
namespace Listener;
include_once '../consts.php';
include_once '../database.php';
// Set this to true to use the sandbox endpoint during testing:
$enable_sandbox = true;
// Use this to specify all of the email addresses that you have attached to paypal:
// $my_email_addresses = array("my_email_address@gmail.com", "my_email_address2@gmail.com", "my_email_address3@gmail.com");
// Set this to true to send a confirmation email:
$send_confirmation_email = false;
$confirmation_email_address = "My Name <my_email_address@gmail.com>";
$from_email_address = "My Name <my_email_address@gmail.com>";
// Set this to true to save a log file:
$save_log_file = true;
$log_file_dir = __DIR__ . "/logs";
require('PaypalIPN.php');
use PaypalIPN;
$ipn = new PaypalIPN();
date_default_timezone_set($timeZone);
// Use the sandbox endpoint during testing.
if ($enable_sandbox)
$ipn->useSandbox();
//$verified = $ipn->verifyIPN();
$verified = TRUE;
if ($verified)
{
/*
* Process IPN
* A list of variables is available here:
* https://developer.paypal.com/webapps/developer/docs/classic/ipn/integration-guide/IPNandPDTVariables/
*/
/*
if (isset($_POST['protection_eligibility']) && isset($_POST['payer_id']) &&
isset($_POST['payment_date']) && isset($_POST['payment_status']) &&
isset($_POST['first_name']) && isset($_POST['last_name']) &&
isset($_POST['notify_version']) && isset($_POST['verify_sign']) &&
isset($_POST['payer_email']) && isset($_POST['txn_id']) &&
isset($_POST['payment_type']) && isset($_POST['receiver_email']) &&
isset($_POST['receiver_id']) && isset($_POST['txn_type']))
{
if ($_POST['protection_eligibility'] === 'Eligible')
$protection_eligibility = TRUE;
else
$protection_eligibility = FALSE;
$payer_id = $_POST['payer_id'];
$payment_date = $_POST['payment_date'];
if ($_POST['payment_status'] === 'Completed')
$payment_status = TRUE;
else
$payment_status = FALSE;
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$notify_version = $_POST['notify_version'];
$verify_sign = $_POST['verify_sign'];
$payer_email = $_POST['payer_email'];
$txn_id = $_POST['txn_id'];
$payment_type = $_POST['payment_type'];
$receiver_email = $_POST['receiver_email'];
$receiver_id = $_POST['receiver_id'];
$txn_type = $_POST['txn_type'];
if (isset($_POST['mc_gross']))
$mc_gross = (float) $_POST['mc_gross'];
else
$mc_gross = (float) 0.0;
if (isset($_POST['address_status']) && $_POST['address_status'] === 'confirmed')
$address_status = TRUE;
else
$address_status = FALSE;
if (isset($_POST['tax']))
$tax = (float) $_POST['tax'];
else
$tax = (float) 0.00;
if (isset($_POST['address_street']))
$address_street = $_POST['address_street'];
else
$address_street = NULL;
if (isset($_POST['charset']))
$charset = $_POST['charset'];
else
$charset = 'utf-8';
if (isset($_POST['address_zip']))
$address_zip = $_POST['address_zip'];
else
$address_zip = NULL;
if (isset($_POST['mc_fee']))
$mc_fee = (float) $_POST['mc_fee'];
else
$mc_fee = (float) 0.0;
if (isset($_POST['address_country_code']))
$address_country_code = $_POST['address_country_code'];
else
$address_country_code = 'CA';
if (isset($_POST['address_name']))
$address_name = $_POST['address_name'];
else
$address_name = NULL;
if (isset($_POST['cusom']))
$custom = $_POST['custom'];
else
$custom = NULL;
if (isset($_POST['payer_satus']) && $_POST['payer_satus'] === 'verified')
$payer_status = TRUE;
else
$payer_status = FALSE;
if (isset($_POST['address_country']))
$address_country = $_POST['address_country'];
else
$address_country = NULL;
if (isset($_POST['address_city']))
$address_city = $_POST['address_city'];
else
$address_city = NULL;
if (isset($_POST['quantity']))
$quantity = (int) $_POST['quantity'];
else
$quantity = (int) -1;
if (isset($_POST['address_state']))
$address_state = $_POST['address_state'];
else
$address_state = NULL;
if (isset($_POST['payment_fee']))
$payment_fee = (float) $_POST['payment_fee'];
else
$payment_fee = (float) 0.00;
if (isset($_POST['item_name']))
$item_name = $_POST['item_name'];
else
$item_name = NULL;
if (isset($_POST['mc_currency']))
$mc_currency = $_POST['mc_currency'];
else
$mc_currency = 'CAD';
if (isset($_POST['item_number']))
$item_number = $_POST['item_number'];
else
$item_number = NULL;
if (isset($_POST['residence_country']))
$residence_country = $_POST['residence_country'];
else
$residence_country = 'CA';
if (isset($_POST['test_ipn']))
$test_ipn = $_POST['test_ipn'];
else
$test_ipn = NULL;
if (isset($_POST['handling_amount']))
$handling_amount = (float) $_POST['handling_amount'];
else
$handling_amount = (float) 0.00;
if (isset($_POST['transaction_subject']))
$transaction_subject = $_POST['transaction_subject'];
else
$transaction_subject = NULL;
if (isset($_POST['payment_gross']))
$payment_gross = (float) $_POST['payment_gross'];
else
$payment_gross = (float) 0.00;
if (isset($_POST['shipping']))
$shipping = $_POST['shipping'];
else
$shippling = (float) 0.00;
$ipnID = receiveInstantPaypalNotification($item_name, $item_number, (int) $quantity,
$mc_currency, $mc_gross, $mc_fee, $payment_type, $payment_date,
$payment_gross, $payment_fee, $shipping, $handling_amount, $tax,
$payment_status, $protection_eligibility, $payer_id, $payer_email,
$first_name, $last_name, $address_street, $address_city, $address_state,
$address_country, $address_country_code, $address_zip, $address_status,
$address_name, $payer_status, $residence_country, $receiver_id,
$receiver_email, $transaction_subject, $custom, $charset, $txn_id,
$txn_type, $notify_version, $verify_sign, $test_ipn);
processInstantPaypalNotification($ipnID);
}
*/
/*
* Attempt number 2
*/
$data = file_get_contents('php://input');
if (isset($_POST['txn_type']) && isset($_POST['verify_sign']) && ($data !== FALSE))
{
$txn_type = $_POST['txn_type'];
$verify_sign = $_POST['verify_sign'];
if (isset($_POST['txn_id']))
$txn_id = $_POST['txn_id'];
else
$txn_id = NULL;
$ipnID = receiveInstantPaypalNotification($txn_type, $txn_id, $verify_sign, $data);
//print ("ipnID: $ipnID");
if (isset($_POST['payer_id']))
$payer_id = $_POST['payer_id'];
else
$payer_id = NULL;
if (isset($_POST['payment_date']))
$payment_date = date_format(date_create($_POST['payment_date']), $dbDateTimeFormat);
else
$payment_date = NULL;
if (isset($_POST['payment_status']))
$payment_status = $_POST['payment_status'];
else
$payment_status = NULL;
if (isset($_POST['first_name']))
$first_name = $_POST['first_name'];
else
$first_name = NULL;
if (isset($_POST['last_name']))
$last_name = $_POST['last_name'];
else
$last_name = NULL;
if (isset($_POST['payer_email']))
$payer_email = $_POST['payer_email'];
else
$payer_email = NULL;
if (isset($_POST['mc_currency']))
$mc_currency = $_POST['mc_currency'];
else
$mc_currency = NULL;
if (isset($_POST['mc_gross']))
$mc_gross = $_POST['mc_gross'];
else
$mc_gross = NULL;
if (isset($_POST['mc_fee']))
$mc_fee = $_POST['mc_fee'];
else
$mc_fee = NULL;
if (isset($_POST['address_street']))
$address_street = $_POST['address_street'];
else
$address_street = NULL;
if (isset($_POST['address_city']))
$address_city = $_POST['address_city'];
else
$address_city = NULL;
if (isset($_POST['address_state']))
$address_state = $_POST['address_state'];
else
$address_state = NULL;
if (isset($_POST['address_country']))
$address_country = $_POST['address_country'];
else
$address_country = NULL;
if (isset($_POST['address_country_code']))
$address_country_code = $_POST['address_country_code'];
else
$address_country_code = NULL;
if (isset($_POST['address_zip']))
$address_zip = $_POST['address_zip'];
else
$address_zip = NULL;
if (isset($_POST['address_country']))
$address_country = $_POST['address_country'];
else
$address_country = NULL;
if (isset($_POST['contact_phone']))
$contact_phone = $_POST['contact_phone'];
else
$contact_phone = NULL;
if (isset($_POST['custom']))
$custom = $_POST['custom'];
else
$custom = NULL;
if (isset($_POST['receipt_id']))
$receipt_id = $_POST['receipt_id'];
else
$receipt_id = NULL;
if (isset($_POST['payer_status']))
$payer_status = $_POST['payer_status'];
else
$payer_status = NULL;
if (isset($_POST['quantity']))
$quantity = $_POST['quantity'];
else
$quantity = NULL;
if (isset($_POST['payment_type']))
$payment_type = $_POST['payment_type'];
else
$payment_type = NULL;
if (isset($_POST['receiver_email']))
$receiver_email = $_POST['receiver_email'];
else
$receiver_email = NULL;
if (isset($_POST['receiver_id']))
$receiver_id = $_POST['receiver_id'];
else
$receiver_id = NULL;
if (isset($_POST['item_name']))
$item_name = $_POST['item_name'];
else
$item_name = NULL;
if (isset($_POST['item_number']))
$item_number = $_POST['item_number'];
else
$item_number = NULL;
if (isset($_POST['residence_country']))
$residence_country = $_POST['residence_country'];
else
$residence_country = NULL;
if (isset($_POST['charset']))
$charset = $_POST['charset'];
else
$charset = NULL;
if (isset($_POST['transaction_subject']))
$transaction_subject = $_POST['transaction_subject'];
else
$transaction_subject = NULL;
if (isset($_POST['memo']))
$memo = $_POST['memo'];
else
$memo = NULL;
if (isset($_POST['test_ipn']))
$test_ipn = $_POST['test_ipn'];
else
$test_ipn = NULL;
if (isset($_POST['notify_version']))
$notify_version = $_POST['notify_version'];
else
$notify_version = NULL;
if (isset($_POST['parent_txn_id']))
$parent_txn_id = $_POST['parent_txn_id'];
else
$parent_txn_id = NULL;
if (isset($_POST['initial_payment_txn_id']))
$initial_payment_txn_id = $_POST['initial_payment_txn_id'];
else
$initial_payment_txn_id = NULL;
if (isset($_POST['recurring_payment_id']))
$recurring_payment_id = $_POST['recurring_payment_id'];
else
$recurring_payment_id = NULL;
/* if (isset($_POST['address_country']))
$address_country = $_POST['address_country'];
else
$address_country = NULL;*/
insertInstantPaypalNotificationData($ipnID, $payer_id, $payment_date,
$payment_status, $first_name, $last_name, $payer_email, $mc_currency,
$mc_gross, $mc_fee, $address_street, $address_city, $address_country,
$address_state, $address_country_code, $address_zip, $contact_phone,
$custom, $receipt_id, $payer_status, $quantity, $payment_type,
$receiver_email, $receiver_id, $item_name, $item_number,
$residence_country, $charset, $transaction_subject, $memo, $test_ipn,
$notify_version, $parent_txn_id, $initial_payment_txn_id, $recurring_payment_id);
}
}
// Reply with an empty 200 response to indicate to paypal the IPN was received correctly.
header("HTTP/1.1 200 OK");
?>

128
licence.php Normal file
View File

@ -0,0 +1,128 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "adminUtils.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE) && returnAdminStatus($_SESSION['MemberID']))
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* Process form here
*/
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
$_SESSION['subNav'] = NULL;
$body->appendChild(generateSelectedMenuBar($doc));
/*
* Insert content here.
*/
$copyRight00 = "Copyright 2018 Murray Hayes";
$copyRight01 = "Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:";
$copyRight02 = "1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.";
$copyRight03 = "2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.";
$copyRight04 = "3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.";
$copyRight05 = 'THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.';
$p = createP($doc);
$p->appendChild($doc->createTextNode($copyRight00));
$body->appendChild($p);
$p = createP($doc);
$p->appendChild($doc->createTextNode($copyRight01));
$body->appendChild($p);
$p = createP($doc);
$p->appendChild($doc->createTextNode($copyRight02));
$body->appendChild($p);
$p = createP($doc);
$p->appendChild($doc->createTextNode($copyRight03));
$body->appendChild($p);
$p = createP($doc);
$p->appendChild($doc->createTextNode($copyRight04));
$body->appendChild($p);
$p = createP($doc);
$p->appendChild($doc->createTextNode($copyRight05));
$body->appendChild($p);
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
outputDoc($doc);
}
else
generateIndexRedirect();
?>

135
login.php Normal file
View File

@ -0,0 +1,135 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "text.php";
if (isset($_SESSION['cookieMonster']))
//if (true)
{
if (isset($_POST['username']) && isset($_POST['password']))
{
if (validatePassword(cleanInput($_POST['username']), cleanInput($_POST['password'])))
{
$_SESSION['login'] = TRUE;
$_SESSION['lastSessionRefresh'] = time();
$names = explode('.', $_POST['username']);
$memberID = returnIdFromUsername($_POST['username']);
populateSessionFromMemberID($memberID);
//$_SESSION['FirstName'] = $names[0];
//$_SESSION['LastName'] = $names[1];
if ($memberID === FALSE)
{
unsetSession();
}
else
{
$_SESSION['MemberID'] = $memberID;
if ($memberTrackAddrChange)
{
updateMemberRemoteAddr($_SERVER['REMOTE_ADDR']);
}
}
}
else
{
print ($text0010);
unsetSession();
}
}
$doc = returnDoc();
$root = returnRoot($doc);
$doc->appendChild($root);
if (!isset($_SESSION['login']) || ($_SESSION['login'] === FALSE))
{
$root->appendChild(generateHead($doc));
$_SESSION['login'] = FALSE;
}
else
{
$meta = $doc->createElement('meta');
$meta->setAttribute('http-equiv', 'refresh');
//$meta->setAttribute('content', '0;' . $_SERVER['PHP_SELF'] . "?cookieCheck=true");
//$meta->setAttribute('content', '0;https://' . $siteDomain . $baseDir . $memberDir . "members.php");
/*
* This isn't needed anymore because I setup https on localhost and defined
* zombies in the hosts file.
if ($localHost)
$meta->setAttribute('content', '0;http://localhost' . $baseDir . $memberDir . "member.php");
else
$meta->setAttribute('content', '0;https://' . $siteDomain . $baseDir . $memberDir . "member.php");
*/
$meta->setAttribute('content', '0;https://' . $siteDomain . $baseDir . $memberDir . "member.php");
$root->appendChild(generateHead($doc, $meta));
}
$body = $doc->createElement('body');
$body->appendChild(generateMastHead($doc, $baseDir));
if ($_SESSION['login'] === FALSE)
{
$badPass = $doc->createElement('h3');
$badPass->appendChild($doc->createTextNode($text0010));
$body->appendChild($badPass);
/*
$badPass = $doc->createElement('h5');
$badPass->appendChild($doc->createTextNode($_POST['username'] . " " . $_POST['password']));
$body->appendChild($badPass);*/
}
$body->appendChild(generateLoginForm($doc));
$body->appendChild(createAnchor($doc, 'password-reset.php', $text0012));
$body->appendChild(generateFooter($doc));
$root->appendChild($body);
outputDoc($doc);
}
else
generateCookieMonster();
?>

96
logout.php Normal file
View File

@ -0,0 +1,96 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
if (isset($_SESSION['cookieMonster']))
//if (true)
{
if (isset($_SESSION['login']))
{
if (isset($_SESSION['MemberID']))
{
if ($memberTrackAddrChange)
updateMemberRemoteAddr(NULL);
}
unsetSession();
}
$doc = returnDoc();
$root = returnRoot($doc);
$doc->appendChild($root);
$meta = $doc->createElement('meta');
$meta->setAttribute('http-equiv', 'refresh');
//$meta->setAttribute('content', '0;' . $_SERVER['PHP_SELF'] . "?cookieCheck=true");
//$meta->setAttribute('content', '0;https://' . $siteDomain . $baseDir . $memberDir . "members.php");
/*
* This isn't needed anymore because I set up https on the localhost and defined
* zombies in the hosts file.
if ($localHost)
$meta->setAttribute('content', '0;http://localhost' . $baseDir);
else
$meta->setAttribute('content', '0;https://' . $siteDomain . $baseDir);
*/
$meta->setAttribute('content', '0;https://' . $siteDomain . $baseDir);
$root->appendChild(generateHead($doc, $meta));
$body = $doc->createElement('body');
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild(generateLoginForm($doc));
$body->appendChild(generateFooter($doc));
$root->appendChild($body);
outputDoc($doc);
}
else
generateCookieMonster();
?>

86
member.php Normal file
View File

@ -0,0 +1,86 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if ($_SESSION['login'] === TRUE)
{
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
//$body->appendChild(generateMemberNavigationBar($doc));
//$body->appendChild(generateNewNavigationBar($doc));
$_SESSION['subNav'] = NULL;
$body->appendChild(generateSelectedMenuBar($doc));
if (isset($_SESSION['FirstName']) && isset($_SESSION['LastName']))
$body->appendChild(generateMemberDetailReport($doc));
$body->appendChild(generateMemberReport($doc));
$body->appendChild(generateFooter($doc));
outputDoc($doc);
}
?>

810
memberEditor.php Normal file
View File

@ -0,0 +1,810 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "adminUtils.php";
include_once "formUtils.php";
include_once "sql.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE) &&
(returnAdminStatus($_SESSION['MemberID']) || returnDirectorStatus($_SESSION['MemberID'])))
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* validate form data.
*/
if (isset($_POST['id']))
try
{
//print_r(PDO::getAvailableDrivers());
$dbh = returnDatabaseHandel();
//$dbh->beginTransaction();
//$sth = $dbh->prepare("SELECT * FROM members WHERE id = ?");
$sth = $dbh->prepare($statement204);
$count = 0;
if ($sth->execute(array($_POST['id'])))
{
if ($row = $sth->fetch(PDO::FETCH_ASSOC))
{
if (($row['first_name'] === $_POST['first_name']) && ($row['last_name'] === $_POST['last_name']))
{
//print_r($_POST);
if (isset($_POST['Vet_Now']) && ($_POST['Vet_Now'] === "Vet Now"))
{
//print ("Vetting...");
$stb = $dbh->prepare($statement287);
$stb->execute(array($_POST['id'], $_POST['first_name'], $_POST['last_name']));
}
else
{
/*
* All optional variable need to be checked.
*/
if (isset($_POST['current_start']))
$currStart = $_POST['current_start'];
else
if (isset($row['current_start_date']))
$currStart = $row['current_start_date'];
else
$currStart = "";
if (isset($_POST['street_address']))
$streetAddr = $_POST['street_address'];
else
if (isset($row['street_address']))
$streetAddr = $row['street_address'];
else
$streetAddr = "";
if (isset($_POST['guardian']))
$guardian = $_POST['guardian'];
else
$guardian = "";
if (isset($_POST['emergency_contact_name']))
$emergContactName = $_POST['emergency_contact_name'];
else
$emergContactName = "";
if (isset($_POST['emergency_contact_number']))
$emergContactNumber = $_POST['emergency_contact_number'];
else
$emergContactNumber = "";
if (isset($_POST['instructor']))
$instCheck = TRUE;
else
$instCheck = FALSE;
if (isset($_POST['administrator']))
$adminCheck = TRUE;
else
$adminCheck = FALSE;
if (isset($_POST['director']))
$dirCheck = TRUE;
else
$dirCheck = FALSE;
if (isset($_POST['minor']))
$minorCheck = TRUE;
else
$minorCheck = FALSE;
/*
$sth = $dbh->prepare("UPDATE members SET preferred_name = ?, nickname = ?, email = ?, expire_date = ?, " .
"current_start_date = ?, application_date = ?, status = ?, monthly_fees = ?, proto_cash = ?, " .
"minor = ?, birthdate = ?, guardian_name = ?, street_address = ?, city = ?, province = ?, " .
"postal_code = ?, phone = ?, emergency_contact_name = ?, emergency_contact_phone = ?, " .
"new_member_notes = ?, instructor = ?, administrator = ?, director = ? WHERE id = ? AND first_name = ? " .
"AND last_name = ?");
*/
//print ("curr start: " . $currStart);
$sth = $dbh->prepare($statement222);
$sth->execute(array($_POST['prefered_name'], $_POST['nick_name'], $_POST['email'], $_POST['expire'],
$currStart, $_POST['application_date'], $_POST['status'], $_POST['monthly_fees'],
$_POST['proto_cash'], $minorCheck, $_POST['birth_date'], $_POST['guardian'], $streetAddr,
$_POST['city'], $_POST['province'], $_POST['postal_code'], $_POST['phone'], $emergContactName,
$emergContactNumber, $_POST['member_notes'], $instCheck, $adminCheck,
$dirCheck, $row['id'], $row['first_name'], $row['last_name']));
}
}
}
}
}
catch (Exception $e)
{
print ("Fail! " . $e->getMessage() . "\n");
}
}
else
if ($_SERVER['REQUEST_METHOD'] === 'GET')
{
/** TODO:
* validate this input
*/
if (isset($_GET['id']))
$edit = $_GET['id'];
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
/*
$body->appendChild(generateMemberNavigationBar($doc));
$body->appendChild(generateAdminNavigationBar($doc));
$_SESSION['sub_nav'] = "Admin";*/
$_SESSION['subNav'] = 1;
$body->appendChild(generateSelectedMenuBar($doc, 1));
if (isset($edit))
$body->appendChild(generateMemberEditor($doc, $edit));
$tableDiv = $doc->createElement('div');
//$tableDiv->setAttribute('display', 'block');
$tableDiv->setAttribute('class', 'FloatLeft50Div');
$table = $doc->createElement('table');
//$table.setAttribute('class'
//$table->setAttribute('class', 'FloatLeft50Div');
$thead = $doc->createElement('thead');
$tr = $doc->createElement('tr');
$th = $doc->createElement('th');
$a = $doc->createElement('a');
$a->appendChild($doc->createTextNode('ID'));
$th->appendChild($a);
$tr->appendChild($th);
$th = $doc->createElement('th');
$a = $doc->createElement('a');
$a->appendChild($doc->createTextNode('First Name'));
$th->appendChild($a);
$tr->appendChild($th);
$th = $doc->createElement('th');
$a = $doc->createElement('a');
$a->appendChild($doc->createTextNode('Last Name'));
$th->appendChild($a);
$tr->appendChild($th);
$th = $doc->createElement('th');
$th->appendChild($doc->createTextNode('Vetted'));
$tr->appendChild($th);
$th = $doc->createElement('th');
$th->appendChild($doc->createTextNode('Status'));
$tr->appendChild($th);
$thead->appendChild($tr);
$table->appendChild($thead);
$tbody = $doc->createElement('tbody');
$tint = false;
$edit = NULL;
try
{
//print_r(PDO::getAvailableDrivers());
$dbh = returnDatabaseHandel();
$dbh->beginTransaction();
//$sth = $dbh->prepare("SELECT * FROM members"); /* SORT BY first_name;*/
$sth = $dbh->prepare($statement101);
$count = 0;
if ($sth->execute())
{
while ($row = $sth->fetch(PDO::FETCH_ASSOC))
{
if (isset($_GET['id']))
if ($row['id'] === $_GET['id'])
$edit = $row;
$count++;
$tr = $doc->createElement('tr');
/*
if ($tint === true)
{
$tr->setAttribute('class', 'AlternateRow');
}*/
/*
try
{
$stg = $dbh->prepare("SELECT name FROM courses WHERE id = ?");
if ($stg->execute(array($row['course_id'])))
{
$innerRow = $stg->fetch(PDO::FETCH_ASSOC);
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($innerRow['name']));
$tr->appendChild($td);
}
}
catch (Exception $f)
{
echo "Fail! " . $f->getMessage() . "\n";
}
*/
/*
$tint = !$tint;
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($course['Subject']));
$tr->appendChild($td);*/
$td = $doc->createElement('td');
$rr = $doc->createElement('a');
$rr->setAttribute('href', "memberEditor.php?id=${row['id']}");
$rr->appendChild($doc->createTextNode($row['id']));
$td->appendChild($rr);
$tr->appendChild($td);
/*
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($row['id']));
$tr->appendChild($td);*/
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($row['first_name']));
$tr->appendChild($td);
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($row['last_name'])); //$row['Confirmed']));
$tr->appendChild($td);
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode($row['vetted_date'])); //$course['Open']));
$tr->appendChild($td);
$td = $doc->createElement('td');
$td->appendChild($doc->createTextNode(returnMemberStatusByID($row['id']))); //$course['Open']));
$tr->appendChild($td);
/* $rr = $doc->createElement('a');
$rr->setAttribute('href', "admin.php?id=${row['id']}");
$rr->appendChild($tr);*/
$tbody->appendChild($tr);
}
}
$table->appendChild($tbody);
$tableDiv->appendChild($table);
$body->appendChild($tableDiv);
}
catch (Exception $e)
{
echo "Failed!" . $e->getMessage() . "\n";
}
if (!($edit === NULL))
{
$editorDiv = $doc->createElement('div');
$editorDiv->setAttribute('id', 'MemberEditorDiv');
$titleSpan = createSpan($doc);
$label = $doc->createElement('H3');
$label->appendChild($doc->createTextNode($edit['first_name'] . " " . $edit['middle_name'] . " " . $edit['last_name']));
$picture = returnPictureForMember($edit['id']);
if (!is_null($picture))
{
$img = createImg($doc, $pictureDir . $picture, $edit['first_name'] . " " . $edit['last_name'], "MemberEditorIconPicture");
$label->appendChild($img);
}
$titleSpan->appendChild($label);
$editorDiv->appendChild($titleSpan);
$form = createForm($doc, 'password-reset.php', 'GET');
$input = createHiddenInput($doc, 'id', (string)$edit['id'], NULL, NULL, TRUE);
$form->appendChild($input);
$input = createSubmitInput($doc, $text0012, $text0012, NULL, NULL);
$form->appendChild($input);
$editorDiv->appendChild($form);
$form = createForm($doc, 'addPicture.php', 'POST');
$input = createHiddenInput($doc, 'target', (string)$edit['id'], NULL, NULL, TRUE);
$form->appendChild($input);
$input = createSubmitInput($doc, 'Change Picture', 'Change Picture');
$form->appendChild($input);
$editorDiv->appendChild($form);
/*
$form = $doc->createElement('form');
$form->setAttribute('action', 'admin.php');
$form->setAttribute('method', 'post');
*/
$form = createForm($doc, 'admin.php');
$input = createHiddenInput($doc, 'id', $edit['id'], NULL, NULL, TRUE);
$form->appendChild($input);
$input = createHiddenInput($doc, 'first_name', $edit['first_name'], NULL, NULL, TRUE);
$form->appendChild($input);
$input = createHiddenInput($doc, 'last_name', $edit['last_name'], NULL, NULL, TRUE);
$form->appendChild($input);
$fieldSet = $doc->createElement('fieldset');
//$fieldSet->setAttribute('style', 'width:200px; max-width:300px;'); //margin-top:0.5em;');
$fieldSetDiv = $doc->createElement('div');
$label = $doc->createElement('label', 'Prefered Name:');
$label->setAttribute('for', 'prefered_name');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'prefered_name');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['prefered_name']))
$input->setAttribute('value', $edit['prefered_name']);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Nick Name:');
$label->setAttribute('for', 'nick_name');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'nick_name');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['nick_name']))
$input->setAttribute('value', $edit['nick_name']);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'EMail Address:');
$label->setAttribute('for', 'email');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'email');
$input->setAttribute('name', 'email');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('class', 'MemberEditorInputField');
if (isset($edit['email']))
$input->setAttribute('value', $edit['email']);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Expiration Date:');
$label->setAttribute('for', 'expire');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'date');
$input->setAttribute('name', 'expire');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['expire_date']))
$input->setAttribute('value', $edit['expire_date']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Current Start Date:');
$label->setAttribute('for', 'current_start');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'date');
$input->setAttribute('name', 'current_start');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['current_start_date']))
$input->setAttribute('value', $edit['current_start_date']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Application Date:');
$label->setAttribute('for', 'application_date');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'date');
$input->setAttribute('name', 'application_date');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['application_date']))
$input->setAttribute('value', $edit['application_date']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Vetted Date:');
$label->setAttribute('for', 'vetted');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$now = date_create('now');
$startDate = date_create($edit['current_start_date']); //, $dbDateFormat);
$startDate = date_add($startDate, DateInterval::createFromDateString('4 weeks'));
$expireDate = date_create($edit['expire_date']);
if (isset($edit['vetted_date']))
{
if (is_null($edit['vetted_date']))
{
if (($startDate < $now) && ($now < $expireDate))
{
$input = createSubmitInput($doc, 'Vet Now', 'Vet Now');
$fieldSetDiv->appendChild($input);
}
else
{
$input = createSubmitInput($doc, 'Not Vetable', 'Not Vetable');
$fieldSetDiv->appendChild($input);
}
}
else
{
$input = $doc->createElement('input');
$input->setAttribute('type', 'date');
$input->setAttribute('name', 'vetted');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['vetted_date']))
$input->setAttribute('value', $edit['vetted_date']);
//$input->setAttribute('required', 'required');
$input->setAttribute('readonly', 'readonly');
}
$fieldSetDiv->appendChild($input);
}
else
{
if (($startDate < $now) && ($now < $expireDate))
{
$input = createSubmitInput($doc, 'Vet Now', 'Vet Now');
$fieldSetDiv->appendChild($input);
}
else
{
$input = createSubmitInput($doc, 'Not Vetable', 'Not Vetable');
$fieldSetDiv->appendChild($input);
}
}
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Status:');
$label->setAttribute('for', 'status');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'status');
//$input->setAttribute('autocomplete', 'off');
if (isset($edit['status']))
$input->setAttribute('value', $edit['status']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Monthly Fees:');
$label->setAttribute('for', 'monthly_fees');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'number');
$input->setAttribute('name', 'monthly_fees');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('step', '0.01');
$input->setAttribute('pattern', '^\d+(\.|\,)\d{2}$');
if (isset($edit['monthly_fees']))
$input->setAttribute('value', $edit['monthly_fees']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Protospace Cash:');
$label->setAttribute('for', 'proto_cash');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'number');
$input->setAttribute('name', 'proto_cash');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['proto_cash']))
$input->setAttribute('value', $edit['proto_cash']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Minor:');
$label->setAttribute('for', 'minor');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'checkbox');
$input->setAttribute('name', 'minor');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['minor']))
$input->setAttribute('checked', 'checked');
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Birth Date:');
$label->setAttribute('for', 'birth_date');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'date');
$input->setAttribute('name', 'birth_date');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['birth_date']))
$input->setAttribute('value', $edit['birth_date']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Guardian:');
$label->setAttribute('for', 'guardian');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'guardian');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['guardian']))
$input->setAttribute('value', $edit['guardian']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Street Address:');
$label->setAttribute('for', 'address');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'address');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['street_address']))
$input->setAttribute('value', $edit['street_address']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'City:');
$label->setAttribute('for', 'city');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'city');
//$input->setAttribute('autocomplete', 'off');
if (isset($edit['city']))
$input->setAttribute('value', $edit['city']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Province:');
$label->setAttribute('for', 'province');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'province');
//$input->setAttribute('autocomplete', 'off');
if (isset($edit['province']))
$input->setAttribute('value', $edit['province']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Postal Code:');
$label->setAttribute('for', 'postal_code');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'postal_code');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['postal_code']))
$input->setAttribute('value', $edit['postal_code']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Phone:');
$label->setAttribute('for', 'phone');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'phone');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['phone']))
$input->setAttribute('value', $edit['phone']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Emergency Contact Name:');
$label->setAttribute('for', 'emergency_name');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'emergency_name');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['emergency_contact_name']))
$input->setAttribute('value', $edit['emergency_contact_name']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Emergency Contact Number:');
$label->setAttribute('for', 'emergency_number');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'emergency_number');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['emergency_contact_number']))
$input->setAttribute('value', $edit['emergency_contact_number']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Instructor:');
$label->setAttribute('for', 'instructor');
$label->setAttribute('class', 'MemberEditorInputLabelTight');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'checkbox');
$input->setAttribute('name', 'instructor');
$input->setAttribute('class', 'MemberEditorInputFieldTight');
$input->setAttribute('autocomplete', 'off');
if (returnInstructorStatus($edit['id']))
$input->setAttribute('checked', 'checked');
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('label', 'Administrator:');
$label->setAttribute('for', 'administrator');
$label->setAttribute('class', 'MemberEditorInputLabelTight');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'checkbox');
$input->setAttribute('name', 'administrator');
$input->setAttribute('class', 'MemberEditorInputFieldTight');
$input->setAttribute('autocomplete', 'off');
if (returnAdminStatus($edit['id']))
$input->setAttribute('checked', 'checked');
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('label', 'Director:');
$label->setAttribute('for', 'director');
$label->setAttribute('class', 'MemberEditorInputLabelTight');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'checkbox');
$input->setAttribute('name', 'director');
$input->setAttribute('class', 'MemberEditorInputFieldTight');
$input->setAttribute('autocomplete', 'off');
if (returnDirectorStatus($edit['id']))
$input->setAttribute('checked', 'checked');
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('label', 'Member Notes:');
$label->setAttribute('for', 'member_notes');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'textarea');
$input->setAttribute('name', 'member_notes');
$input->setAttribute('rows', '3');
$input->setAttribute('autocomplete', 'off');
if (isset($edit['member_notes']))
$input->setAttribute('value', $edit['member_notes']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$fieldSet->appendChild($fieldSetDiv);
$form->appendChild($fieldSet);
$input = $doc->createElement('input');
$input->setAttribute('type', 'reset');
$form->appendChild($input);
$input = $doc->createElement('input');
$input->setAttribute('type', 'submit');
$form->appendChild($input);
$editorDiv->appendChild($form);
$body->appendChild($editorDiv);
}
$body->appendChild(generateFooter($doc));
outputDoc($doc);
}
else
generateIndexRedirect();
?>

118
memberList.php Normal file
View File

@ -0,0 +1,118 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE)) // && returnAdminStatus($_SESSION['MemberID']))
{
if ($_SERVER['REQUEST_METHOD'] == 'GET')
{
if (isset($_GET['search']))
{
}
}
$doc = new DOMDocument('1.0');
$root = $doc->createElement('html');
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
$_SESSION['subNav'] = NULL;
$body->appendChild(generateSelectedMenuBar($doc));
//$body->appendChild(generateMemberNavigationBar($doc));
/*
* Insert content here.
*/
/*
$searchDiv = $doc->createElement('div');
$searchDiv->setAttribute('class', 'memberListSearch');
$searchForm = $doc->createElement('form');
$searchForm->setAttribute('action', 'memberList.php');
$searchForm->setAttribute('method', 'get');
$label = $doc->createElement('H3');
$label->appendChild($doc->createTextNode('Member Name: '));
$searchForm->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'search');
$searchForm->appendChild($input);
$input = $doc->createElement('input');
$input->setAttribute('type', 'submit');
$input->setAttribute('value', 'Search');
$searchForm->appendChild($input);
$searchDiv->appendChild($searchForm);
$body->appendChild($searchDiv);
*/
$body->appendChild(generateMemberSearchForm($doc, "memberList.php"));
$body->appendChild(generateMemberTableWithPictures($doc));
$body->appendChild(generateFooter($doc));
outputDoc($doc);
}
else
generateIndexRedirect();
?>

117
memberMeeting.php Normal file
View File

@ -0,0 +1,117 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "directorUtils.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE) && returnDirectorStatus($_SESSION['MemberID']))
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* Process form here
*/
if (isset($_POST['NewMeeting']))
if (isset($_POST['meeting_datetime']))
createMeeting($_POST['meeting_datetime'] . " 19:03:14");
else
createMeeting(date("y-m-d") . " 19:03:14");
else
if (isset($_POST['SelectMembers']) && isset($_POST['meeting']))
{
//print ("Selecting Members");
insertIntoMeetingAttendanceTable((int) $_POST['meeting']);
}
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
/*
$body->appendChild(generateMemberNavigationBar($doc));
$body->appendChild(generateDirectorNavigationBar($doc));
*/
$body->appendChild(generateSelectedMenuBar($doc, 2));
/*
* Insert content here.
*/
$body->appendChild(generateMeetingAttendance($doc));
/* if ($_SERVER['REQUEST_METHOD'] === 'GET')
{
if (isset($_GET['search']))
{
$body->appendChild(generateMemberSelection($doc, "memberMeeting.php"));
}
}*/
//$body->appendChild(generateMemberSelection($doc, "memberMeeting.php", "useStatement230"));
$body->appendChild(generateFooter($doc));
outputDoc($doc);
}
else
generateIndexRedirect();
?>

40
members-protospace-ca.svg Normal file
View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
id="svg4733"
viewBox="0 0 477.32422 38.710938"
height="10.925087mm"
width="134.7115mm">
<defs
id="defs4735" />
<metadata
id="metadata4738">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(-126.48995,-99.114441)"
id="layer1">
<text
id="text5281"
y="129.50507"
x="122.85714"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="129.50507"
x="122.85714"
id="tspan5283">members.protospace.ca</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="svg4733"
viewBox="0 0 477.32422 38.710938"
height="10.925087mm"
width="134.7115mm"
inkscape:version="0.91 r13725"
sodipodi:docname="members-protospace-ca2.svg">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1266"
inkscape:window-height="540"
id="namedview4208"
showgrid="false"
inkscape:zoom="1.740955"
inkscape:cx="238.66211"
inkscape:cy="19.355469"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="svg4733" />
<defs
id="defs4735" />
<metadata
id="metadata4738">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(-126.48995,-99.114441)"
id="layer1"
style="fill:#ff0000">
<text
id="text5281"
y="129.50507"
x="122.85714"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="129.50507"
x="122.85714"
id="tspan5283"
style="fill:#ff0000">members.protospace.ca</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

416
members.css Normal file
View File

@ -0,0 +1,416 @@
@CHARSET "UTF-8";
html {
margin: 0;
padding: 0;
}
body {
/*
font: 755 georgia, sans-serif;
line-height: 1.0; */
//color: #1010FF;
color: #EEEEEE;
//background: #FFFFFF;
background: #010101;]
margin: 0;
padding: 0;
}
p {
margin-top: 0;
text-align: inherit;
}
a:link {
font-weight: bold;
text-decoration: none;
//color: #111111;
//color: #ee82ee;
color: #EEEEEE;
}
a:visited {
font-weight: bold;
text-decoration: none;
//color: #111111;
//color: #ee82ee;
color: #EEEEEE;
}
abbr {
border-bottom: none;
}
#BodyDiv {
display: inline-block;
margin: auto;
width: 100%;
/*h-align: center;*/
}
.masthead {
position: -webkit-sticky;
position: sticky;
//position: fixed;
top: 0;
width: 100%;
text-align: center;
//color: #ff0000;
color: #010101;
background-color: #010101;
//background-color: #025fff;
//background-color: #32cd32;
}
.mastheadgraphic {
/* float: left; */
}
#memberDetailPicture {
max-width: 250px;
max-height: 400px;
width: auto;
height: auto;
}
.memberListThumbnailPicture {
max-width: 80px;
max-height: 120px;
width: auto;
height: auto;
}
.memberListRow {
height: 120px;
valign: center;
}
.memberListThumbnailPicture:hover {
max-width: 250px;
max-height: 400px;
width: auto;
height: auto;
overflow: visible;
position: absolute;
//top: 0px; // this does the top of the view port not the cell....
//left: 0px;
//text-align: top;
z-index: 5;
}
.memberReport {
float: right;
}
#statusCurrent {
color: green;
}
#statusDue {
color: yellow;
}
#statusOverdue {
color: red;
}
#statusContractor {
color: grey;
}
.memberListSearch {
align: center;
}
.memberDetailPicture {
display: inline;
float: left;
/*
max-width: 250px;
max-height: 400px;
width: auto;
height: auto;*/
}
.LoginDiv {
font: Arial, sans-serif;
pasition: absolute;
right: 0px;
width: 300px;
}
.LoginLabel {
text-alight: left;
float: left;
}
.LoginButton {
position: relative;
display: inline-block;
}
.SignupButton {
position: relative;
display: inline-block;
}
.DropdownLogForm {
display: none;
position: absolute;
box-shadow: 0px 8px 16px 0px;
opacity: 1.0;
background-color: #FFFFFF;
color: #000000; /* Needed to prevent transperancy */
padding: 12px 16px;
z-index: 1;
}
.LoginButton:onclick .DropdownLogForm {
display: block;
}
.LoginButton:hover .DropdownLogForm {
display: block;
}
.BodyDiv {
display: block;
width: 100%;
}
table {
border-collapse: collapse;
background-color: #010101;
color: #EEEEEE;
}
table, th {
//border: 1px solid black;
border: 1px solid white;
/*
position: -webkit-sticky;
position: sticky;
top: 20;
*/
}
tr:nth-child(even) {
background-color: #484848;
color: #EEEEEE;
}
tr:nth-child(odd) {
background-color: #010101;
color: #EEEEEE;
}
.BriefTable {
overflow-y:auto;
/*float: right;*/
}
tr:nth-child(even).Undecorated {
background-color: #FFFFFF;
}
td.centerAlign {
text-align: center;
}
td.rightAlign {
text-align: right;
}
td.padLeftAndRight {
padding-left: 2px;
padding-right: 2px;
}
.FloatLeft50Div {
display: block-inline;
float: left;
/*clear: left;*/
width: 45%;
margin: 10px;
}
.NewClassDiv label {
//float: left;
width: 25%;
text-align: right;
//padding: 20px;
margin: 5px;
}
.NewClassDiv input {
//float: left;
//width: 35%;
margin: 3px;
}
#MemberSignupDiv {
/*position: -webkit-sticky;
position: sticky;*/
top: 5;
width: 45%;
/* float: right; */
background-color: cyan;
border: 2px solid blue;
}
#ClassTableDiv {
float: left;
width:70%;
margin: 10px;
}
#MemberEditorDiv {
position: -webkit-sticky;
position: sticky;
top: 5;
width: 45%;
float: right;
background-color: green;
border: 2px solid blue;
}
#TransactionEditorDiv {
position: fixed;
top: initial;
right: 0;
background-color: green;
border: 2px solid blue;
}
.transactionDetailDiv {
background-color: #800040;
/* width: 65%; */
width: auto;
//display: inline;
border: 2px solid;
padding: 10px;
}
.transactionDetailElement {
display: inline-block;
outline-style: solid;
outline-color: invert;
outline-width: thin;
border: 0px;
padding: 0px;
margin: 0px;
}
.memberDetailTableDiv {
display: inline-block;
background-color: pink;
border: 2px solid;
padding: 10px;
}
.memberDetailTable {
display: inline-block;
background-color: purple;
//border: 2px solid;
}
.memberDetailTable tr:nth-child(even) {
background-color: #484848;
color: #EEEEEE;
}
.memberDetailTable tr:nth-child(odd) {
background-color: #010101;
color: #EEEEEE;
}
.memberDetailReport {
//background-color: yellow;
background-color: #010101;
color: #EEEEEE;
}
.MemberEditorInputLabel {
display: inline-block;
float: left;
clear: left;
width: 45%;
}
.MemberEditorInputLabelTight {
display: inline-block;
width: 15%;
}
.MemberEditorInputField {
display: inline-block;
//float: left;
}
.MemberEditorInputFieldTight {
display: inline-block;
width: 10%;
}
.MemberEditorIconPicture {
width:48px;
height:48px;
}
.sticky {
position: sticky;
top: 5;
}
#CourseEditorDiv {
//display: inline-block;
//display: block;
//display: inline;
//position: -webkit-sticky;
//position: sticky;
//postition: absolute;
//top: 5;
position: fixed;
top: initial;
right: 0;
//left: 5;
width: 45%;
//float: right;
background-color: green;
border: 2px solid blue;
z-index: -5;
}
.footer {
display: inline-block;
width: 100%;
color: #EEEEEE;
background-color: #010101;
//background-color: #1010FF;
}
.readMe {
width: 90%;
align: center;
padding: 5%;
left: 5%;
right: 5%;
}

356
membersAlt.css Normal file
View File

@ -0,0 +1,356 @@
@CHARSET "UTF-8";
html {
margin: 0;
padding: 0;
}
body {
/*
font: 755 georgia, sans-serif;
line-height: 1.0; */
//color: #1010FF;
//color: #EEEEEE;
color: $010101;
//background: #FFFFFF;
//background: #010101;
background: $EEEEEE;
margin: 0;
padding: 0;
}
p {
margin-top: 0;
text-align: inherit;
}
a:link {
font-weight: bold;
text-decoration: none;
//color: #111111;
//color: #ee82ee;
//color: #EEEEEE;
color: $010101;
}
a:visited {
font-weight: bold;
text-decoration: none;
//color: #111111;
//color: #ee82ee;
//color: #EEEEEE;
color: #010101;
}
abbr {
border-bottom: none;
}
#BodyDiv {
display: inline-block;
margin: auto;
width: 100%;
/*h-align: center;*/
}
.masthead {
text-align: center;
//color: #ff0000;
color: #010101;
background-color: #EEEEEE;
//background-color: #010101;
//background-color: #025fff;
//background-color: #32cd32;
}
.mastheadgraphic {
/* float: left; */
}
#memberDetailPicture {
max-width: 250px;
max-height: 400px;
width: auto;
height: auto;
}
.memberListThumbnailPicture {
max-width: 80px;
max-height: 120px;
width: auto;
height: auto;
}
.memberListRow {
height: 120px;
valign: center;
}
.memberListThumbnailPicture:hover {
max-width: 250px;
max-height: 400px;
width: auto;
height: auto;
overflow: visible;
position: absolute;
//top: 0px; // this does the top of the view port not the cell....
//left: 0px;
//text-align: top;
z-index: 5;
}
.memberReport {
float: right;
}
#statusCurrent {
color: green;
}
#statusDue {
color: yellow;
}
#statusOverdue {
color: red;
}
#statusContractor {
color: black;
}
.memberListSearch {
align: center;
}
.memberDetailPicture {
display: inline;
float: left;
/*
max-width: 250px;
max-height: 400px;
width: auto;
height: auto;*/
}
.LoginDiv {
font: Arial, sans-serif;
pasition: absolute;
right: 0px;
width: 300px;
}
.LoginLabel {
text-alight: left;
float: left;
}
.LoginButton {
position: relative;
display: inline-block;
}
.SignupButton {
position: relative;
display: inline-block;
}
.DropdownLogForm {
display: none;
position: absolute;
box-shadow: 0px 8px 16px 0px;
opacity: 1.0;
background-color: #FFFFFF;
color: #000000; /* Needed to prevent transperancy */
padding: 12px 16px;
z-index: 1;
}
.LoginButton:onclick .DropdownLogForm {
display: block;
}
.LoginButton:hover .DropdownLogForm {
display: block;
}
.BodyDiv {
display: block;
width: 100%;
}
table {
border-collapse: collapse;
color: #010101;
background-color: #EEEEEE;
//background-color: #010101;
//color: #EEEEEE;
}
table, th {
//border: 1px solid black;
border: 1px solid white;
}
tr:nth-child(even) {
color: #010101;
background-color: #EEEEEE;
//background-color: #484848;
//color: #EEEEEE;
}
tr:nth-child(odd) {
color: #010101;
background-color: #A8A8A8;
//background-color: #484848;
//background-color: #010101;
//color: #EEEEEE;
}
.BriefTable {
overflow-y:auto;
/*float: right;*/
}
tr:nth-child(even).Undecorated {
background-color: #EEEEEE;
}
.FloatLeft50Div {
display: block-inline;
float: left;
/*clear: left;*/
width: 45%;
margin: 10px;
}
#MemberSignupDiv {
/*position: -webkit-sticky;
position: sticky;*/
top: 5;
width: 45%;
/* float: right; */
background-color: cyan;
border: 2px solid blue;
}
#ClassTableDiv {
float: left;
width:70%;
margin: 10px;
}
#MemberEditorDiv {
position: -webkit-sticky;
position: sticky;
top: 5;
width: 45%;
float: right;
background-color: green;
border: 2px solid blue;
}
.memberDetailTableDiv {
display: inline-block;
background-color: pink;
border: 2px solid;
padding: 10px;
}
.memberDetailTable {
display: inline-block;
background-color: purple;
//border: 2px solid;
}
.memberDetailTable tr:nth-child(even) {
color: #010101;
background-color: #EEEEEE;
//background-color: #484848;
//color: #EEEEEE;
}
.memberDetailTable tr:nth-child(odd) {
color: #010101;
background-color: #484848;
//background-color: #010101;
//color: #EEEEEE;
}
.memberDetailReport {
color: #010101;
background-color: #EEEEEE;
//background-color: yellow;
//background-color: #010101;
//color: #EEEEEE;
}
.MemberEditorInputLabel {
display: inline-block;
float: left;
clear: left;
width: 45%;
}
.MemberEditorInputLabelTight {
display: inline-block;
width: 15%;
}
.MemberEditorInputField {
display: inline-block;
//float: left;
}
.MemberEditorInputFieldTight {
display: inline-block;
width: 10%;
}
.sticky {
position: sticky;
top: 5;
}
#CourseEditorDiv {
//display: inline-block;
//display: block;
//display: inline;
//position: -webkit-sticky;
//position: sticky;
top: 5;
//left: 5;
width: 45%;
float: right;
background-color: green;
border: 2px solid blue;
}
.footer {
display: inline-block;
width: 100%;
color: #010101;
background-color: #EEEEEE;
//color: #EEEEEE;
//background-color: #010101;
//background-color: #1010FF;
}
.readMe {
width: 90%;
align: center;
padding: 5%;
left: 5%;
right: 5%;
}

38
menu.css Normal file
View File

@ -0,0 +1,38 @@
@CHARSET "UTF-8";
.NavBar {
list-style-type: none;
margin: 0;
padding: 0;
border: 0;
color: #ff0000;
background-color: #025fff;
//background-color: #32cd32;
}
.NavItem {
display: inline;
padding: 12px;
font-family: 'Arial';
font-size: 30px;
}
#DirectorNavBar {
position: relative;
left: 5%;
}
#AdminNavBar {
position: relative;
left: 5%;
}
#TrainingNavBar {
position: relative;
left: 5%;
}

70
menu0.css Normal file
View File

@ -0,0 +1,70 @@
@CHARSET "UTF-8";
/*
* NavBarRedux
*/
.NavBarDiv {
overflow: hidden;
background-color: #333;
font-family: Arial;
}
.NavBarDiv a {
float: left;
font-size: 16px;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.NavBarDropDown {
float: left;
overflow: hidden;
}
.NavBarDropDown .NavBarDropDownButton {
font-size: 16px;
border: none;
outline: none;
color: white;
padding: 14px 16px;
background-color: inherit;
font-family: inherit; /* Important for vertical align on mobile phones */
margin: 0; /* Important for vertical align on mobile phones */
}
.NavBar a:hover .NavBarDropDown:hover .NavBarDropDownButton {
background-color: red;
}
.NavBarDropDownContent {
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.NavBarDropDownContent a {
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.NavBarDropDownContent a:hover {
background-color: #ddd;
}
.NavBarDropDown:hover .NavBarDropDownContent {
display: block;
}

85
menu1.css Normal file
View File

@ -0,0 +1,85 @@
@CHARSET "UTF-8";
/*
* NavBarRedux
*/
.NavBarDiv {
overflow: hidden;
background-color: #333;
font-family: Arial;
}
.NavBarDiv a {
float: left;
font-size: 16px;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.NavBarDropDown {
//display: none;
float: left;
overflow: hidden;
color: white;
bacground-color: #333;
}
.NavBarDropDown .NavBarDropDownButton {
font-size: 16px;
border: none;
outline: none;
color: white;
padding: 14px 16px;
background-color: inherit;
font-family: inherit; /* Important for vertical align on mobile phones */
margin: 0; /* Important for vertical align on mobile phones */
}
.NavBarDiv a:hover .NavBarDropDown:hover .NavBarDropDownButton {
background-color: red;
}
.NavBarDropDownContent {
/* display: none;
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;*/
display: none;
position: absolute;
//background-color: #f9f9f9;
background-color: #333;
color: white;
z-index: 1;
/* min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);*/
}
.NavBarDropDownContent a {
//display: none;
float: none;
//color: black;
color: white;
background-color: #333;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.NavBarDropDownContent a:hover {
background-color: #ddd;
}
.NavBarDropDown:hover .NavBarDropDownContent {
display: block;
}

97
new-transaciton.php Normal file
View File

@ -0,0 +1,97 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "text.php";
include_once "database.php";
include_once "adminUtils.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE) && returnAdminStatus($_SESSION['MemberID']))
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* Process form here
*/
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
$_SESSION['subNav'] = NULL;
$body->appendChild(generateSelectedMenuBar($doc));
/*
* Insert content here.
*/
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
outputDoc($doc);
}
else
generateIndexRedirect();
?>

283
password-reset.php Normal file
View File

@ -0,0 +1,283 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "formUtils.php";
if (isset($_SESSION['cookieMonster']))
//if (true)
{
$doc = returnDoc();
$root = returnRoot($doc);
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
/*
* Insert content here.
*/
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if (isset($_POST['TokenID']) && isset($_POST['password1']) && isset($_POST['password2']))
{
/*
* We have a TokenID and two passwords on POST
* If everything checks out, reset the password.
*/
$token = cleanInput($_POST['TokenID']);
if ($_POST['password1'] === $_POST['password2'])
{
$newPassword = $_POST['password1'];
$memberID = FALSE;
$memberID = verifyPasswordResetToken($token);
if (!($memberID === FALSE))
{
/*
* everything looks good, update the password and clear the token.
*/
}
}
}
if (isset($_POST['useremail']))
{
/*
* Send a password reset url
*/
$targetEmail = cleanInput($_POST['useremail']);
/*
* Apply some sanity to this because there is no userid to log
* abusive requests to.
*/
if (strpos($targetEmail, ';') === FALSE &&
strpos($targetEmail, '"') === FALSE &&
strpos($targetEmail, "'") === FALSE &&
strpos($targetEmail, '?') === FALSE &&
strpos($targetEmail, "/") === FALSE &&
strpos($targetEmail, "\\") === FALSE)
{
$mailArray = returnPasswordResetTokenArray($targetEmail);
if (!is_null($mailArray))
{
$mailTo = $mailArray['email'];
$token = $mailArray['token'];
//print ("token is " . strlen($token) . " characters long");
$firstName = $mailArray['firstName'];
$lastName = $mailArray['lastName'];
$subject = "Request to change your password has been recieved";
$message = "Hello $firstName, we have received a request to change " .
"your password. If this request was not made by you do not " .
"respond to this email. If you continue to receive these requests " .
"please let us know. To reset your password, follow this link: " .
"http://$siteDomain$baseDir/password-reset.php?TokenID=$token " .
"and you will be guided through the rest of the process. Again, " .
"it is safe to ignore this email if you do not want to reset your " .
"password. Abuse can be reported to mailto:info@protospace.ca ";
if (!$passwordResetMailSilence)
{
mail($mailTo, $subject, $message);
}
else
{
$label = $doc->createElement('h3');
$label->appendChild($doc->createTextNode("This message would have been sent but it was silenced"));
$body->appendChild($label);
$label = $doc->createElement('p');
$label->appendChild($doc->createTextNode($message));
$body->appendChild($label);
}
}
}
}
}
else
{
if (isset($_GET['TokenID']))
{
$memberID = FALSE;
/*
* Check the token and reset the password
*/
$token = cleanInput($_GET['TokenID']);
/*
* Tokens will have very specific formats that should be checked.
*/
/** TODO:
* Make this more better, less sucky
*/
if (strlen($token) == 64)
{
$memberID = verifyPasswordResetToken($token);
if (!($memberID === FALSE))
{
$label = $doc->createElement('h3');
$label->appendChild($doc->createTextNode("Reset Password"));
$body->appendChild($label);
$form = createForm($doc, "password-reset.php");
$fieldSet = $doc->createElement('fieldset');
$fieldSetDiv = $doc->createElement('div');
$fieldSet->appendChild($fieldSetDiv);
$input = $doc->createElement('input');
$input->setAttribute('type', 'hidden');
$input->setAttribute('name', 'TokenID');
$input->setAttribute('value', $token);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('label', 'Enter new password:');
$label->setAttribute('for', 'password1');
$label->setAttribute('class', 'CourseEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'password');
$input->setAttribute('name', 'password1');
$input->setAttribute('value', '');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('required', 'required');
//$input->setAttribute('');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('label', 'Confirm new password:');
$label->setAttribute('for', 'password2');
$label->setAttribute('class', 'CourseEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'password');
$input->setAttribute('name', 'password2');
$input->setAttribute('value', '');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('required', 'required');
//$input->setAttribute('');
$fieldSetDiv->appendChild($input);
$input = $doc->createElement('input');
$input->setAttribute('type', 'submit');
$input->setAttribute('value', 'Reset Password');
$fieldSetDiv->appendChild($input);
$form->appendChild($fieldSet);
$body->appendChild($form);
}
}
}
else
{
/*
* Offer a password reset
*/
$label = $doc->createElement('h3');
$label->appendChild($doc->createTextNode("Reset Password"));
$body->appendChild($label);
$form = createForm($doc, "password-reset.php");
$fieldSet = $doc->createElement('fieldset');
$fieldSetDiv = $doc->createElement('div');
$fieldSet->appendChild($fieldSetDiv);
/*
$label = $doc->createElement('label', 'Username:');
$label->setAttribute('for', 'username');
$label->setAttribute('class', 'CourseEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'username');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('');
$fieldSetDiv->appendChild($input);
*/
$label = $doc->createElement('label', 'Email:');
$label->setAttribute('for', 'useremail');
$label->setAttribute('class', 'CourseEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'useremail');
$input->setAttribute('autocomplete', 'off');
if (isset($_GET['id']) &&
(returnAdminStatus($_SESSION['MemberID']) || returnDirectorStatus($_SESSION['MemberID'])))
{
$input->setAttribute('value', returnUserEmail((int)cleanInput($_GET['id'])));
}
//$input->setAttribute('');
$fieldSetDiv->appendChild($input);
$input = $doc->createElement('input');
$input->setAttribute('type', 'submit');
$form->appendChild($input);
$form->appendChild($fieldSet);
$body->appendChild($form);
}
}
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
outputDoc($doc);
}
else
{
generateCookieMonster();
}
?>

97
pitches.php Normal file
View File

@ -0,0 +1,97 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "adminUtils.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE) && returnAdminStatus($_SESSION['MemberID']))
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* Process form here
*/
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
$_SESSION['subNav'] = NULL;
$body->appendChild(generateSelectedMenuBar($doc));
/*
* Insert content here.
*/
$h3 = $doc->createElement('h3');
$h3->appendChild($doc->createTextNode("This is where members will pitch projects"));
$body->appendChild($h3);
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
outputDoc($doc);
}
else
generateIndexRedirect();
?>

482
preferences.php Normal file
View File

@ -0,0 +1,482 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "text.php";
include_once "adminUtils.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE))
{
$changed = FALSE;
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* Process form here
*/
if (isset($_POST[$text0007]) && $_POST[$text0007] === $text0007)
{
if ($_FILES['cssfile']['error'] === UPLOAD_ERR_OK)
{
$finfo = finfo_open(FILEINFO_MIME);
$destination = tempnam("usercss", "user");
$destination .= ".css";
if (move_uploaded_file($_FILES['cssfile']['tmp_name'], $destination));
{
$fileInfo = finfo_file($finfo, $destination);
//print($destination);
if (registerNewUserCSSFile($_SESSION['MemberID'], basename($destination), $_FILES['cssfile']['name'], $fileInfo) === FALSE)
{
print("User CSS file not added to database.");
}
}
}
else
{
print($_FILES['cssfile']['error']);
}
}
//print_r ($_POST);
else
if (isset($_POST[$text0005]) && $_POST[$text0005] === $text0005)
{
if ((int) $_POST['style'] !== (int) $_SESSION['prefCSS'])
{
switch ((int) $_POST['style'])
{
case 0:
$_SESSION['prefCSS'] = 0;
$changed = TRUE;
break;
case 1:
$_SESSION['prefCSS'] = 1;
$changed = TRUE;
break;
}
}
if ($_POST['language'] !== $_SESSION['language'])
{
switch (cleanInput($_POST['language']))
{
case 'en':
$_SESSION['language'] = 'en';
$changed = TRUE;
break;
case 'fr':
$_SESSION['language'] = 'fr';
$changed = TRUE;
break;
case 'es':
$_SESSION['language'] = 'es';
$changed = TRUE;
break;
}
}
if (isset($_POST['xml']) && $_POST['xml'] === 'xml')
{
if ($_SESSION['prefXML'] === FALSE)
{
$_SESSION['prefXML'] = TRUE;
$changed = TRUE;
}
}
else
{
if ($_SESSION['prefXML'] === TRUE)
{
$_SESSION['prefXML'] = FALSE;
$changed = TRUE;
}
}
if (isset($_POST['mobile']) && $_POST['mobile'] === 'mobile')
{
if ($_SESSION['despizeMobile'] === FALSE)
{
$_SESSION['despizeMobile'] = TRUE;
$changed = TRUE;
}
}
else
{
if ($_SESSION['despizeMobile'] === TRUE)
{
$_SESSION['despizeMobile'] = FALSE;
$changed = TRUE;
}
}
if (isset($_POST['customCSS']) && $_POST['customCSS'] === 'customCSS')
{
print ("bonk");
if ((boolean) $_SESSION['useCustomCSS'] === FALSE)
{
$_SESSION['useCustomCSS'] = TRUE;
$changed = TRUE;
}
}
else
{
if ((boolean) $_SESSION['useCustomCSS'] === TRUE)
{
$_SESSION['useCustomCSS'] = FALSE;
$changed = TRUE;
}
}
}
else
if (isset($_POST[$text0006]) && $_POST[$text0006] === $text0006)
{
$set_lang = 'en';
$set_xml = FALSE;
$set_mobi = FALSE;
$set_style = 0;
if (isset($_POST['xml']) && $_POST['xml'] === 'xml')
$set_xml = TRUE;
if (isset($_POST['mobile']) && $_POST['mobile'] === 'mobile')
$set_mobi = TRUE;
if (isset($_POST['language']))
{
switch (cleanInput($_POST['language']))
{
case 'en':
$set_lang = 'en';
break;
case 'fr':
$set_lang = 'fr';
break;
case 'es':
$set_lang = 'es';
break;
}
}
if (isset($_POST['style']) && is_numeric($_POST['style']))
{
$cleaned =(int) cleanInput($_POST['style']);
if ($cleaned >= 0 && $cleaned <= 1)
$set_style = $cleaned;
}
try
{
$dbh = returnDatabaseHandel();
$dbh->beginTransaction();
$sth = $dbh->prepare($statement255);
$sth->execute(array($set_lang, $set_xml, $set_mobi, $set_style, $_SESSION['MemberID']));
$dbh->commit();
}
catch (Exception $e)
{
print("Failed ut update user_options " . $e->getMessage());
$dbh->rollBack();
}
}
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
$_SESSION['subNav'] = NULL;
$body->appendChild(generateSelectedMenuBar($doc));
/*
* Insert content here.
*/
$db_lang = 'en';
$db_xml = TRUE;
$db_mobi = TRUE;
$db_set = 0;
try
{
$dbh = returnDatabaseHandel();
$sth = $dbh->prepare($statement254);
$count = 0;
if ($sth->execute(array($_SESSION['MemberID'])))
{
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) // && ($row['start_datetime'] > date('')))
{
$count++;
$db_lang = $row['language'];
$db_xml = $row['prefer_xml'];
$db_mobi = $row['despize_mobile'];
$db_set = $row['prefered_css'];
}
}
}
catch (Exception $e)
{
}
$h3 = $doc->createElement('h3');
$h3->appendChild($doc->createTextNode($text0100));
$body->appendChild($h3);
$form = createForm($doc, "preferences.php");
$fieldSet = $doc->createElement('fieldset');
$label = $doc->createElement('label', $text0101);
$label->setAttribute('for', 'xml');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSet->appendChild($label);
$input = $doc->createElement('select');
$input->setAttribute('name', 'language');
$option = $doc->createElement('option');
$option->setAttribute('value', 'zz');
if (isset($_SESSION['language']) && $_SESSION['language'] === 'zz')
$option->setAttribute('selected', 'selected');
$option->appendChild($doc->createTextNode('Browser'));
$input->appendChild($option);
$option = $doc->createElement('option');
$option->setAttribute('value', 'en');
if (isset($_SESSION['language']) && $_SESSION['language'] === 'en')
$option->setAttribute('selected', 'selected');
$option->appendChild($doc->createTextNode('English'));
$input->appendChild($option);
$option = $doc->createElement('option');
$option->setAttribute('value', 'fr');
if (isset($_SESSION['language']) && $_SESSION['language'] === 'fr')
$option->setAttribute('selected', 'selected');
$option->appendChild($doc->createTextNode('French'));
$input->appendChild($option);
$option = $doc->createElement('option');
$option->setAttribute('value', 'es');
if (isset($_SESSION['language']) && $_SESSION['language'] === 'es')
$option->setAttribute('selected', 'selected');
$option->appendChild($doc->createTextNode('Spanish'));
$input->appendChild($option);
$fieldSet->appendChild($input);
$label = $doc->createElement('br');
$fieldSet->appendChild($label);
$label = $doc->createElement('label', $text0102);
$label->setAttribute('for', 'xml');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSet->appendChild($label);
$input = createCheckboxInput($doc, 'xml', 'xml', NULL, NULL, FALSE);
/* $input = $doc->createElement('input');
$input->setAttribute('type', 'checkbox');
$input->setAttribute('name', 'xml');
$input->setAttribute('value', 'xml');
$input->setAttribute('autocomplete', 'off'); */
if ($_SESSION['prefXML'] === TRUE)
$input->setAttribute('checked', 'checked');
// else
// $input->setAttribute('checked', '');
$fieldSet->appendChild($input);
$label = $doc->createElement('br');
$fieldSet->appendChild($label);
$label = $doc->createElement('label', $text0103);
$label->setAttribute('for', 'mobile');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSet->appendChild($label);
$input = createCheckboxInput($doc, 'mobile', 'mobile', NULL, NULL, FALSE);
/* $input = $doc->createElement('input');
$input->setAttribute('type', 'checkbox');
$input->setAttribute('name', 'mobile');
$input->setAttribute('value', 'mobile');
$input->setAttribute('autocomplete', 'off'); */
if ($_SESSION['despizeMobile'] === TRUE)
$input->setAttribute('checked', 'checked');
// else
// $input->setAttribute('checked', '');
$fieldSet->appendChild($input);
$label = $doc->createElement('br');
$fieldSet->appendChild($label);
$label = $doc->createElement('label', $text0104);
$label->setAttribute('for', 'style');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSet->appendChild($label);
$input = $doc->createElement('select');
$input->setAttribute('name', 'style');
$input->setAttribute('autocomplete', 'off');
for ($i = 0; $i < 2; $i++)
{
$option = $doc->createElement('option');
$option->setAttribute('value', $i);
if ($i === $_SESSION['prefCSS'])
$option->setAttribute('selected', 'selected');
$option->appendChild($doc->createTextNode($i));
$input->appendChild($option);
}
$fieldSet->appendChild($input);
$label = $doc->createElement('br');
$fieldSet->appendChild($label);
/*
* The order of this is unusual to provide for special labeling.
*/
$extendedText = $text0105;
$input = createCheckboxInput($doc,'customCSS', 'customCSS', NULL, NULL, FALSE);
if (userHasRegisteredCustomCSS($_SESSION['MemberID']))
{
/*
* SECURITE - if the original file name was not properly sterilized, this
* is where the injection attack can occur.
*/
$extendedText .= "(" . returnUserCSSOriginalFileName($_SESSION['MemberID']) . ")";
if ($_SESSION['useCustomCSS'] === TRUE)
$input->setAttribute('checked', 'checked');
}
else
{
$input->setAttribute('disabled', 'disabled');
$extendedText .= "($text0107)";
}
$label = $doc->createElement('label', $extendedText);
$label->setAttribute('for', 'customCSS');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSet->appendChild($label);
$fieldSet->appendChild($input);
$label = $doc->createElement('br');
$fieldSet->appendChild($label);
$label = $doc->createElement('label', $text0106);
$label->setAttribute('for', 'cssfile');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSet->appendChild($label);
$input =$doc->createElement('input');
$input->setAttribute('type', 'file');
$input->setAttribute('name', 'cssfile');
$fieldSet->appendChild($input);
$input = createSubmitInput($doc, $text0007, $text0007);
/* $input = $doc->createElement('input');
$input->setAttribute('type', 'submit');
$input->setAttribute('name', $text0007);
$input->setAttribute('value', $text0007); */
$fieldSet->appendChild($input);
$label = $doc->createElement('br');
$fieldSet->appendChild($label);
if (returnMemberUseEncryptions($_SESSION['MemberID']))
$label = createLabel($doc, $text0130, 'encryptEmail', 'MemberEditorInputLabel', 'Checked');
else
$label = createLabel($doc, $text0130, 'encryptEmail', 'MemberEditorInputLabel');
$fieldSet->appendChild($label);
$label = createCheckboxInput($doc, 'encryptEmail');
$fieldSet->appendChild($label);
$label = createBr($doc);
$fieldSet->appendChild($label);
$label = $doc->createElement('label', $text0131);
$label->setAttribute('for', 'pgpkeyfile');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSet->appendChild($label);
$input =$doc->createElement('input');
$input->setAttribute('type', 'file');
$input->setAttribute('name', 'pgpkeyfile');
$fieldSet->appendChild($input);
$input = createSubmitInput($doc, $text0007, $text0007);
$form->appendChild($fieldSet);
$input = createSubmitInput($doc, $text0005, $text0005);
/* $input = $doc->createElement('input');
$input->setAttribute('type', 'submit');
$input->setAttribute('name', $text0005);
$input->setAttribute('value', $text0005);*/
$form->appendChild($input);
if ($changed)
{
$input = createSubmitInput($doc, $text0006, $text0006);
/* $input = $doc->createElement('input');
$input->setAttribute('type', 'submit');
$input->setAttribute('name', $text0006);
$input->setAttribute('value', $text0006); */
$form->appendChild($input);
}
$body->appendChild($form);
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
outputDoc($doc);
}
else
generateIndexRedirect();
?>

169
processIPNs.php Normal file
View File

@ -0,0 +1,169 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "adminUtils.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE) &&
(returnAdminStatus($_SESSION['MemberID']) ||
returnDirectorStatus($_SESSION['MemberID'])))
{
$ipnDetailForm = NULL;
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* Process form here
*/
print ("Posted: ");
print_r ($_POST);
}
else
if ($_SERVER['REQUEST_METHOD'] == 'GET')
{
$options = array('options' => array('min_range' => 1));
if (isset($_GET['id']) && (filter_var($_GET['id'], FILTER_VALIDATE_INT, $options) !== FALSE))
{
$ipn = returnPendingIPN($_GET['id']);
if (!is_null($ipn))
{
$ipnDetailForm = createForm($doc, 'processIPNs.php');
$ipnDetail = createTable($doc);
$tr = createTr($doc);
$tr->appendChild(createTd($doc, 'IPN ID'));
$tr->appendChild(createTd($doc, $ipn['id']));
$ipnDetail->appendChild($tr);
$tr = createTr($doc);
$tr->appendChild(createTd($doc, 'TXN ID'));
$tr->appendChild(createTd($doc, $ipn['txn_id']));
$ipnDetail->appendChild($tr);
$tr = createTr($doc);
$tr->appendChild(createTd($doc, 'IPN Type'));
$tr->appendChild(createTd($doc, $ipn['txn_type']));
$ipnDetail->appendChild($tr);
$tr = createTr($doc);
$tr->appendChild(createTd($doc, 'IPN Payer ID'));
$tr->appendChild(createTd($doc, $ipn['payer_id']));
$ipnDetail->appendChild($tr);
$tr = createTr($doc);
$tr->appendChild(createTd($doc, 'IPN First Name'));
$tr->appendChild(createTd($doc, $ipn['first_name']));
$ipnDetail->appendChild($tr);
$tr = createTr($doc);
$tr->appendChild(createTd($doc, 'IPN Last Name'));
$tr->appendChild(createTd($doc, $ipn['last_name']));
$ipnDetail->appendChild($tr);
$tr = createTr($doc);
$tr->appendChild(createTd($doc, 'IPN Payment Date'));
$tr->appendChild(createTd($doc, $ipn['payment_date']));
$ipnDetail->appendChild($tr);
$tr = createTr($doc);
$tr->appendChild(createTd($doc, 'Date of Record'));
$tr->appendChild(createTd($doc, $ipn['incoming_timestamp']));
$ipnDetail->appendChild($tr);
$tr = createTr($doc);
$tr->appendChild(createTd($doc, 'IPN Gross'));
$tr->appendChild(createTd($doc, $ipn['mc_gross']));
$ipnDetail->appendChild($tr);
$tr = createTr($doc);
$tr->appendChild(createTd($doc, 'Select Member'));
$td = createTd($doc);
$td->appendChild(generateMemberSelector($doc, 'targetMember'));
$tr->appendChild($td);
$ipnDetail->appendChild($tr);
$ipnDetailForm->appendChild($ipnDetail);
$ipnDetailForm->appendChild(createHiddenInput($doc, 'id', $ipn['id']));
$ipnDetailForm->appendChild(createLabel($doc, 'Add To Known Paypal IDs', 'makePayerKnown'));
$ipnDetailForm->appendChild(createCheckboxInput($doc, 'makePayerKnown'));
$ipnDetailForm->appendChild(createBr($doc));
$ipnDetailForm->appendChild(createSubmitInput($doc, 'assignIPN', 'Assign IPN to Member'));
}
}
}
processInstantPaypalNotificationQueue();
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
$_SESSION['subNav'] = 1;
$body->appendChild(generateSelectedMenuBar($doc, 1));
/*
* Insert content here.
*/
if (!is_null($ipnDetailForm))
$body->appendChild($ipnDetailForm);
$body->appendChild(generatePendingIPNTable($doc, 'processIPNs.php'));
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
outputDoc($doc);
}
else
{
generateIndexRedirect();
//print ("redirect");
}
?>

530
signup.php Normal file
View File

@ -0,0 +1,530 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "applicationFormUtils.php";
if (isset($_SESSION['cookieMonster']))
//if (true)
{
$doc = returnDoc();
$root = returnRoot($doc);
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
if (!isset($_SESSION['login']) || $_SESSION['login'] === FALSE)
/*
* Insert content here.
*/
if ($_SERVER['REQUEST_METHOD'] === 'POST')
{
if (isset($_POST['first_name']) && isset($_POST['last_name']) && isset($_POST['email']) && isset($_POST['monthly_fees'])
&& isset($_POST['application_date']) && isset($_POST['password1']) && isset($_POST['password2'])
&& ($_POST['password1'] === $_POST['password2']))
{
try
{
/*
$newMemberID = insertIntoMemberTable();
$newMemberID = returnIdFromUsername($_)
*/
if (insertIntoMemberTable())
{
/*
* Print Application Form PDF
*/
$newMemberID = returnIdFromUsername($_POST['first_name'] . "." . $_POST['last_name']);
$pdf = new ApplicationForm(getMemberRowData($newMemberID));
$pdf->Output();
//printApplicationForm();
}
}
catch (Exception $e)
{
if ($e->getCode() == 23000)
{
$h1 = $doc->createElement('h1');
$h1->appendChild($doc->createTextNode('A user by that exact name already exists.'));
$body->appendChild($h1);
}
}
}
else
{
print ("short\n");
}
}
else
{
$editorDiv = $doc->createElement('div');
$editorDiv->setAttribute('id', 'MemberSignupDiv');
$form = $doc->createElement('form');
$form->setAttribute('action', 'signup.php');
$form->setAttribute('method', 'post');
$label = $doc->createElement('H3');
$label->appendChild($doc->createTextNode("New Member Signup"));
$form->appendChild($label);
$fieldSet = $doc->createElement('fieldset');
//$fieldSet->setAttribute('style', 'width:200px; max-width:300px;'); //margin-top:0.5em;');
$fieldSetDiv = $doc->createElement('div');
$label = $doc->createElement('label', 'First Name:');
$label->setAttribute('for', 'first_name');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'first_name');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('required', 'required');
if (isset($_POST['first_name']))
$input->setAttribute('value', $_POST['first_name']);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Middle Name:');
$label->setAttribute('for', 'middle_name');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'middle_name');
$input->setAttribute('autocomplete', 'off');
if (isset($_POST['middle_name']))
$input->setAttribute('value', $_POST['middle_name']);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Last Name:');
$label->setAttribute('for', 'last_name');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'last_name');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('required', 'required');
if (isset($_POST['last_name']))
$input->setAttribute('value', $_POST['last_name']);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Prefered Name:');
$label->setAttribute('for', 'prefered_name');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'prefered_name');
$input->setAttribute('autocomplete', 'off');
if (isset($_POST['prefered_name']))
$input->setAttribute('value', $_POST['prefered_name']);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Nick Name:');
$label->setAttribute('for', 'nick_name');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'nick_name');
$input->setAttribute('autocomplete', 'off');
if (isset($_POST['nick_name']))
$input->setAttribute('value', $_POST['nick_name']);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'EMail Address:');
$label->setAttribute('for', 'email');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'email');
$input->setAttribute('name', 'email');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('class', 'MemberEditorInputField');
$input->setAttribute('required', 'required');
if (isset($_POST['email']))
$input->setAttribute('value', $_POST['email']);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
/*
$label = $doc->createElement('label', 'Expiration Date:');
$label->setAttribute('for', 'expire');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'date');
$input->setAttribute('name', 'expire');
$input->setAttribute('autocomplete', 'off');
if (isset($_POST['expire']))
$input->setAttribute('value', $_POST['expire']);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Current Start Date:');
$label->setAttribute('for', 'current_start');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'date');
$input->setAttribute('name', 'current_start');
$input->setAttribute('autocomplete', 'off');
if (isset($_POST['current_start_date']))
$input->setAttribute('value', $_POST['current_start_date']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
*/
$label = $doc->createElement('label', 'Application Date:');
$label->setAttribute('for', 'application_date');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'date');
$input->setAttribute('name', 'application_date');
$input->setAttribute('autocomplete', 'off');
$currentTime = date('Y-m-d');
if (isset($_POST['application_date']))
$input->setAttribute('value', $_POST['application_date']);
else
$input->setAttribute('value', "$currentTime");
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
/*
$label = $doc->createElement('label', 'Status:');
$label->setAttribute('for', 'status');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'status');
//$input->setAttribute('autocomplete', 'off');
if (isset($_POST['status']))
$input->setAttribute('value', $_POST['status']);
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
*/
$label = $doc->createElement('label', 'Monthly Rate:');
$label->setAttribute('for', 'monthly_fees');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('select');
//$input->setAttribute('type', 'select');
$input->setAttribute('name', 'monthly_fees');
$option = $doc->createElement('option');
$option->setAttribute('value', '55');
$option->setAttribute('selected', 'selected');
$option->appendChild($doc->createTextNode("$55.00"));
$input->appendChild($option);
$option = $doc->createElement('option');
$option->setAttribute('value', '35.00');
$option->appendChild($doc->createTextNode("$35.00"));
$input->appendChild($option);
/* $input->setAttribute('type', 'number');
$input->setAttribute('name', 'monthly_fees');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('step', '0.01');
$input->setAttribute('pattern', '^\d+(\.|\,)\d{2}$');
$input->setAttribute('value', '55');*/
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Birth Date:');
$label->setAttribute('for', 'birth_date');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'date');
$input->setAttribute('name', 'birth_date');
$input->setAttribute('autocomplete', 'off');
if (isset($_POST['birth_date']))
$input->setAttribute('value', $_POST['birth_date']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Minor:');
$label->setAttribute('for', 'minor');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'checkbox');
$input->setAttribute('name', 'minor');
$input->setAttribute('autocomplete', 'off');
if (isset($_POST['minor']) /* || ($_POST['birth_date'] - 18) */)
$input->setAttribute('value', $_POST['minor']);
/* $input->setAttribute('required', 'required'); */
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Guardian:');
$label->setAttribute('for', 'guardian');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'guardian');
$input->setAttribute('autocomplete', 'off');
if (isset($_POST['guardian']))
$input->setAttribute('value', $_POST['guardian']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Street Address:');
$label->setAttribute('for', 'address');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'address');
$input->setAttribute('autocomplete', 'off');
if (isset($_POST['street_address']))
$input->setAttribute('value', $_POST['street_address']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'City:');
$label->setAttribute('for', 'city');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'city');
//$input->setAttribute('autocomplete', 'off');
if (isset($_POST['city']))
$input->setAttribute('value', $_POST['city']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Province:');
$label->setAttribute('for', 'province');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'province');
//$input->setAttribute('autocomplete', 'off');
if (isset($_POST['province']))
$input->setAttribute('value', $_POST['province']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Postal Code:');
$label->setAttribute('for', 'postal_code');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'postal_code');
$input->setAttribute('autocomplete', 'off');
if (isset($_POST['postal_code']))
$input->setAttribute('value', $_POST['postal_code']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Phone:');
$label->setAttribute('for', 'phone');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'phone');
$input->setAttribute('autocomplete', 'off');
if (isset($_POST['phone']))
$input->setAttribute('value', $_POST['phone']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Emergency Contact Name:');
$label->setAttribute('for', 'emergency_name');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'emergency_name');
$input->setAttribute('autocomplete', 'off');
if (isset($_POST['emergency_contact_name']))
$input->setAttribute('value', $_POST['emergency_contact_name']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Emergency Contact Number:');
$label->setAttribute('for', 'emergency_number');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'emergency_number');
$input->setAttribute('autocomplete', 'off');
if (isset($_POST['emergency_contact_number']))
$input->setAttribute('value', $_POST['emergency_contact_number']);
//$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Password:');
$label->setAttribute('for', 'password1');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'password');
$input->setAttribute('name', 'password1');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('required', 'required');
if (isset($_POST['password1']))
$input->setAttribute('value', $_POST['password1']);
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Confirm:');
$label->setAttribute('for', 'password2');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'password');
$input->setAttribute('name', 'password2');
$input->setAttribute('autocomplete', 'off');
$input->setAttribute('required', 'required');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Member Notes:');
$label->setAttribute('for', 'member_notes');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('textarea');
//$input->setAttribute('type', 'textarea');
$input->setAttribute('name', 'member_notes');
$input->setAttribute('rows', '3');
$input->setAttribute('cols', '50');
$input->setAttribute('autocomplete', 'off');
if (isset($_POST['member_notes']))
$input->setAttribute('value', $_POST['member_notes']);
//$input->setAttribute('required', 'required');
/* A child node is required to create a proper closing tag for <textarea>*/
$input->appendChild($doc->createTextNode(""));
$fieldSetDiv->appendChild($input);
/*$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);*/
$fieldSet->appendChild($fieldSetDiv);
$form->appendChild($fieldSet);
$input = $doc->createElement('input');
$input->setAttribute('type', 'reset');
$form->appendChild($input);
$input = $doc->createElement('input');
$input->setAttribute('type', 'submit');
$form->appendChild($input);
$editorDiv->appendChild($form);
$body->appendChild($editorDiv);
}
$body->appendChild(generateFooter($doc));
outputDoc($doc);
}
else
{
generateCookieMonster();
}
?>

102
storage.php Normal file
View File

@ -0,0 +1,102 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "text.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if ($_SESSION['login'] === TRUE)
{
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild(generateMemberNavigationBar($doc));
//$body->appendChild(generateNewNavigationBar($doc));
$_SESSION['subNav'] = NULL;
$body->appendChild(generateSelectedMenuBar($doc));
if ($_SERVER['REQUEST_METHOD'] === 'GET')
{
if (isset($_GET['id']))
{
$storageID = cleanInput($_GET['id']);
if (filter_input(FILTER_VALIDATE_INT, $storageID) !== FALSE)
{
//print ($storageID);
$body->appendChild(generateStorageDetailReport($doc, $storageID));
}
}
}
$table = createTable($doc);
$thead = createTableHeader($doc, array($text0120, $text0121, $text0122,
$text0123, $text0124, $text0125));
$table->appendChild($thead);
$table->appendChild(populateStorageTable($doc, 'storage.php'));
$body->appendChild($table);
$body->appendChild(generateFooter($doc));
outputDoc($doc);
}
?>

129
text.php Normal file
View File

@ -0,0 +1,129 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
include_once 'utils.php';
$text0000 = "Submit";
$text0001 = "Search";
$text0002 = "Cancel";
$text0003 = "Add Picture";
$text0004 = "Update";
$text0005 = "Test";
$text0006 = "Commit";
$text0007 = "Upload";
$text0008 = "New Transaciton";
$text0010 = "Username or Password incorrect.";
$text0011 = "Invalid password.";
$text0012 = "Reset Password";
$text0015 = "Activate"; //tool_activation.php
$text0016 = "Deactivate";
$text0017 = "DeactivateAll";
$text0020 = "Withdraw"; //classes.php
$text0021 = "Register";
$text0100 = "User Preferences";
$text0101 = "Language:";
$text0102 = "Prefer XML:";
$text0103 = "Prefer Desktop Version:";
$text0104 = "Use Predefined Style Set:";
$text0105 = "Use User Uploaded Stylesheet: ";
$text0106 = "Upload Custom CSS File: ";
$text0107 = "No Custom CSS File Uploaded";
$text0108 = "Transaction ID";
$text0109 = "Member ID";
$text0110 = "Transaction Date";
$text0111 = "Memo";
$text0112 = "Quantity";
$text0113 = "Total Price";
$text0114 = "Reference";
$text0115 = "Category";
$text0116 = "Payment Method";
$text0117 = "Account Type";
$text0118 = "Info Source";
$text0119 = "Months Added";
$text0120 = "ID";
$text0121 = "Member Name";
$text0122 = "Area";
$text0123 = "Sub Area";
$text0124 = "Column";
$text0125 = "Row";
$text0126 = "Hexidecimal Address";
$text0127 = "User Friendly Address";
$text0128 = "Comment";
$text0129 = "Last Tag Print";
$text0130 = "Encrypt Email:";
$text0131 = "Upload PGP key:";
$text0132 = "Change Picture";
$text7000 = <<<EOD
You have been registered in a class and you may now confirm your
registration by submiting the payment if any. Only members who have
been confirmed (most likely by paying the course fee) are guaranteed
one of the seats in the class. If the course is full, you will be
notified if a seat opens up based on the oreder members signed up for
the class.
EOD;
$text7100 = 'This page was generated on ';
$text7101 = ' by software ';
$text7102 = 'licened';
$text7103 = ' by The Deerfoot Irregualrs and is CopyRight of ';
$text7104 = '.';
switch (returnLanguagePreferenceFromBrowser())
{
case "en":
break;
case "fr":
{
}
break;
case "es":
{
}
break;
}
?>

212
toolActivation.php Normal file
View File

@ -0,0 +1,212 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "adminUtils.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE))
{
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_SESSION['MemberID']))
{
//print_r($_POST);
/*
* Process form here
*/
if (isset($_POST['Activate']))
{
try
{
//print ("checking...");
$dbh = returnDatabaseHandel();
$dbh->beginTransaction();
$sth = $dbh->prepare($statement240);
if ($sth->execute(array($_SESSION['MemberID'])))
{
$stb = $dbh->prepare($statement242);
while ($row = $sth->fetch(PDO::FETCH_ASSOC))
{
foreach ($_POST as $post => $value)
{
//print("post $post and value $value are ${row['id']}");
if ((int) $post === (int) $row['id'] && (int) $value === (int) $row['id'])
{
//print ("activating...");
$stb->execute(array($_SESSION['MemberID'], $row['id']));
}
}
}
}
$dbh->commit();
}
catch (Exception $e)
{
print ("Failed to activate tools " . $e->getMessage());
$dbh->rollBack();
}
}
else
if (isset($_POST['Deactivate']))
{
try
{
$dbh = returnDatabaseHandel();
$dbh->beginTransaction();
$sth = $dbh->prepare($statement241);
if ($sth->execute(array($_SESSION['MemberID'])))
{
$stb = $dbh->prepare($statement243);
while ($row = $sth->fetch(PDO::FETCH_ASSOC))
{
foreach ($_POST as $post => $value)
{
if ((int) $post === (int) $row['id'] && (int) $value === (int) $row['id'])
{
$stb->execute(array($row['id']));
}
}
}
}
$dbh->commit();
}
catch (Exception $e)
{
print ("Failed to deactivate tools " . $e->getMessage());
$dbh->rollBack();
}
}
else
if (isset($_POST['DeactivateAll']))
{
try
{
$dbh = returnDatabaseHandel();
$dbh->beginTransaction();
$sth = $dbh->prepare($statement244);
if ($sth->execute(array($_SESSION['MemberID'])))
{
}
$dbh->commit();
}
catch (Exception $e)
{
print ("Failed to deactivate all authorized tools " . $e->getMessage());
$dbh->rollBack();
}
}
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
$_SESSION['subNav'] = NULL;
$body->appendChild(generateSelectedMenuBar($doc));
$h3 = $doc->createElement('h3');
$h3->appendChild($doc->createTextNode("Tool Activation"));
$body->appendChild($h3);
$formDiv = createDiv($doc);
$form = createForm($doc, "toolActivation.php");
$form->appendChild(populateToolActivationTable($doc, $_SESSION['MemberID']));
$input = createSubmitInput($doc, 'Activate', $text0015);
/* $input = $doc->createElement('input');
$input->setAttribute('type', 'submit');
$input->setAttribute('name', 'Activate');
$input->setAttribute('value', 'Activate');*/
$form->appendChild($input);
$input = createSubmitInput($doc, 'Deactivate', $text0016);
/* $input = $doc->createElement('input');
$input->setAttribute('type', 'submit');
$input->setAttribute('name', 'Deactivate');
$input->setAttribute('value', 'Deactivate'); */
$form->appendChild($input);
$input = createSubmitInput($doc, 'DeactiavateAll', $text0017);
/* $input = $doc->createElement('input');
$input->setAttribute('type', 'submit');
$input->setAttribute('name', 'DeactivateAll');
$input->setAttribute('value', 'Deactivate All'); */
$form->appendChild($input);
$formDiv->appendChild($form);
$body->appendChild($formDiv);
/*
* Insert content here.
*/
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
outputDoc($doc);
}
else
generateIndexRedirect();
?>

92
toolAuth.php Normal file
View File

@ -0,0 +1,92 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
include_once "utils.php";
include_once "consts.php";
include_once "database.php";
/*
* Non session page!
*/
$doc = new DOMDocument('1.0');
$root = $doc->createElement('html');
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
/*
* Insert content here.
*/
if ((isset($_POST['memberID']) && isset($_POST['toolID'])) ||
(isset($_GET['memberID']) && isset($_POST['toolID'])))
{
if (isset($_POST['memberID']))
$memberID = (int) $_POST['memberID'];
else
$memberID = (int) $_GET['memberID'];
if (isset($_POST['toolID']))
$toolID = (int) $_POST['toolID'];
else
$toolID = (int) $_GET['toolID'];
if (is_int($memberID) && is_int($toolID))
{
if (verifiyToolAuth($memberID, $toolID))
{
http_response_code(202);
}
else
{
http_response_code(403);
}
}
}
if ($prettyPretty)
$doc->formatOutput = true;
echo $doc->saveXML();
?>

135
trainerAuthorizations.php Normal file
View File

@ -0,0 +1,135 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "adminUtils.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE) && returnAdminStatus($_SESSION['MemberID']))
{
$courseID = NULL;
$memberID = NULL;
$options = array('options' => array('min_range' => 1));
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* Process form here
*/
if (isset($_POST['authorize']) && isset($_POST['course']) && isset($_POST['member']) &&
filter_var($_POST['course'], FILTER_VALIDATE_INT, $options) !== FALSE &&
filter_var($_POST['member'], FILTER_VALIDATE_INT, $options) !== FALSE)
{
insertIntoTrainerAuthTable($_POST['member'], $_POST['course']);
$memberID = $_POST['member'];
}
if (isset($_POST['courses']) && isset($_POST['courseID']) &&
filter_var($_POST['courseID']) !== FALSE)
{
$courseID = $_POST['courseID'];
}
else
if (isset($_POST['members']) && isset($_POST['memberID']) &&
filter_var($_POST['memberID']) !== FALSE)
{
$memberID = $_POST['memberID'];
}
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
$_SESSION['subNav'] = 1;
$body->appendChild(generateSelectedMenuBar($doc, $courseID));
/*
* Insert content here.
*/
$div = createDiv($doc);
$h3 = $doc->createElement('h3');
$h3->appendChild($doc->createTextNode('Filters'));
$div->appendChild($h3);
$form = createForm($doc, 'trainerAuthorizations.php');
$form->appendChild(generateCourseSelector($doc, 'courseID'));
$form->appendChild(createSubmitInput($doc, 'courses', 'Course Filter'));
$form->appendChild(createBr($doc));
$form->appendChild(generateMemberSelector($doc, 'memberID'));
$form->appendChild(createSubmitInput($doc, 'members', 'Member Filter'));
$div->appendChild($form);
$body->appendChild($div);
$body->appendChild(generateTrainerTable($doc, $courseID, $memberID));
$div = createDiv($doc);
$form = createForm($doc, 'trainerAuthorizations.php');
$form->appendChild(generateMemberSelector($doc, 'member'));
$form->appendChild(generateCourseSelector($doc, 'course'));
$form->appendChild(createSubmitInput($doc, 'authorize', 'Authorize'));
$div->appendChild($form);
$body->appendChild($div);
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
outputDoc($doc);
}
else
generateIndexRedirect();
?>

214
training.php Normal file
View File

@ -0,0 +1,214 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "trainingUtils.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE) &&
(returnInstructorStatus($_SESSION['MemberID']) || returnDirectorStatus($_SESSION['MemberID']) ||
returnAdminStatus($_SESSION['MemberID'])))
{
$sort_order = 'Ascending';
$rev_order = 'Descending';
$sort_field = NULL;
if ($_SERVER['REQUEST_METHOD'] === 'GET')
{
if (isset($_GET['Order']))
switch ($_GET['Order'])
{
case 'Decending':
$sort_order = 'Descending';
$rev_order = 'Ascending';
break;
case 'Ascending':
default:
$sort_order = 'Ascending';
$rev_order = 'Descending';
break;
}
if (isset($_GET['Sort']))
switch ($_GET['Sort'])
{
case 'Class':
$sort_field = 'Class';
break;
case 'Title':
$sort_field = 'Title';
break;
case 'Date':
$sort_field = 'Date';
break;
case 'Confirmed':
$sort_field = 'Confirmed';
break;
case 'Open':
$sort_field = 'Open';
break;
default:
$sort_field = NULL;
}
}
else
if ($_SERVER['REQUEST_METHOD'] === 'POST')
{
//print_r ($_POST);
if (isset($_POST['newClass']) && isset($_POST['startdate']) && isset($_POST['cost']) && isset($_POST['seats']))
{
$newClass_input = cleanInput($_POST['newClass']);
$startDateTime_input = date($dbDateTimeFormat,
strtotime(cleanInput($_POST['startdate']) . ' ' . cleanInput($_POST['starttime'])));
$cost_input = cleanInput($_POST['cost']);
$seats_input = cleanInput($_POST['seats']);
if (returnAdminStatus($_SESSION['MemberID']) || returnDirectorStatus($_SESSION['MemberID']))
{
if (isset($_POST['instructor']))
$instructor = cleanInput($_POST['instructor']);
else
$instructor = $_SESSION['MemberID'];
}
else
$instructor = $_SESSION['MemberID'];
insertIntoClassesTable($newClass_input, $instructor, $startDateTime_input, $cost_input, $seats_input);
}
else
{
logAccessViolation(1, "Incomplete form data submitted to training.php");
print ("Incomplete form data submitted. Access violation logged.");
}
//print_r ($course_input);
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
/*
$body->appendChild(generateMemberNavigationBar($doc));
$body->appendChild(generateTrainingNavigationBar($doc)); */
$_SESSION['subNav'] = "0";
$body->appendChild(generateSelectedMenuBar($doc, 0));
$myClassesDiv = createDiv($doc, NULL, 'ClassTableDiv');
$tableTitle = $doc->createElement('H3');
$tableTitle->appendChild($doc->createTextNode("Classes I'm Teaching"));
$myClassesDiv->appendChild($tableTitle);
$myClassesDiv->appendChild(generateTrainingTable($doc, NULL, $sort_order, $sort_field, '', NULL, $_SESSION['MemberID']));
$newClassDiv = createDiv($doc, 'NewClassDiv');
$form = createForm($doc, 'training.php');
$fieldSet = $doc->createElement('fieldset');
$h3 = $doc->createElement('h3');
$h3->appendChild($doc->createTextNode('Configure a New Class'));
$fieldSet->appendChild($h3);
$fieldSet->appendChild(createLabel($doc, "New class: ", 'newClass'));
if (returnAdminStatus($_SESSION['MemberID']) || returnDirectorStatus($_SESSION['MemberID']))
{
$fieldSet->appendChild(generateCourseSelector($doc, 'newClass', NULL));
$fieldSet->appendChild(createBr($doc));
$fieldSet->appendChild(createLabel($doc, 'Instructor: ', 'instructor'));
$fieldSet->appendChild(generateMemberSelector($doc, 'instructor', $_SESSION['MemberID']));
}
else
$fieldSet->appendChild(generateCourseSelector($doc, 'newClass', $_SESSION['MemberID']));
$fieldSet->appendChild(createBr($doc));
$fieldSet->appendChild(createLabel($doc, "Starting at: ", 'startdate'));
$fieldSet->appendChild(createDateInput($doc, 'startdate', (string)date('Y-m-d'), NULL, NULL, date($dbDateFormat)));
$fieldSet->appendChild(createTimeInput($doc, 'starttime', '08:00'));
$fieldSet->appendChild(createBr($doc));
$fieldSet->appendChild(createLabel($doc, 'Cost: ', 'cost'));
$fieldSet->appendChild(createNumberInput($doc, 'cost', '0.00', NULL, NULL, '0'));
$fieldSet->appendChild(createBr($doc));
$fieldSet->appendChild(createLabel($doc, 'Seats: ', 'seats'));
$seats = createNumberInput($doc, 'seats', '12', NULL, NULL, 1, 120);
$seats->setAttribute('step', '1');
$fieldSet->appendChild($seats);
$fieldSet->appendChild(createBr($doc));
$fieldSet->appendChild(createSubmitInput($doc, 'addClass', 'Add A Class'));
$form->appendChild($fieldSet);
$newClassDiv->appendChild($form);
$myClassesDiv->appendChild($newClassDiv);
$body->appendChild($myClassesDiv);
$myClassesDiv = $doc->createElement('div');
$myClassesDiv->setAttribute('id', 'ClassTableDiv');
$tableTitle = $doc->createElement('H3');
$tableTitle->appendChild($doc->createTextNode("Upcoming Classes"));
$myClassesDiv->appendChild($tableTitle);
$myClassesDiv->appendChild(generateTrainingTable($doc, 'training.php', $sort_order, $sort_field));
$body->appendChild($myClassesDiv);
/*
if (isset($_SESSION['FirstName']) && isset($_SESSION['LastName']))
{
}
$myClassesDiv->appendChild(generateBriefTrainingTable($doc, $baseDir));
*/
$body->appendChild(generateFooter($doc));
outputDoc($doc);
}
else
generateIndexRedirect();
?>

316
transactionEditor.php Normal file
View File

@ -0,0 +1,316 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "adminUtils.php";
include_once "formUtils.php";
$doc = returnDoc();
$root = returnRoot($doc);
$transactionInsite = null;
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE) && returnAdminStatus($_SESSION['MemberID']))
{
$targetMemberID = 0;
$targetTransactionID = NULL;
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* Process form data.
*/
//print_r ($_POST);
if (isset($_POST['selectedmember']))
{
$targetMemberID = $_POST['selectedmember'];
}
else
if (isset($_POST['id']))
{
if ($_POST['id'] === '0')
{
/*
* Insert
*/
insertIntoTransactionTable();
}
else
{
updateTransactionTable();
}
}
}
if ($_SERVER['REQUEST_METHOD'] == 'GET')
{
if (isset($_GET['member']))
{
$targetMemberID = $_GET['member'];
$targetTransactionID = $_GET['id'];
}
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
/*
$body->appendChild(generateMemberNavigationBar($doc));
$body->appendChild(generateAdminNavigationBar($doc));
*/
$_SESSION['subNav'] = 1;
$body->appendChild(generateSelectedMenuBar($doc, 1));
/*
* Insert content here.
*/
if (isset($_GET['id']))
{
$id = cleanInput($_GET['id']);
if (is_numeric($id))
{
$id = (int) $id;
$body->appendChild(generateTransactionDetail($doc, $id));
}
}
$body->appendChild(generateTransactionEditorForm($doc, $targetMemberID, $targetTransactionID));
$bodyDiv = $doc->createElement('div');
$tableDiv = $doc->createElement('div');
$tableDiv->appendChild(generateMemberLookupForm($doc, 'transactionEditor.php'));
/* if (!isset($_SESSION['TargetMemberID']))
$_SESSION['TargetMemberID'] = 0;*/
$tableDiv->appendChild(generateTransactionTable($doc, $targetMemberID));
$bodyDiv->appendChild($tableDiv);
/*
$editorDiv = $doc->createElement('div');
$editorDiv->setAttribute('id', 'MemberEditorDiv');
$form = $doc->createElement('form');
$form->setAttribute('action', 'transactionEditor.php');
$form->setAttribute('method', 'post');
$label = $doc->createElement('H3');
$label->appendChild($doc->createTextNode("Transaction Editor"));
$form->appendChild($label);
$label = $doc->createElement('input');
$label->setAttribute('type', 'hidden');
$label->setAttribute('name', 'id');
$label->setAttribute('readonly', 'readonly');
$form->appendChild($label);
$label = $doc->createElement('input');
$label->setAttribute('type', 'hidden');
$label->setAttribute('name', 'first_name');
$label->setAttribute('readonly', 'readonly');
$form->appendChild($label);
$label = $doc->createElement('input');
$label->setAttribute('type', 'hidden');
$label->setAttribute('name', 'last_name');
$label->setAttribute('readonly', 'readonly');
$form->appendChild($label);
$fieldSet = $doc->createElement('fieldset');
//$fieldSet->setAttribute('style', 'width:200px; max-width:300px;'); //margin-top:0.5em;');
$fieldSetDiv = $doc->createElement('div');
$label = $doc->createElement('label', 'Member ID:');
$label->setAttribute('for', 'member_id');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'number');
$input->setAttribute('name', 'member_id');
if ($targetMemberID > 0)
{
$input->setAttribute('value', "$targetMemberID");
$input->setAttribute('readonly', 'readonly');
}
$input->setAttribute('autocomplete', 'off');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Price:');
$label->setAttribute('for', 'total_price');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'number');
$input->setAttribute('name', 'total_price');
$input->setAttribute('autocomplete', 'off');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Reference:');
$label->setAttribute('for', 'reference_number');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'number');
$input->setAttribute('name', 'reference_number');
$input->setAttribute('autocomplete', 'off');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Quantity:');
$label->setAttribute('for', 'quantity');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'number');
$input->setAttribute('name', 'quantity');
$input->setAttribute('autocomplete', 'off');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Category:');
$label->setAttribute('for', 'category');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'category');
$input->setAttribute('autocomplete', 'off');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Account Type:');
$label->setAttribute('for', 'account_type');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'account_type');
$input->setAttribute('autocomplete', 'off');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Info-Source:');
$label->setAttribute('for', 'info_source');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'info_source');
$input->setAttribute('autocomplete', 'off');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Months Added:');
$label->setAttribute('for', 'months_added');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'number');
$input->setAttribute('name', 'months_added');
$input->setAttribute('autocomplete', 'off');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$label = $doc->createElement('label', 'Memo:');
$label->setAttribute('for', 'memo');
$label->setAttribute('class', 'MemberEditorInputLabel');
$fieldSetDiv->appendChild($label);
$input = $doc->createElement('input');
$input->setAttribute('type', 'text');
$input->setAttribute('name', 'memo');
$input->setAttribute('autocomplete', 'off');
$fieldSetDiv->appendChild($input);
$label = $doc->createElement('br');
$fieldSetDiv->appendChild($label);
$fieldSet->appendChild($fieldSetDiv);
$form->appendChild($fieldSet);
$input = $doc->createElement('input');
$input->setAttribute('type', 'reset');
$form->appendChild($input);
$input = $doc->createElement('input');
$input->setAttribute('type', 'submit');
$form->appendChild($input);
$editorDiv->appendChild($form);
*/
$body->appendChild($bodyDiv);
$body->appendChild(generateFooter($doc));
outputDoc($doc);
}
else
generateIndexRedirect();
?>

95
transactions.php Normal file
View File

@ -0,0 +1,95 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if ($_SESSION['login'] === TRUE)
{
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
//$body->appendChild(generateMemberNavigationBar($doc));
$_SESSION['subNav'] = NULL;
$body->appendChild(generateSelectedMenuBar($doc));
/*
* this needs a security rewrite
*/
if (isset($_GET['id']))
{
$id = cleanInput($_GET['id']);
if (is_numeric($id))
{
$id = (int) $id;
$body->appendChild(generateTransactionDetail($doc, $id));
}
}
if (isset($_SESSION['MemberID']))
$body->appendChild(generateTransactionTable($doc, $_SESSION['MemberID']));
$body->appendChild(generateFooter($doc));
outputDoc($doc);
}
?>

111
userCourses.php Normal file
View File

@ -0,0 +1,111 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if ($_SESSION['login'] === TRUE)
{
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
//$body->appendChild(generateMemberNavigationBar($doc));
$body->appendChild(generateSelectedMenuBar($doc));
/* if (isset($_SESSION['FirstName']) && isset($_SESSION['LastName']))
{
if ($_SESSION['sub_nav'] === "Admin")
$body->appendChild(generateAdminNavigationBar($doc));
else
$body->appendChild(generateTrainingTable($doc, 'userCourses.php');
} */
$myClassesDiv = $doc->createElement('div');
$myClassesDiv->setAttribute('id', 'ClassTableDiv');
$tableTitle = $doc->createElement('H3');
$tableTitle->appendChild($doc->createTextNode("Completed Courses"));
$myClassesDiv->appendChild($tableTitle);
$myClassesDiv->appendChild(populateUserTrainingTable($doc));
$body->appendChild($myClassesDiv);
$myClassesDiv = $doc->createElement('div');
$myClassesDiv->setAttribute('id', 'ClassTableDiv');
$tableTitle = $doc->createElement('H3');
$tableTitle->appendChild($doc->createTextNode("Current Course Schedule"));
$myClassesDiv->appendChild($tableTitle);
$myClassesDiv->appendChild(generateTrainingTable($doc, 'userCourses.php'));
$body->appendChild($myClassesDiv);
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
echo $doc->saveXML();
}
?>

97
userpage-template.php Normal file
View File

@ -0,0 +1,97 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "adminUtils.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE) && returnAdminStatus($_SESSION['MemberID']))
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* Process form here
*/
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
$_SESSION['subNav'] = NULL;
$body->appendChild(generateSelectedMenuBar($doc));
/*
* Insert content here.
*/
$body->appendChild(generateFooter($doc));
if ($prettyPretty)
$doc->formatOutput = true;
outputDoc($doc);
}
else
generateIndexRedirect();
?>

118
utilities.php Normal file
View File

@ -0,0 +1,118 @@
<?php
/*
Copyright 2018 Murray Hayes
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
session_start();
include_once "utils.php";
include_once "DOMUtils.php";
include_once "consts.php";
include_once "database.php";
include_once "directorUtils.php";
$doc = returnDoc();
$root = returnRoot($doc);
//if (!isset($_SESSION['login']) || !isset($_SESSION['MemberID']))
if (!validateSession())
if (!isset($_SESSION['cookieMonster']))
generateCookieMonster();
else
generateLoginRedirect();
else
if (($_SESSION['login'] === TRUE) && returnDirectorStatus($_SESSION['MemberID']))
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
/*
* Process form here
*/
if (isset($_POST['NewMeeting']))
if (isset($_POST['meeting_datetime']))
createMeeting($_POST['meeting_datetime'] . " 19:03:14");
else
createMeeting(date("y-m-d") . " 19:03:14");
else
if (isset($_POST['SelectMembers']) && isset($_POST['meeting']))
{
//print ("Selecting Members");
insertIntoMeetingAttendanceTable((int) $_POST['meeting']);
}
}
$root = $doc->appendChild($root);
$root->appendChild(generateHead($doc));
$body = $doc->createElement('body');
$root->appendChild($body);
$body->appendChild(generateMastHead($doc, $baseDir));
//$body->appendChild($doc->createElement('hr'));
/*
$body->appendChild(generateMemberNavigationBar($doc));
$body->appendChild(generateDirectorNavigationBar($doc));
*/
$body->appendChild(generateSelectedMenuBar($doc, 2));
/*
* Insert content here.
*/
$body->appendChild(generateMeetingAttendance($doc));
/* if ($_SERVER['REQUEST_METHOD'] === 'GET')
{
if (isset($_GET['search']))
{
$body->appendChild(generateMemberSelection($doc, "memberMeeting.php"));
}
}*/
//$body->appendChild(generateMemberSelection($doc, "memberMeeting.php", "useStatement230"));
$body->appendChild(generateFooter($doc));
outputDoc($doc);
}
else
generateIndexRedirect();
?>