6Fermer8
SpipuLe 09/06/2008 à 10:56
j'ai voulu essayer sur mon serveur, au cas ou, ca puisse dépendre de ta config, meme résultat : http://dev.spipu.net/ajax/

<?php
$file = './out.txt';

if (isset($_POST['text']))
{
	$f = fopen($file, 'w');
	fwrite ($f, substr($_POST['text'], 0, 255));
	fclose ($f);
	header('location: ./');
	exit;
}
$contenu = (is_file($file) ? file_get_contents($file) : '');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="application/xhtml+xml;charset=UTF-8" />
		<script src="http://www.mirari.fr/template/pearl/inc/ajax.js" type="text/javascript"></script>
		<title>Test</title>
	</head>
	<body>
		<form action="" method="post">
			<input id="text" name="text" type="text"  maxlength="255" value="" />
			 - <input type="submit" value="Form Send"/>
			 - <input onclick="XMLHttp.request('./index.php', {text : document.getElementById ('text').value}, {});" type="button" value="Ajax Send" />
			 - <input onclick="window.location.href='./';" type="button" value="Recharger la page" />
		</form>
		
		contenu du fichier <a href="<?php echo $file; ?>" target="_blank"><?php echo $file; ?></a> :<br />
		<div style="border: solid 1px #000000; color: #222222; background: #EEEEEE; width: 200px; height: 200px; overflow: scroll"><pre><?php echo $contenu; ?></pre></div>
	</body>
</html>