mcrypt
| From: | Moises Zaragoza | Date: | Sat, 04 Feb 2006 02:16:19 +0000 |
| Subject: | mcrypt | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-30556@lists.php.net to get a copy of this message | ||
I'm using the snippet I wrote below to send some data from a child window to it's parent.
It all works fine except the data I'm sending back is encrypted using mcrypt, and so contains
some odd characters.
One or two of these characters are forcing line breaks, and so I am getting a javascript error of
unterminated string constant.
I thought add slashes would fix this but it doesn't, so I end up with odd characters on a line
of their own.
echo '<script language="javascript">' . "\r\n";
echo ' window.opener.document.getElementById("txtSSN").value =
"' . addslashes($encrypted_1) .'";' . "\r\n";
echo ' window.opener.document.getElementById("question").value =
"' . addslashes($encrypted_2) .'";' . "\r\n";
echo ' window.opener.document.getElementById("answer").value =
"' . addslashes($encrypted_3) .'";' . "\r\n";
echo '</script>' . "\r\n";
This is the output it produces:
PHP Code:
<script language="javascript">
window.opener.document.getElementById("txtSSN").value = "Q{æà¬/tø ";
window.opener.document.getElementById("question").value = "qAÅA5_<
ӣɳ¾";
window.opener.document.getElementById("answer").value = "Äü .K";
</script>
---------------------------------
Yahoo! Mail - Helps protect you from nasty viruses.