Mercurial > hg > fapweb
view print.php @ 120:2c594958050e
Make test vote keys "testN" where N >= 1
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 22 Oct 2013 14:22:26 +0300 |
parents | d9de08fb5b28 |
children | 7d9e8c82e744 |
line wrap: on
line source
<? // // Printing / hardcopy output helper module // $sessionType = "admin"; require "mconfig.inc.php"; require "msite.inc.php"; require "mcommon.inc.php"; require "msession.inc.php"; $pageCSS = "hardcopy.css"; // Check if we are allowed to execute if (!stCheckHTTPS() || !stAdmSessionAuth(TRUE)) { stSetupCacheControl(); stSessionEnd(SESS_ADMIN); stSetStatus(404, "Not Found"); exit; } stSetupCacheControl(); // Initiate SQL database connection if (!stConnectSQLDB()) die("Could not connect to SQL database."); // Fetch non-"hardcoded" settings from SQL database stReloadSettings(); if (stChkRequestItem("type")) $type = $_REQUEST["type"]; switch ($type) { case "email": // // Generic e-mail data dump // $sql = "SELECT * FROM attendees WHERE email 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(""); echo "<table class=\"votekeys\">\n"; $index = 0; foreach ($res as $item) { if ($index == 0) echo "<tr>\n"; printf("<td><span class=\"keyid\">%03d</span> : <span class=\"keycode\">%-".$keyLen."s</span></td>\n", $item["id"], $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; } ?>