SubscribeOne key issue with this is the case where users have more than one browser window open at once. In some instances, a script from one page should be allowed to access data from another page or object, but in others, this should be strictly forbidden, as a malicious website could attempt to steal sensitive information this way. For this reason, the same-origin policy was introduced. Essentially this policy allows any interaction between objects and pages, so long as these objects come from the same domain and over the same protocol. That way, a malicious website wouldn't be able to access sensitive data in another browser window via JavaScript.
<?php
if (isset($_POST['text']))
{
file_put_contents('variable.txt', $_POST['text']);
}
$text = (file_exists('variable.txt'))
? htmlentities(file_get_contents('variable.txt')) # Remove the htmlentities() to allow HTML, else it will change carats to < and >
: ';
?>
<html>
<head><title /></head>
<body>
<div id="prevtext"><?php echo $text; ?></div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<textarea name="text"></textarea>
<input type="submit" />
</form>
</body>
</html>You are not logged in, either login or create an account to post comments
posted by gramcracker at 3:17 PM on June 4, 2006