function thankYou() { $title = "Thank you!"; $message = "Your comment has been recorded."; showTitle($title, $message); pageLoads(); }
function secretPage() { $guide = ""; $message = ""; $content = ""; $page = isset($_GET['page']) ? trim($_GET['page']) : 'default'; $logout = isset($_GET['logout']) ? trim($_GET['logout']) : false; if ($logout) { unset($_SESSION["logged"]); session_destroy(); header('Location: ./'); } if ($page == 1) { $content = "This is the very first hidden page.<br/>only logged in users can access this."; } else { if ($page == 2) { $content = "Only logged in users can access this one."; } else { if ($page == 3) { $content = "This one is almost empty.."; } else { if ($page == 'default') { $guide = "Correct! Welcome to the hidden pages"; $content = ""; } } } } showTitle($guide, $message); showHiddenPages($content); }
function show_HTML_receipt($cust_id, $connection, &$template) { // Retrieve the customer details $query = "SELECT * FROM customer WHERE cust_id = {$cust_id}"; $result = $connection->query($query); if (DB::isError($result)) { trigger_error($result->getMessage(), E_USER_ERROR); } $row = $result->fetchRow(DB_FETCHMODE_ASSOC); // Is there an optional phone field? If so, add it to the output if (!empty($row["phone"])) { $template->setCurrentBlock("phone"); $template->setVariable("PHONE", $row["phone"]); $template->parseCurrentBlock("address"); } // Now, add all the mandatory fields to the output $template->setCurrentBlock(); $template->setVariable("EMAIL", $_SESSION["loginUsername"]); $template->setVariable("FIRSTNAME", $row["firstname"]); $template->setVariable("SURNAME", $row["surname"]); $template->setVariable("INITIAL", $row["initial"]); $template->setVariable("ADDRESS", $row["address"]); $template->setVariable("CITY", $row["city"]); $template->setVariable("STATE", $row["state"]); $template->setVariable("ZIPCODE", $row["zipcode"]); $template->setVariable("DOB", $row["birth_date"]); $template->setVariable("CUSTTITLE", showTitle($row["title_id"], $connection)); $template->setVariable("COUNTRY", showCountry($row["country_id"], $connection)); }
function show_HTML_receipt($custID, $orderID, $connection) { $template = new winestoreTemplate(T_ORDERRECEIPT); // Find customer information $query = "SELECT * FROM customer, users\n WHERE customer.cust_id = {$custID}\n AND users.cust_id = customer.cust_id"; $result = $connection->query($query); if (DB::isError($result)) { trigger_error($result->getMessage(), E_USER_ERROR); } $row = $result->fetchRow(DB_FETCHMODE_ASSOC); // Now setup all the customer fields $template->setVariable("CUSTTITLE", showTitle($row["title_id"], $connection)); $template->setVariable("SURNAME", $row["surname"]); $template->setVariable("CUST_ID", $custID); $template->setVariable("ORDER_ID", $orderID); $template->setVariable("FIRSTNAME", $row["firstname"]); $template->setVariable("INITIAL", $row["initial"]); $template->setVariable("ADDRESS", $row["address"]); $template->setVariable("CITY", $row["city"]); $template->setVariable("STATE", $row["state"]); $template->setVariable("COUNTRY", showCountry($row["country_id"], $connection)); $template->setVariable("ZIPCODE", $row["zipcode"]); $orderTotalPrice = 0; // list the particulars of each item in the order $query = "SELECT i.qty, w.wine_name, i.price, \n w.wine_id, w.year, wi.winery_name\n FROM items i, wine w, winery wi\n WHERE i.cust_id = {$custID}\n AND i.order_id = {$orderID}\n AND i.wine_id = w.wine_id\n AND w.winery_id = wi.winery_id\n ORDER BY item_id"; $result = $connection->query($query); if (DB::isError($result)) { trigger_error($result->getMessage(), E_USER_ERROR); } // Add each item to the page while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) { // Work out the cost of this line item $itemsPrice = $row["qty"] * $row["price"]; $orderTotalPrice += $itemsPrice; $wineDetail = showWine($row["wine_id"], $connection); $template->setCurrentBlock("row"); $template->setVariable("QTY", $row["qty"]); $template->setVariable("WINE", $wineDetail); $template->setVariable("PRICE", sprintf("\$%4.2f", $row["price"]), 11); $template->setVariable("TOTAL", sprintf("\$%4.2f", $itemsPrice)); $template->parseCurrentBlock("row"); } $template->setCurrentBlock("items"); $template->setVariable("ORDER_TOTAL", sprintf("\$%4.2f\n", $orderTotalPrice)); $template->parseCurrentBlock("items"); $template->setCurrentBlock(); $template->showWinestore(NO_CART, B_HOME); }
$nbcols = $DB->num_fields($result); $nbrows = $DB->numrows($result); $num = 1; $link = $_SERVER['PHP_SELF']; $order = 'ASC'; $issort = false; echo Search::showHeader($output_type, $nbrows, $nbcols, true); echo Search::showNewLine($output_type); showTitle($output_type, $num, PluginResourcesProfessionLine::getTypeName(1), 'professionline', true); showTitle($output_type, $num, PluginResourcesProfessionCategory::getTypeName(1), 'professioncategory', true); showTitle($output_type, $num, PluginResourcesProfession::getTypeName(1), 'profession', true); showTitle($output_type, $num, PluginResourcesProfession::getTypeName(1) . " - " . __('Code', 'resources'), 'profession_code', true); showTitle($output_type, $num, PluginResourcesRank::getTypeName(1), 'rank_name', true); showTitle($output_type, $num, PluginResourcesRank::getTypeName(1) . " - " . __('Code', 'resources'), 'rank_code', true); showTitle($output_type, $num, __('Begin date'), 'begin_date', true); showTitle($output_type, $num, __('End date'), 'end_date', true); echo Search::showEndLine($output_type); if ($limit) { $dataAll = array_slice($dataAll, $start, $limit); } foreach ($dataAll as $key => $data) { $num = 1; if (!is_numeric($data['professionline'])) { echo Search::showNewLine($output_type); echo Search::showItem($output_type, $data['professionline'], $num, $key); echo Search::showItem($output_type, '', $num, $key); echo Search::showItem($output_type, '', $num, $key); echo Search::showItem($output_type, '', $num, $key); echo Search::showItem($output_type, '', $num, $key); echo Search::showItem($output_type, '', $num, $key); echo Search::showItem($output_type, '', $num, $key);
<?php /**************************************************************************** * Name: trade.php * Author: Ben Barnes * Date: 2016-02-20 * Purpose: Trade page *****************************************************************************/ if (count($_POST)) { getGlobals_trade($getPage_connection2); performAction_trade($getPage_connection2); getGlobals_trade($getPage_connection2); header("Location: index.php?page=trade"); exit; } else { getGlobals_trade($getPage_connection2); showTitle("Trade"); compileMenu($getPage_connection2, "trade"); showWarning($getPage_connection2); showTradeInfo($getPage_connection2); require "section4.txt"; resetSession(true); } // else
$num = 1; $link = $_SERVER['PHP_SELF']; $order = 'ASC'; $issort = false; echo Search::showHeader($output_type, $nbrows, $nbcols, true); echo Search::showNewLine($output_type); showTitle($output_type, $num, __('Entity'), 'entity', true); showTitle($output_type, $num, __('Type'), 'type'); showTitle($output_type, $num, __('Name'), 'name', true); showTitle($output_type, $num, __('First name'), 'firstname', true); showTitle($output_type, $num, __('Administrative number'), 'registration_number', true); showTitle($output_type, $num, PluginResourcesProfession::getTypeName(1), 'profession', true); showTitle($output_type, $num, __('Arrival date', 'resources'), 'date_begin', true); showTitle($output_type, $num, __('Departure date', 'resources'), 'date_end', true); showTitle($output_type, $num, PluginResourcesProfession::getTypeName(1) . " - " . __('Begin date'), 'begin_date', true); showTitle($output_type, $num, PluginResourcesProfession::getTypeName(1) . " - " . __('End date'), 'end_date', true); echo Search::showEndLine($output_type); if ($limit) { $dataAll = array_slice($dataAll, $start, $limit); } foreach ($dataAll as $key => $data) { $num = 1; echo Search::showNewLine($output_type); echo Search::showItem($output_type, Dropdown::getDropdownName('glpi_entities', $data['entity']), $num, $key); if ($data['typeName'] == 'Resource') { $type = PluginResourcesResource::getTypeName(0); $link = Toolbox::getItemTypeFormURL("PluginResourcesResource"); } else { if ($data['typeName'] == 'Employment') { $type = PluginResourcesEmployment::getTypeName(0); $link = Toolbox::getItemTypeFormURL("PluginResourcesEmployment");
} } } if ($res && $nbtot > 0) { $nbCols = $DB->num_fields($res); $nbrows = $DB->numrows($res); $num = 1; $link = $_SERVER['PHP_SELF']; $order = 'ASC'; $issort = false; echo Search::showHeader($output_type, $nbrows, $nbCols, true); echo Search::showNewLine($output_type); showTitle($output_type, $num, __('Entity'), 'entity', true); showTitle($output_type, $num, __('Service'), 'groups_id', true); showTitle($output_type, $num, PluginTypologyTypology::getTypeName(1), 'typoID', true); showTitle($output_type, $num, __('Number', 'typology'), 'COUNT', true); echo Search::showEndLine($output_type); //By service and typology $queryService = "SELECT count(*) AS COUNT,\n `glpi_plugin_typology_typologies`.`entities_id` AS entity,\n `glpi_computers`.`groups_id`,\n `glpi_plugin_typology_typologies`.`id` AS typoID\n FROM `glpi_plugin_typology_typologies_items`\n LEFT JOIN `glpi_plugin_typology_typologies`\n ON(`glpi_plugin_typology_typologies_items`.`plugin_typology_typologies_id`\n = `glpi_plugin_typology_typologies`.`id`)\n LEFT JOIN `glpi_computers`\n ON (`glpi_plugin_typology_typologies_items`.`items_id` = `glpi_computers`.`id`\n AND `glpi_plugin_typology_typologies_items`.`itemtype` = 'Computer')\n LEFT JOIN `glpi_entities`\n ON (`glpi_plugin_typology_typologies`.`entities_id` = `glpi_entities`.`id`)\n WHERE {$condition} {$sqltypo}\n GROUP BY `glpi_entities`.`entities_id`,\n `glpi_computers`.`groups_id`,\n `glpi_plugin_typology_typologies`.`id`" . getOrderBy('entity', $columns); $resultService = $DB->query($queryService); $row_num = 1; while ($dataService = $DB->fetch_assoc($resultService)) { if ($dataService['groups_id'] == 0) { $serviceName = __('None'); } else { $serviceName = Dropdown::getDropdownName("glpi_groups", $dataService['groups_id']); } if ($dataService['typoID'] == '0') { $typoName = __('None'); } else { $typoName = Dropdown::getDropdownName("glpi_plugin_typology_typologies", $dataService["typoID"]);
<?php /**************************************************************************** * Name: forum.php * Author: Ben Barnes * Date: 2016-02-20 * Purpose: Forum page *****************************************************************************/ getGlobals_forum($getPage_connection2); showTitle("Forum"); compileMenu($getPage_connection2, "forum"); showWarning($getPage_connection2); showForumInfo($getPage_connection2); require "section4.txt"; resetSession(true);
<?php /**************************************************************************** * Name: admin.php * Author: Ben Barnes * Date: 2016-02-20 * Purpose: Admin page *****************************************************************************/ if ($_SESSION["admin"] == 1) { if (count($_POST)) { getGlobals_admin($getPage_connection2); performAction_admin($getPage_connection2, $getPage_connection3); getGlobals_admin($getPage_connection2); header("Location: index.php?page=admin"); exit; } else { getGlobals_admin($getPage_connection2); showTitle("Admin"); compileMenu($getPage_connection2, "admin"); showWarning($getPage_connection2); showAdminInfo($getPage_connection2); require "section4.txt"; resetSession(true); } // else } else { echo "Illegal administration attempt: you do not have the required admin clearance to use this script."; } // else
<?php /**************************************************************************** * Name: policies.php * Author: Ben Barnes * Date: 2016-02-20 * Purpose: Policies page *****************************************************************************/ if (count($_POST)) { getGlobals_policies($getPage_connection2); performAction_policies($getPage_connection2); getGlobals_policies($getPage_connection2); header("Location: index.php?page=policies"); exit; } else { getGlobals_policies($getPage_connection2); showTitle("Policies"); compileMenu($getPage_connection2, "policies"); showWarning($getPage_connection2); showPoliciesInfo($getPage_connection2); require "section4.txt"; resetSession(true); } // else
showTitle($output_type, $num, __('Priority'), 'priority', true); showTitle($output_type, $num, _n('Requester', 'Requesters', 2), '', false); showTitle($output_type, $num, __('Type'), 'type', true); showTitle($output_type, $num, __('Category'), 'itilcategories_id', true); showTitle($output_type, $num, __('Title'), 'name', true); showTitle($output_type, $num, __('Closing date'), 'closedate', true); showTitle($output_type, $num, __('Request source'), 'requesttypes_id', true); showTitle($output_type, $num, __('Take into account time'), 'takeintoaccount_delay_stat', true); showTitle($output_type, $num, __('SLA'), 'slas_id', true); if (!empty($mylevels)) { foreach ($mylevels as $key => $val) { showTitle($output_type, $num, $key, '', false); showTitle($output_type, $num, __('Duration by', 'timelineticket') . " " . $key, '', false); } } showTitle($output_type, $num, __('Total duration of ticket', 'timelineticket'), 'TOTAL', false); echo Search::showEndLine($output_type); $row_num = 1; while ($data = $DB->fetch_assoc($res)) { //Requesters $userdata = ''; $ticket = new Ticket(); $ticket->getFromDB($data['id']); if ($ticket->countUsers(CommonITILActor::REQUESTER)) { foreach ($ticket->getUsers(CommonITILActor::REQUESTER) as $d) { $k = $d['users_id']; if ($k) { $userdata .= getUserName($k); } if ($ticket->countUsers(CommonITILActor::REQUESTER) > 1) { $userdata .= "<br>";
<?php /**************************************************************************** * Name: organizations.php * Author: Ben Barnes * Date: 2016-02-20 * Purpose: Organizations page *****************************************************************************/ if (count($_POST)) { getGlobals_organizations($getPage_connection2); performAction_organizations($getPage_connection2); getGlobals_organizations($getPage_connection2); header("Location: index.php?page=organizations"); exit; } else { getGlobals_organizations($getPage_connection2); showTitle("Organizations"); compileMenu($getPage_connection2, "organizations"); showWarning($getPage_connection2); showOrganizationsInfo($getPage_connection2); require "section4.txt"; resetSession(true); } // else
<?php /**************************************************************************** * Name: deactivate.php * Author: Ben Barnes * Date: 2016-02-20 * Purpose: Deactivate page *****************************************************************************/ if (count($_POST)) { getGlobals_deactivate($getPage_connection2); performAction_deactivate($getPage_connection2); getGlobals_deactivate($getPage_connection2); header("Location: index.php?page=deactivate"); exit; } else { getGlobals_deactivate($getPage_connection2); showTitle("Deactivate"); compileMenu($getPage_connection2, "deactivate"); showWarning($getPage_connection2); showDeactivateInfo($getPage_connection2); require "section4.txt"; resetSession(true); } // else
startSession(); ?> <?php include('header.php'); if(beforeRunFunctions()) { exit; }; if(isset($_GET)){ $_SESSION['GET'] = $_GET; } ?> <body> <div id="outerHeader"> </div> <div id="main"> <div id="title"> <?php showTitle(); ?> </div> <div id="banner"> <?php showBanner(); ?> </div> <div id="container"> <div id="content"> <div id="leftMargin"> <?php showLeftBar(); ?> </div> <?php showRightBar(); ?> <div id="topToolbar" class="ajax"> <?php showTopToolbar(); ?> </div> <div id="bodyContent" class="ajax"> <?php showContent(); ?>
<?php /**************************************************************************** * Name: map.php * Author: Ben Barnes * Date: 2016-02-20 * Purpose: Map page *****************************************************************************/ if (count($_POST)) { getGlobals_map($getPage_connection2); performAction_map($getPage_connection2); getGlobals_map($getPage_connection2); header("Location: index.php?page=map"); exit; } else { getGlobals_map($getPage_connection2); showTitle("Map"); compileMenu($getPage_connection2, "map"); showWarning($getPage_connection2); showMap($getPage_connection2); showMapInfo($getPage_connection2); require "section4.txt"; resetSession(true); } // else
echo Search::showNewLine($output_type); showTitle($output_type, $num, PluginResourcesProfessionCategory::getTypeName(1), 'professioncategory', true); showTitle($output_type, $num, PluginResourcesProfessionLine::getTypeName(1), 'professionline', true); showTitle($output_type, $num, PluginResourcesProfession::getTypeName(1), 'profession', true); showTitle($output_type, $num, PluginResourcesRank::getTypeName(1), 'rank', true); showTitle($output_type, $num, __('Begin date'), 'begin_date', true); showTitle($output_type, $num, __('End date'), 'end_date', true); showTitle($output_type, $num, PluginResourcesBudgetType::getTypeName(1), 'budget_type', true); showTitle($output_type, $num, __('Budget volume(qty)', 'resources'), 'qt_vol_budg_vot', true); showTitle($output_type, $num, __('Employment volume (qty)', 'resources'), 'qt_vol_budg_use'); showTitle($output_type, $num, __('Resource volume (qty)', 'resources'), 'qt_vol_real'); showTitle($output_type, $num, __('Remaining budget - employment (qty)', 'resources'), 'solde_qt'); showTitle($output_type, $num, __('Budget volume (€)', 'resources'), 'vol_budg_vot'); showTitle($output_type, $num, __('Employment volume (€)', 'resources'), 'vol_budg_use'); showTitle($output_type, $num, __('Resource volume (€)', 'resources'), 'vol_real'); showTitle($output_type, $num, __('Remaining budget - employment (€)', 'resources'), 'solde'); echo Search::showEndLine($output_type); $totalvolbudget = 0; $totalvolemployment = 0; $totalvolresource = 0; $totalamountbudget = 0; $totalamountemployment = 0; $totalamountresource = 0; $totalbudgetemployment = 0; //For each budget for ($row_num = 2; $data = $DB->fetch_assoc($res); $row_num++) { $num = 1; echo Search::showNewLine($output_type); echo Search::showItem($output_type, Dropdown::getDropdownName('glpi_plugin_resources_professioncategories', $data['professioncategory']), $num, $row_num); echo Search::showItem($output_type, Dropdown::getDropdownName('glpi_plugin_resources_professionlines', $data['professionline']), $num, $row_num); echo Search::showItem($output_type, Dropdown::getDropdownName('glpi_plugin_resources_professions', $data['profession']), $num, $row_num);
/**************************************************************************** * Name: home.php * Author: Ben Barnes * Date: 2016-02-20 * Purpose: Home page *****************************************************************************/ if (count($_POST)) { getGlobals_home($getPage_connection2); performAction_home($getPage_connection2); getGlobals_home($getPage_connection2); header("Location: index.php?page=home"); exit; } else { if (count($_GET) > 1) { getGlobals_home($getPage_connection2); performAction_home($getPage_connection2); getGlobals_home($getPage_connection2); header("Location: index.php?page=home"); exit; } else { getGlobals_home($getPage_connection2); showTitle("Home"); compileMenu($getPage_connection2, "home"); showWarning($getPage_connection2); showHomeTitle($getPage_connection2); showHomeInfo($getPage_connection2); require "section4.txt"; resetSession(true); } } // else
<?php require __DIR__ . '/../vendor/autoload.php'; use AdrienBrault\ItunesClient\ItunesClient; $client = ItunesClient::factory(array('country' => 'gb')); $command = $client->getCommand('lookup_command', array('id' => '343200656,398157641,499511971')); $result = $command->execute(); showTitle('Lookup angry birds original+seasons+space in the GB store:'); foreach ($result['results'] as $result) { echo $result['trackName'] . PHP_EOL; echo str_repeat('-', strlen($result['trackName'])) . PHP_EOL; echo 'Genres: ' . join(', ', $result['genres']) . PHP_EOL; echo 'Price: ' . $result['price'] . ' ' . $result['currency'] . PHP_EOL; echo PHP_EOL; } function showTitle($title) { echo $title . PHP_EOL; echo str_repeat('=', strlen($title)) . PHP_EOL; echo PHP_EOL; }
<?php /**************************************************************************** * Name: settings.php * Author: Ben Barnes * Date: 2016-02-20 * Purpose: Settings page *****************************************************************************/ if (count($_POST)) { getGlobals_settings($getPage_connection2); performAction_settings($getPage_connection2); getGlobals_settings($getPage_connection2); header("Location: index.php?page=settings"); exit; } else { getGlobals_settings($getPage_connection2); showTitle("Settings"); compileMenu($getPage_connection2, "settings"); showWarning($getPage_connection2); showSettingsInfo($getPage_connection2); require "section4.txt"; resetSession(true); } // else
<?php /**************************************************************************** * Name: help.php * Author: Ben Barnes * Date: 2016-02-20 * Purpose: Help page *****************************************************************************/ getGlobals_help($getPage_connection2); showTitle("Help"); compileMenu($getPage_connection2, "help"); showWarning($getPage_connection2); showHelpInfo($getPage_connection2); require "section4.txt"; resetSession(true);
namespace ScriptAcid; if (!defined("KERNEL_INCLUDED") || KERNEL_INCLUDED !== true) { die; } $APP->addCSS($APP->getTemplatePath() . "/css/screen.css"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" lang="ru"> <head> <title><?php echo getSiteName(); ?> :: <?php showTitle(); ?> </title> <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" /> <?php $APP->showHeader(); ?> </head> <body> <?php if ($APP->USER->IsAdmin()) { ?> <?php echo showPanel(); } ?>
$created = JHTML::Date($row->created); } else { $created = ''; } echo "<div class=\"cp_result\">\n"; switch ($view) { case 'title': showTitle($row, $params); break; case 'fullintro': showTitle($row, $params); showFullIntro($ce, $row, $searchword, $params); break; case 'intro': default: showTitle($row, $params); showIntro($row, $searchword, $params); break; } if ($show_tags) { echo showTags($ce, $row->id, $params); } if ($params->get('show_create_date')) { echo "<div class=\"cp_create_date\">{$created}</div>\n"; } echo "</div>\n"; } } } echo "\r\n\t\t</td>\r\n\t</tr>\n"; if ($total > $limit) {
} } } } output_acc_table($ret); } else { if ($p_cmd == 'addnew') { $db->add_history($p_sid, $p_pwd, $p_val); } else { if ($p_cmd == 'delete') { $db->del($p_sid); } else { if ($p_cmd == 'unlockall') { $db->unlockall(); } else { showTitle('done'); } } } } } } } function showTitle($ts) { $dom = new DOMDocument('1.0'); $title = $dom->createElement('title', $ts); $dom->appendChild($title); echo $dom->saveHTML(); } function output_acc_table($arrret)
<?php /**************************************************************************** * Name: info.php * Author: Ben Barnes * Date: 2016-02-20 * Purpose: Info page *****************************************************************************/ if (count($_POST)) { getGlobals_info($getPage_connection2); performAction_info($getPage_connection2); getGlobals_info($getPage_connection2); header("Location: index.php?page=info"); exit; } else { getGlobals_info($getPage_connection2); showTitle("Info"); compileMenu($getPage_connection2, "info"); showWarning($getPage_connection2); showPageTitle($getPage_connection2, "Info", false); showInfoInfo($getPage_connection2); require "section4.txt"; resetSession(true); } // else
<?php /**************************************************************************** * Name: terms.php * Author: Ben Barnes * Date: 2016-02-20 * Purpose: Terms page *****************************************************************************/ getGlobals_terms($getPage_connection2); showTitle("Terms"); compileMenu($getPage_connection2, "terms"); showWarning($getPage_connection2); showPageTitle($getPage_connection2, "Terms and Conditions and Privacy Policy", false); showTermsInfo($getPage_connection2); require "section4.txt"; resetSession(true);
<?php /**************************************************************************** * Name: about.php * Author: Ben Barnes * Date: 2016-02-20 * Purpose: About page *****************************************************************************/ getGlobals_about($getPage_connection2); showTitle("About"); compileMenu($getPage_connection2, "about"); showWarning($getPage_connection2); showPageTitle($getPage_connection2, "About", false); showAboutInfo($getPage_connection2); require "section4.txt"; resetSession(true);
<?php $title = $_COOKIE["aigis_title"]; $frame = $_COOKIE["aigis_frame"]; function showTitle($ts) { $dom = new DOMDocument('1.0'); $title = $dom->createElement('title', $ts); $dom->appendChild($title); echo $dom->saveHTML(); } function showFrame($fs) { echo '<iframe src="', $fs, '" width="960" height="640" scrolling="no" frameborder="0" border="0" style="position:absolute;left:0;top:0px;" />'; } showTitle($title); showFrame($frame);
function send_confirmation_email($custID, $orderID, $connection) { $template = new HTML_Template_ITX(D_TEMPLATES); $template->loadTemplatefile(T_EMAIL, true, true); // Find customer information $query = "SELECT * FROM customer, users\n WHERE customer.cust_id = {$custID}\n AND users.cust_id = customer.cust_id"; $result = $connection->query($query); if (DB::isError($result)) { trigger_error($result->getMessage(), E_USER_ERROR); } $row = $result->fetchRow(DB_FETCHMODE_ASSOC); // Start by setting up the "To:" email address $to = "{$row["firstname"]} {$row["surname"]} <{$row["user_name"]}>"; // Now setup all the customer fields $template->setVariable("TITLE", showTitle($row["title_id"], $connection)); $template->setVariable("SURNAME", $row["surname"]); $template->setVariable("CUST_ID", $custID); $template->setVariable("ORDER_ID", $orderID); $template->setVariable("FIRSTNAME", $row["firstname"]); $template->setVariable("INITIAL", $row["initial"]); $template->setVariable("ADDRESS", $row["address"]); $template->setVariable("CITY", $row["city"]); $template->setVariable("STATE", $row["state"]); $template->setVariable("COUNTRY", showCountry($row["country_id"], $connection)); $template->setVariable("ZIPCODE", $row["zipcode"]); $orderTotalPrice = 0; // list the particulars of each item in the order $query = "SELECT i.qty, w.wine_name, i.price, \n w.wine_id, w.year, wi.winery_name\n FROM items i, wine w, winery wi\n WHERE i.cust_id = {$custID}\n AND i.order_id = {$orderID}\n AND i.wine_id = w.wine_id\n AND w.winery_id = wi.winery_id\n ORDER BY item_id"; $result = $connection->query($query); if (DB::isError($result)) { trigger_error($result->getMessage(), E_USER_ERROR); } // Add each item to the email while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) { // Work out the cost of this line item $itemsPrice = $row["qty"] * $row["price"]; $orderTotalPrice += $itemsPrice; $wineDetail = showWine($row["wine_id"], $connection); $template->setCurrentBlock("row"); $template->setVariable("QTY", str_pad($row["qty"], 9)); $template->setVariable("WINE", str_pad(substr($wineDetail, 0, 53), 55)); $template->setVariable("PRICE", str_pad(sprintf("\$%4.2f", $row["price"]), 11)); $template->setVariable("TOTAL", str_pad(sprintf("\$%4.2f", $itemsPrice), 12)); $template->parseCurrentBlock("row"); } $template->setCurrentBlock("items"); $template->setVariable("ORDER_TOTAL", sprintf("\$%4.2f\n", $orderTotalPrice)); $template->parseCurrentBlock("items"); $template->setCurrentBlock(); $template->parseCurrentBlock(); $out = $template->get(); if (USE_PEAR == false) { // -------------------------------------------- // The internal PHP mail() function is used only if USE_PEAR is false // Now, setup the "Subject:" line $subject = "Hugh and Dave's Online Wines: Order Confirmation"; // And, last (before we build the email), set up some mail headers $headers = "From: Hugh and Dave's Online Wines " . "<*****@*****.**>\r\n"; $headers .= "X-Sender: <*****@*****.**>\r\n"; $headers .= "X-Mailer: PHP\r\n"; $headers .= "Return-Path: <*****@*****.**>\r\n"; // Send the email! mail($to, $subject, $out, $headers); // -------------------------------------------- } else { // -------------------------------------------- // Use the PEAR Mail package and SMTP since USE_PEAR is true // Now, setup the "Subject:" line $headers["Subject"] = "Hugh and Dave's Online Wines: Order Confirmation"; // And, last (before we build the email), set up some mail headers $headers["From"] = "Hugh and Dave's Online Wines " . "<*****@*****.**>"; $headers["X-Sender"] = "<*****@*****.**>"; $headers["X-Mailer"] = "PHP"; $headers["Return-Path"] = "<*****@*****.**>"; $smtpMail =& Mail::factory("smtp"); $smtpMail->send($to, $headers, $out); // -------------------------------------------- } }
<?php require __DIR__ . '/../vendor/autoload.php'; use AdrienBrault\ItunesClient\ItunesClient; $client = ItunesClient::factory(array('country' => 'us')); $command = $client->getCommand('feed_command', array('type' => 'toppaidapplications', 'format' => 'json', 'size' => 10)); $result = $command->execute(); showTitle('Top 10 paid ios application in the US:'); foreach ($result['feed']['entry'] as $entry) { echo '- ' . $entry['title']['label'] . PHP_EOL; } function showTitle($title) { echo $title . PHP_EOL; echo str_repeat('=', strlen($title)) . PHP_EOL; echo PHP_EOL; }