Add add_entry and delete_entry

This commit is contained in:
Gregory Soutade
2013-10-22 18:33:44 +02:00
parent f56d067483
commit c44e84124b
3 changed files with 254 additions and 28 deletions

View File

@@ -25,8 +25,16 @@ session_start();
$VIEW_CIPHERED_PASSWORDS=true;
$ADMIN_MODE=true;
if (isset($_GET['get_passwords']) && isset($_GET['user']))
return list_entries($_GET['user']);
if (isset($_POST['get_passwords']) && isset($_POST['user']))
return list_entries($_POST['user']);
if (isset($_POST['add_entry']) && isset($_POST['user']) &&
isset($_POST['login']) && isset($_POST['password']))
return add_entry($_POST['user'], $_POST['login'], $_POST['password']);
if (isset($_POST['delete_entry']) && isset($_POST['user']) &&
isset($_POST['login']))
return delete_entry($_POST['user'], $_POST['login']);
?>
<!DOCTYPE html>
@@ -96,16 +104,13 @@ else
if ($user != "")
{
echo "<b>Add a new password</b><br/>\n";
echo '<form method="post">' . "\n";
echo '<input type="hidden" name="user" value="' . $user . '"/>';
echo 'URL <input id="new_url" type="text" name="url"/>';
echo 'URL <input type="text" name="url"/>';
echo 'login <input type="text" name="login" />';
echo 'password <input id="new_password" type="text" name="pwd"/>';
echo 'master key <input id="new_mkey" type="password" name="mkey"/>';
echo 'password <input id="new_password" type="text" name="password"/>';
echo 'master key <input type="password" name="mkey"/>';
echo '<input type="button" value="Generate password" onClick="generate_password();"/>';
echo "<input type=\"submit\" name=\"add\" value=\"Add\" onclick=\"a = document.getElementById('new_url') ; a.value = url_domain(a.value); return derive_mkey('$user', 'new_mkey') ;\"/>";
echo '</form>' . "\n";
echo "<input type=\"button\" name=\"add\" value=\"Add\" onclick=\"add_password();\"/>";
}
?>
</div>