- shell_exec: documentation ( source)
- escapeshellarg: documentation ( source)
<?php
$passwd = 'censored';
$username = 'archive.zip';
if (isset ($_POST['password'])) {
if ($_POST['password'] == $passwd) {
if (isset ($_POST['username'])) { $username = escapeshellarg ($_POST['username']); }
echo "<pre>";
echo shell_exec ("sh sync.sh {$username} {$passwd}");
echo "</pre>";
}
else {
outputPage ("Your password didn't check out, mon. Better try it again, eh?");
}
}
else { outputPage(); }
function outputPage ($errorMessage = '') {
echo <<<HTML
<html><head><title>Mail Sync</title>
<style type="text/css">
td.left { text-align: right; }
td.right { text-align: left; }
div { color: red; border: 1px solid gray; padding: 4px; }
</style>
</head>
<body>
HTML;
if (!empty ($errorMessage)) { echo "\n<div>$errorMessage</div>\n"; }
echo <<<HTMLL
<h1>Mail Sync</h1>
<form name="zipform" method="post" action="unzipper.php">
<table>
<tr>
<td class="left">Username:</td>
<td class="right"><input type="text" name="username" size="50" maxlength="255" />@mcsmortgage.com</td>
</tr><tr>
<td class="left">Password:</td>
<td class="right"><input type="password" name="password" size="15" maxlength="30" /></td>
</tr><tr>
<td class="right"><input type="reset" value="Reset" /></td>
<td class="left"><input type="submit" value="Sync Mail!" /></td>
</tr>
</table>
</form>
</body>
</html>
HTMLL;
}
?>