示例#1
0
// is post set?
if (isset($_POST['mode'])) {
    // select user for label print out
    if ($_POST['mode'] == 'reprint' & isset($_POST['id'])) {
        // select user for label print out
        $sql = $db->prepare('SELECT * FROM attendees WHERE id = :id;');
        $sql->bindValue(':id', $_POST['id']);
        // query database
        $row = $sql->execute()->fetchArray();
    }
    if (count($row) > 0) {
        // require only if being called!
        require 'includes/NameTagPrinter.php';
        $render = new NameTagPrinter();
        $render->SetSaveDirectory($tmpdir);
        $render->SendToPrinter($row['firstname'] . ' ' . $row['lastname'], $row['company']);
        $displayMsg = 'Reprinted <strong>' . $row['firstname'] . ' ' . $row['lastname'] . '</strong> label successfully!<br />Please proceed to take your name tag label.';
    } else {
        $displayMsg = 'Failed. Invalid row id!';
    }
}
?>
<html>
<head>
	<title>Manual Tag Reprint</title>
	<link rel="stylesheet" type="text/css" href="style.css">
	<script type="text/javascript" src="includes/js/jquery.min.js"></script>
	<script type="text/javascript" src="includes/js/jquery.validate.min.js"></script>
	<script type="text/javascript" src="includes/js/noty/packaged/jquery.noty.packaged.min.js"></script>    
</head>
<body>
示例#2
0
?>
" method="POST" id="register-form">
				<label for="firstname">First Name:</label><input type="text" name="firstname" size="35"><br/><br/>
                <label for="lastname">Last Name:</label><input type="text" name="lastname" size="35"><br/><br/>
                <label for="email">Email Address:</label><input type="text" name="email" size="35"><br/><br/>
                <label for="company">Company:</label><input name="company" type="text" size="35"><br/><br/>
				<input type="radio" name="company_type" value="1" checked> Customer &nbsp;
				<input type="radio" name="company_type" value="2"> Partner &nbsp;
				<input type="radio" name="company_type" value="3"> Vendor &nbsp;
				<br/><br/>
                <input type="hidden" name="mode" value="register">
                <input type="submit" value="Register" class="register-button">
            </form>
        </div>
	</div>
</body>
</html>
<?php 
//print after page load, end user experience is quicker
if (isset($_SESSION)) {
    require 'includes/NameTagPrinter.php';
    $render = new NameTagPrinter();
    $render->SetSaveDirectory($tmpdir);
    $render->SendToPrinter($_SESSION['firstname'] . ' ' . $_SESSION['lastname'], $_SESSION['company']);
    //cleanup
    unset($render);
    session_unset();
}
?>
					
示例#3
0
                // execute shell cmd
                $cmdout = shell_exec($cmd);
                $displayMsg = 'System time set successfully!';
            } catch (Exception $e) {
                $displayMsg = 'Failed to set system time!';
            }
        } elseif (isset($_POST['test-print'])) {
            try {
                // need library to print
                require 'includes/NameTagPrinter.php';
                // create object
                $render = new NameTagPrinter();
                // needed for printer
                $render->SetSaveDirectory($labelPath);
                // send to printer
                $fullPdfPath = $render->SendToPrinter("Test Attendee", "Test Attendee Company");
                $displayMsg = 'Successfully sent command to print label!';
            } catch (Exception $e) {
                $displayMsg = 'Failed to send the print command to the label printer!<br/>Check CUPS configuration. Ensure default printer is selected.';
            }
        }
    } else {
        $displayMsg = 'Failed! Invalid master password!';
    }
    // cleanup
    unset($_POST);
    // debug info
    //var_dump($_POST);
    //echo $displayMsg;
}
?>