Bookmark a page that auto-posts your login

The idea is this: I am tired of logging into the same site over and over again. This is a simple GET to POST converter. The page helps you create a URL that you can bookmark. When you use this link, your data to POST is sent to your server in the form of GET. Your webserver then translates the GET parameters into a form and POSTS to the server you’re trying to login to. So, the sensative data is kept on your computer in the bookmark (the URL). Since you don’t want anybody to be able to just read your username and password, this script will encrypt the data in the URL so your bookmark contains nothing but encrypted data.


<?php
define(‘mkey’, ‘8KJFDi8f709′);
?>
<html>
<head>
<title>Get To Post</title>

<script language=”javascript”>
<!–
function postform() {
<?php
if ( $_GET[‘url’] ) {
print “document.daform.submit();\n”;
}
?>
}
// — >
</script>

</head>
<body onLoad=”postform()”>

<form method=”POST” name=”daform” <?=($_GET[‘url’] ? ‘action=”‘.htmlspecialchars($_GET[‘url’]).'”‘ : ” )?>>
<?php
if ( $_GET[‘url’] ) {
while ( list($key, $val) = each ($_GET) ) {
if ( $key != ‘url’ )
print ‘<input type=”hidden” name=”‘.htmlspecialchars($key).'” value=”‘.htmlspecialchars(mcrypt_ecb(MCRYPT_3DES, mkey, $val, MCRYPT_DECRYPT)).'”>’.”\n”;
}
print ‘<input type=”submit” value=”GO NOW”>’.”\n”;
}
?>
</form>

<?php
if ($_POST[‘url’]) {
print “Your URL to bookmark is:<br>”.$_SERVER[‘SCRIPT_URI’].”?”;
print “url=”.urlencode($_POST[‘url’]);
for ($i=0; $i<count($_POST[‘key’]); $i++) {
if ( $_POST[‘key’][$i] ) {
print “&”.urlencode($_POST[‘key’][$i]).”=”.urlencode(mcrypt_ecb(MCRYPT_3DES, mkey, $_POST[‘value’][$i], MCRYPT_ENCRYPT));
}
}
print “\n<br><br>\n”;
}
?>

To create a GET to POST Url to bookmark, use this form:<br>

<form method=”POST” action=”gettopost.php”>

URL: <input type=”text” name=”url” size=”40″ value=”<?=($_POST[‘url’] ? htmlspecialchars($_POST[‘url’]) : ‘https://’ )?>”><br>

<table>
<tr>
<td>Key</td><td>Value</td>
</tr>
<?php
for ($i=0; $i<12; $i++) {
print “<tr>\n”;
print ‘<td><input type=”text” name=”key[]” value=”‘.htmlspecialchars($_POST[‘key’][$i]).'”></td><td><input type=”text” name=”value[]” value=”‘.htmlspecialchars($_POST[‘value’][$i]).'” size=”30″></td>’.”\n”;
print “</tr>\n”;
}
?>
</table>

<input type=”submit” value=”Submit”>
</form>

</body>
</html>

Comments are closed.