Mercurial > hg > fapweb
view print.php @ 763:20fd7d2040d1
Cosmetic.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 20 Nov 2014 11:43:55 +0200 |
parents | a088d62531dc |
children | b42b23073209 |
line wrap: on
line source
<? // // FAPWeb - Simple Web-based Demoparty Management System // Data printout / hardcopy output module // (C) Copyright 2012-2014 Tecnic Software productions (TNSP) // $sessionType = "admin"; require_once "mconfig.inc.php"; require_once "msite.inc.php"; require_once "msession.inc.php"; $pageCSS = "css/hardcopy.css"; // // Check if we are allowed to execute // if (!stCheckHTTPS() || !stAdmSessionAuth(TRUE)) { stSetupCacheControl(); stSessionEnd(SESS_ADMIN); stSetStatus(404, "Not Found"); cmPrintPageHeader("Error"); echo "<h1>Permission denied</h1>\n". "<p>You need to be logged in as administrator to access this data.</p>\n". "<p><a href=\"admin.php\">Click here for login form</a></p>\n"; cmPrintPageFooter(); exit; } // // Initialize // stSetupCacheControl(); if (!stConnectSQLDB()) die("Could not connect to SQL database."); stReloadSettings(); // // Handle request // switch (stGetRequestItem("type", "", TRUE)) { case "results": header("Content-Type: text/plain"); echo stGetCompoResultsASCIIStr(FALSE); break; case "emails": // // Generic e-mail data dump // $sql = "SELECT * FROM attendees WHERE email IS NOT NULL AND email != '' ORDER BY regtime DESC"; if (($res = stExecSQL($sql)) !== FALSE) { cmPrintPageHeader("E-mails"); $out1 = array(); $out2 = array(); foreach ($res as $item) { $out1[] = $item["name"]." <".$item["email"].">"; $out2[] = $item["email"]; } echo implode(", ", $out1)."<br /><hr /><br />\n". implode("<br />", $out1)."<br /><hr /><br />\n". implode(", ", $out2)."<br /><hr /><br />\n". implode("<br />", $out2)."<br /><hr />\n"; cmPrintPageFooter(); } break; case "votekeys": // // Print out votekeys as a table // $sql = "SELECT * FROM votekeys ORDER BY id ASC"; if (($res = stExecSQL($sql)) !== FALSE) { cmPrintPageHeader("Votekeys"); $keyLen = stGetSetting("userKeyLength"); echo "<table class=\"votekeys\">\n"; $index = 0; foreach ($res as $item) { if ($index == 0) echo "<tr>\n"; // This funny code is to ensure that the cells are of uniform width printf("<td><span class=\"keyid\">%03d</span> : ". "<span class=\"keycode\">%s</span></td>\n", $item["id"], str_repeat(" ", $keyLen - strlen($item["key"])).$item["key"]); if ($index++ >= 5) { echo "</tr>\n"; $index = 0; } } if ($index > 0) echo "</tr>\n"; echo "</table>\n"; cmPrintPageFooter(); } break; default: stSetStatus(404, "Not Found"); break; } ?>