<?php print_head('Nametag'); ?> </head> <body> <div id="main"> <h1>Nametag</h1> <?php if (array_key_exists('uid', $_GET)) { echo <<<EOF \t\t\t<h2>Automagic</h2> \t\t\t<div> EOF; $pdo = new PDO('sqlite:../sucker/hovselist.db'); generate_nametag($pdo, Mole::getMoleByUid($pdo, (int) $_GET['uid'])); echo <<<EOF \t\t\t</div> EOF; } else { echo <<<EOF \t\t\t<h2>Enter Your UID</h2> \t\t\t<form action="./" method="get"> \t\t\t\t<div class="form-control"> \t\t\t\t\t<label for="uid">UID</label> \t\t\t\t\t<div class="input-group"> \t\t\t\t\t\t<input type="text" id="uid" name="uid" /> \t\t\t\t\t</div> \t\t\t\t</div> \t\t\t\t<div class="form-control">
$content = $fail ? 'Failed to restart Mailingset.' : 'Successfully restarted Mailingset.'; break; case 'insert': $mole = new Mole(); foreach ($_POST as $field => $val) { if (property_exists('Mole', $field)) { $mole->{$field} = $val; } } $content = $mole->insert($pdo); if (!$content and array_key_exists('major', $_POST)) { $content = $mole->setMajors($pdo, explode(',', $_POST['major'])); } break; case 'update': $mole = Mole::getMoleByUid($pdo, (int) $_POST['uid']); foreach ($_POST as $field => $val) { if (property_exists('Mole', $field . 'Bak')) { $mole->{$field} = $val; } } $content = $mole->update($pdo); if (!$content and array_key_exists('major', $_POST)) { $majors = explode(',', $_POST['major']); $majors_bak = array_keys($mole->getMajors($pdo)); if (count($majors) != count($majors_bak) or array_diff($majors, $majors_bak)) { $content = $mole->setMajors($pdo, $majors); } } break; default: