function pageController() { $nounArray = ['Tree', 'Bear', 'Wolf', 'Pedro', 'Pidgeon', 'Dog', 'Flower', 'Bull', 'Fox', 'Horse']; $adjectiveArray = ['Happy', 'Flaming', 'Flying', 'Screaming', 'Dancing', 'Soggy', 'Kicking', 'Running', 'Flailing', 'Many']; $data = []; $data['name'] = makeName(getRandom($nounArray, $adjectiveArray)); return $data; }
/** * fixedVars */ function fixedVars() { // Variable initialization global $module, $orderSum, $config; $basket = unserialize($orderSum['basket']); // Include PayFast common file define('PF_DEBUG', $module['debug_log'] ? true : false); include_once 'payfast_common.inc'; // Use appropriate merchant identifiers // Live if ($module['server'] == 1) { $merchantId = $module['merchant_id']; $merchantKey = $module['merchant_key']; } else { $merchantId = '10000100'; $merchantKey = '46f0cd694581a'; } // Create URLs $returnUrl = $GLOBALS['storeURL'] . '/index.php?_g=rm&type=gateway&cmd=process&module=PayFast&cart_order_id=' . $orderSum['cart_order_id']; $cancelUrl = $GLOBALS['storeURL'] . '/index.php?_g=rm&type=gateway&cmd=process&module=PayFast&cart_order_id=' . $orderSum['cart_order_id'] . '&c=1'; $notifyUrl = $GLOBALS['storeURL'] . '/index.php?_g=rm&type=gateway&cmd=call&module=PayFast'; // Get customer name $billingName = makeName($orderSum['name']); // Create description $description = ''; foreach ($basket['invArray'] as $item) { $description .= $item['quantity'] . ' x ' . $item['name'] . ' @ ' . number_format($item['price'] / $item['quantity'], 2, '.', ',') . 'ea = ' . number_format($item['price'], 2, '.', ',') . '; '; } $description .= 'Shipping = ' . $basket['shipCost'] . '; '; $description .= 'Tax = ' . $basket['tax'] . '; '; $description .= 'Total = ' . $basket['grandTotal']; // Set data for form posting $data = array('merchant_id' => $merchantId, 'merchant_key' => $merchantKey, 'return_url' => $returnUrl, 'cancel_url' => $cancelUrl, 'notify_url' => $notifyUrl, 'name_first' => substr(trim($billingName[2]), 0, 100), 'name_last' => substr(trim($billingName[3]), 0, 100), 'email_address' => substr(trim($orderSum['email']), 0, 255), 'item_name' => $GLOBALS['config']['storeName'] . ' Purchase, Order #' . $orderSum['cart_order_id'], 'item_description' => substr(trim($description), 0, 255), 'amount' => number_format($orderSum['prod_total'], 2, '.', ''), 'm_payment_id' => $orderSum['cart_order_id'], 'currency_code' => $config['defaultCurrency'], 'user_agent' => PF_USER_AGENT); // Create hidden form variables $hiddenVars = ''; foreach ($data as $key => $val) { $hiddenVars .= '<input type="hidden" name="' . $key . '" value="' . $val . '">'; } return $hiddenVars; }
$link = mysql_select_db($dbname, $cxn); $query_getID = "SELECT issue FROM publications WHERE onlyCol=1"; $result_getID = mysql_query($query_getID, $cxn) or die("Couldn't execute query 1"); $userIDr = mysql_fetch_assoc($result_getID); $currentIssue = $userIDr['issue']; function makeName($currentIssue) { if ($currentIssue > 12) { if ($i = $currentIssue % 12 == 0) { $i = 12; $v = $currentIssue / 12; } else { $i = $currentIssue % 12; $v = ($currentIssue - $i) / 12 + 1; } } else { $i = $currentIssue; $v = 1; } $str = 'Volume ' . $v . ', Issue ' . $i; return $str; } echo "\n<html>\n <title>Publications</title>\n <head></head>\n \n <body bgcolor=#dde6c6>\n \n <style type='text/css'>\n table {\n\t font-family:'Helvetica',serif;\n\t\t font-size: 11;\n\t }\n .source {display:block; border:1px solid #c2bba2; background-color:'white';}\n\t A:link {text-decoration: none; color: #645d41;}\n\tA:visited {text-decoration: none; color: #645d41;}\n\tA:active {text-decoration: none; color: #645d41;}\n\tA:hover {text-decoration: underline; color: #ddd6ba;}\n </style> \n \n <form>\n \n <table width=100% border=0 bgcolor=#dde6c6>\n <tr><td align='center'>\n\n <table width=660px border=0 bgcolor='white'>\n <tr>\n <td style='background-image: url(images/G.jpg)' align='center'><br /><br />Newsletter - a simple monthly publication to keep friends connected<br /><br /></td>\n </tr>\n <tr><td align='center'><a href='signup.php'>[Log in]</a><br /><br /></td></tr>\n </table><br />\n \n <table width=660px border=0 bgcolor='white'>\n \n <tr>\n <td align='center'>\n <br /><br />\n <table width=400px>\n <tr>\n <td align='center' class='source'><br />\n <strong>Most recent publication:</strong>\n <br /><br />"; $currentLink = $currentIssue . '.pdf'; $currentName = makeName($currentIssue); echo "<a href='publications/{$currentLink}'>{$currentName}</a><br /><br />\n </td></tr>\n </table>\n \n <br /><br />\n \n <strong>Archives:</strong>\n \n <br /><br />"; for ($i = $currentIssue - 1; $i > 0; $i--) { $currentName = makeName($i); echo "<a href='publications/{$i}.pdf'>{$currentName}</a><br />"; } echo "\n <br />\n Send any comments or suggestions to <strong>ejeshelman@gmail.com</strong>.<br /><br /><br />\n \n </td>\n </tr>\n \n </table>\n \n </td></tr>\n </table>\n \n </form>\n\n </body>\n\n</html>";
// Get data $conn = PdoHelper::getPdo(); $r = $conn->query("select competitor_id, first_name, last_name from {$competitorTable}"); $competitorRs = $r->fetchAll(PDO::FETCH_ASSOC); $r = $conn->query("select s.competitor_id as competitor_id, e.event_code as code, f.long_name as form_name" . " from {$scoringTable} s, {$eventTable} e, {$formTable} f" . " where s.event_id = e.event_id" . " and e.form_id = f.form_id" . " and s.competitor_id is not null"); $individualRs = $r->fetchAll(PDO::FETCH_ASSOC); $r = $conn->query("select g.name as group_name, gm.competitor_id as competitor_id" . " from {$groupTable} g, {$groupMemberTable} gm" . " where g.group_id = gm.group_id"); $groupRs = $r->fetchAll(PDO::FETCH_ASSOC); $conn = null; // Organize information $competitorIds = array(); $competitorName = array(); foreach ($competitorRs as $row) { $cmatId = makeCmatId($row['competitor_id']); $competitorIds[] = $cmatId; $competitorName[$cmatId] = makeName($row['first_name'], $row['last_name']); } $events = array(); foreach ($individualRs as $row) { $cmatId = makeCmatId($row['competitor_id']); if (!isset($events[$cmatId])) { $events[$cmatId] = array(); } $events[$cmatId][] = "{$row['code']}: {$row['form_name']}"; } foreach ($groupRs as $row) { $cmatId = makeCmatId($row['competitor_id']); if (!isset($events[$cmatId])) { $events[$cmatId] = array(); } $events[$cmatId][] = "Group: {$row['group_name']}";
array_push($array, $row[0] . ": " . $row[1] . " ships"); } $array = array_reverse($array); foreach ($array as &$row) { $bname = substr($row, 0, strpos($row, ":")); $num = substr($row, strpos($row, ":") + 2); $nm1 = substr($bname, 0, strpos($bname, ", ")); $get = "SELECT website FROM profiles WHERE name='{$nm1}'"; $result1 = $db->query($get); $array1 = $result1->fetchArray(); $nm2 = substr($bname, strpos($bname, ", ") + 2); //echo $nm2; $get2 = "SELECT website FROM profiles WHERE name='{$nm2}'"; $result2 = $db->query($get2); $array2 = $result2->fetchArray(); $sname = makeName($nm1, $nm2) . " or " . makeName($nm2, $nm1); $af1 = '(' . $db->query("SELECT affiliations FROM profiles WHERE name='{$nm1}'")->fetchArray()[0] . ')'; if (strlen($af1) < 3) { $af1 = ""; } $af2 = '(' . $db->query("SELECT affiliations FROM profiles WHERE name='{$nm2}'")->fetchArray()[0] . ')'; if (strlen($af2) < 3) { $af2 = ""; } echo "<table>\n <tr style='padding:2px'>\n <td><img src={$array1['0']} width=175px></td>\n <td><img src={$array2['0']} width=175px></td></tr>\n <tr style='text-align:center'>\n <td colspan='2'>{$nm1} {$af1} ♥ {$nm2} {$af2} : {$num}</td></tr>\n <tr style='text-align:center'>\n <td>{$sname}</td>\n <td style='text-align:center'><input class='counter' type='button' value='i ships it!!!' id='{$nm1}, {$nm2}'></td>\n </tr>\n </table>"; //name='$bname' onClick='shipIt($bname) echo "<br>"; // if(isset($_POST["$row"])) // { // $names = $_POST[$row]; // $get = "SELECT num FROM ships WHERE names='$names'";
function Header() { //Page header global $title; $user = "******"; $host = "localhost"; $password = ""; $dbname = "friendpaper"; $cxn = mysql_connect($host, $user, $password) or die("Couldn't connect to server"); $link = mysql_select_db($dbname, $cxn); // Get current issue $query_getID = "SELECT issue FROM publications WHERE onlyCol=1"; $result_getID = mysql_query($query_getID, $cxn) or die("Couldn't execute query 1"); $userIDr = mysql_fetch_assoc($result_getID); $currentIssue = $userIDr['issue']; if ($this->PageNo() == 1) { function makeName($currentIssue) { if ($currentIssue > 12) { if ($i = $currentIssue % 12 == 0) { $i = 12; $v = $currentIssue / 12; } else { $i = $currentIssue % 12; $v = ($currentIssue - $i) / 12 + 1; } } else { $i = $currentIssue; $v = 1; } $str = 'Vol. ' . $v . ', Issue ' . $i; return $str; } $getString = makeName($currentIssue); $this->SetFont('Helvetica', 'B', 10); $w = $this->GetStringWidth($title) + 6; $this->SetDrawColor(0, 0, 0); $this->SetFillColor(255, 255, 255); //$this->SetTextColor(220,50,50); //$this->SetLineWidth(.1); //$this->SetX(10);//(210-$w)/2); //$this->Cell(0,3,$title,1,0,'L',true); $this->SetX(160); //(210-$w)/2); $this->Ln(4); $this->SetDrawColor(0, 0, 0); $this->SetLineWidth(0.1); $this->Line(10, 39, 200, 39); $this->Line(10, 46, 200, 46); $this->SetFont('Times', '', 48); $this->Cell(0, 20, 'Mainely News', 0, 1, 'C'); $this->SetFont('Helvetica', '', 9); $this->MultiCell(0, 1, $getString . ' ', 0, 'R'); $this->Ln(7); $this->MultiCell(0, 1, 'Announcements & Events - Headlines - Updates - Blogs ', 0, 'C'); $this->Ln(5); //Save ordinate $this->y0 = $this->GetY(); } else { $getString = makeName($currentIssue); $this->SetFont('Helvetica', 'B', 10); $w = $this->GetStringWidth($title) + 6; $this->SetDrawColor(255, 255, 255); $this->SetFillColor(255, 255, 255); //$this->SetTextColor(220,50,50); $this->SetLineWidth(0); $this->SetX(10); //(210-$w)/2); $this->Cell(0, 3, $title, 1, 0, 'L', true); $this->SetX(160); //(210-$w)/2); $this->Cell(0, 3, $getString . ' - Page ' . $this->PageNo(), 1, 1, 'R', true); $this->Ln(4); $this->SetDrawColor(0, 0, 0); $this->SetLineWidth(0.1); $this->Line(10, 15, 200, 15); $this->Ln(10); //Save ordinate $this->y0 = $this->GetY(); } }