我的网站为每个要登录的帐户生成一个唯一密钥(密码)。它很重要,机密,不可恢复。那么如何让每个人都可以下载txt。
这段代码:
echo '<h2>';
print "Welcome $username to your dashboard<br>";
}
echo "</h2>";
echo "<p>";
$sec_value = 'usqi3289';
$rdecrypted_text = mcrypt_ecb(MCRYPT_DES, $sec_value, $userkey, MCRYPT_DECRYPT);
echo "<div class='button special'>Your Userkey: <font color='black'>$rdecrypted_text</font></div>";
?>
<br><p align="center">Please save your Userkey first,This is confidential and unrecoverable, because we don't hold any passwords. </p>
主要是这一个:
"<div class='button special'>Your Userkey: <font color='black'>$rdecrypted_text</font></div>"; ?>
我想要一个下面的按钮,以便人们点击它,然后下载包含此userkey
的txt文件。
答案 0 :(得分:1)
您可以将此代码放在PHP file
中,例如userkeydl.php
:
<?php
header("Content-type: text/plain");
header("Content-Disposition: attachment; filename = userkey.txt");
print "Your Userkey is: \n";
print $rdecrypted_text;
print "\nPlease note that this is confidential and unrecoverable.";
?>