Initial commit

This commit is contained in:
Ben Ramey
2015-11-12 19:58:50 -06:00
commit 4eb7f46e4c
86 changed files with 4341 additions and 0 deletions

57
passportinfo.php Normal file
View File

@@ -0,0 +1,57 @@
<?php
include 'php/classes/page.php';
include 'functions/func_xml.php';
$page = new Page();
$page->attr('title','Submit Your Passport Information');
$page->content('passportinfo.php');
// to make jquery be loaded first
$page->useJSFile('jquery.min.js');
$page->addJSFile('default.js');
# if form has not been submitted, then is probably the initial request
# for the page, so just display the form
if(!empty($_POST))
{
#print_r($_POST);
$passportFile = xml_get_from_file($FILES['passportinfo']);
$lastID = $passportFile->passport[count($passportFile) - 1]['id'];
# clean each entry up
foreach($_POST as $key => $val)
{
foreach($_POST[$key] as $key2 => $val2)
{
$_POST[$key][$key2] = strip_tags($_POST[$key][$key2]);
$_POST[$key][$key2] = htmlspecialchars($_POST[$key][$key2]);
}
}
# add new passports to file
for($c = 0; $c < count($_POST['passport_name']); $c++)
{
$newPassport = $passportFile->addChild('passport');
$newPassport->addAttribute('id',$lastID + 1);
$newPassport->addChild('name',$_POST['passport_name'][$c]);
$newPassport->addChild('birthdate',$_POST['passport_birthdate'][$c]);
$newPassport->addChild('number',$_POST['passport_number'][$c]);
$newPassport->addChild('expiration_date',$_POST['passport_expirationdate'][$c]);
$newPassport->addChild('expiration_country',$_POST['passport_country'][$c]);
}
# save the new xml file
file_put_contents($FILES['passportinfo'],$passportFile->asXML());
# add success message
$page->addMessage('Your passport information has been successfully submitted.');
# email to let john know he's got a new entry
$message = "You have another set of passport information available online.";
$subject = 'New passport information available.';
mail($CONFIG['email'],$subject,$message,"From: ".$CONFIG['email']);
}
$page->process();
?>