Initial commit
This commit is contained in:
49
creditcard.php
Normal file
49
creditcard.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
include 'php/classes/page.php';
|
||||
include 'functions/func_xml.php';
|
||||
|
||||
$page = new Page();
|
||||
|
||||
$page->attr('title','Send Credit Card Information');
|
||||
$page->content('creditcard.php');
|
||||
// to make jquery be loaded first
|
||||
$page->useJSFile('jquery.min.js');
|
||||
$page->addJSFile('default.js');
|
||||
|
||||
# save form when it's submitted
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$ccFile = xml_get_from_file($FILES['ccinfo']);
|
||||
$lastID = $ccFile->creditcard[count($ccFile) - 1]['id'];
|
||||
|
||||
$newCC = $ccFile->addChild('creditcard');
|
||||
$newCC->addAttribute('id',$lastID + 1);
|
||||
|
||||
foreach($_POST as $key => $value)
|
||||
{
|
||||
# skip any forum values not starting with 'billing_' or 'card_'
|
||||
if(strpos($key,'billing_') === false && strpos($key,'card_') === false)
|
||||
continue;
|
||||
|
||||
# clean up form contents
|
||||
$value = strip_tags($value);
|
||||
$value = htmlspecialchars($value);
|
||||
|
||||
# add new child
|
||||
$newCC->addChild($key,$value);
|
||||
}
|
||||
|
||||
# save the new xml
|
||||
file_put_contents($FILES['ccinfo'],$ccFile->asXML());
|
||||
# give user a success message
|
||||
$page->addMessage('Your credit card information has been successfully submitted. Thank you.');
|
||||
# send email notification that new cc info is available
|
||||
$message = "You have another set of credit card information available online.";
|
||||
$subject = 'New credit card information available.';
|
||||
mail($CONFIG['email'],$subject,$message,"From: ".$CONFIG['email']);
|
||||
}
|
||||
|
||||
$page->process();
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user