10 $filename="wishlist.txt";
12 // be sure the file have write permissions
13 $url="http://tinc-vpn.org/wishlist/";
17 function get_content(){
19 $lines = file ($filename);
20 $start = count($lines)-12;
21 if ($start < 1) $start = 1;
22 for ($i = $start; $i < count ($lines); $i++){
23 $somecontent.=stripslashes($lines[$i]);
28 function add_content(){
30 if($_POST[submit] and $_POST[nick] and $_POST[content]){
33 $_SESSION["nick"]=$_POST[nick];
34 $somecontent=strip_tags($_POST[nick]).": ".strip_tags($_POST[content])."<br/>n";
35 $handle = fopen($filename, 'a+');
36 fwrite($handle, $somecontent);
40 function output_form(){
43 <form action="" method="post">
46 echo $_SESSION[nick].'<input type="hidden" name="nick" value="'.$_SESSION[nick].'"><br>';
49 echo '<br><input name="nick" type="text" value="'.$_SESSION[nick].'"><br>';
52 Your Wish/Idea for the tinc Project:<br>
53 <textarea rows="5" cols="100" name="content"></textarea><br>
54 <input type="submit" name="submit" value="save">
60 if($_GET[content]=="true"){
67 <title>shoutbox demo</title>
68 <script type="text/javascript" language="javascript">
70 var http_request = false;
72 function macheRequest(url) {
76 if (window.XMLHttpRequest) { // Mozilla, Safari,...
77 http_request = new XMLHttpRequest();
78 if (http_request.overrideMimeType) {
79 http_request.overrideMimeType('text/xml');
80 // zu dieser Zeile siehe weiter unten
82 } else if (window.ActiveXObject) { // IE
84 http_request = new ActiveXObject("Msxml2.XMLHTTP");
87 http_request = new ActiveXObject("Microsoft.XMLHTTP");
93 alert('Ende :( Kann keine XMLHTTP-Instanz erzeugen');
96 http_request.onreadystatechange = alertInhalt;
97 http_request.open('GET', url, true);
98 http_request.send(null);
102 function alertInhalt() {
104 if (http_request.readyState == 4) {
105 if (http_request.status == 200) {
106 document.getElementById("shoutbox").innerHTML=http_request.responseText;
107 var objDiv = document.getElementById("shoutbox");
108 objDiv.scrollTop = objDiv.scrollHeight;
109 setTimeout('macheRequest("<?php echo $url; ?>?content=true")',2000);
112 alert('Bei dem Request ist ein Problem aufgetreten.');
119 <body onload="macheRequest('<?php echo $url; ?>?content=true');">
121 <h2>Drop your Ideas into this Box</h2>
122 <h4>(The Idea will stay for a while and will check form the dev. Team)</h4>
124 <?php add_content(); ?>
125 <div style="border:1px solid #ccc; width:500px; height:300px; max-height:300px; overflow:auto;" name="shoutbox" id="shoutbox"></div>
126 <?php output_form(); ?>