(no commit message)
[wiki] / wishlist.mdwn
1 <?php
2 # Shoutbox 1.0
3 # by Andreas Beder
4 # codejungle.org
5 # mod for tinc wiki
6 # by wopot
7 # Licence GNU GPL 2
8 # http://www.codejungle.org/site/Shoutbox+mit+PHP+und+Ajax.html
9
10 //config
11 $filename="wishlist.txt";
12
13 // be sure the file have write permissions
14 $url="http://tinc-vpn.org/wishlist/";
15
16 //function 
17
18 function get_content(){
19 global $filename;
20       $lines = file ($filename);
21       $start = count($lines)-12;
22       if ($start < 1) $start = 1;
23       for ($i = $start; $i < count ($lines); $i++){
24       $somecontent.=stripslashes($lines[$i]);
25       }
26 return $somecontent;
27 }
28
29 function add_content(){
30 global $filename;
31 if($_POST[submit] and $_POST[nick] and $_POST[content]){
32 //check content
33 //add content
34  $_SESSION["nick"]=$_POST[nick];
35  $somecontent=strip_tags($_POST[nick]).": ".strip_tags($_POST[content])."<br/>n";
36  $handle = fopen($filename, 'a+');
37  fwrite($handle, $somecontent);
38 }
39 }
40
41 function output_form(){
42
43 echo '
44 <form action="" method="post">
45 Name:';
46 if($_SESSION[nick]){
47         echo $_SESSION[nick].'<input type="hidden" name="nick" value="'.$_SESSION[nick].'"><br>';
48 }
49 else { 
50         echo '<br><input name="nick" type="text" value="'.$_SESSION[nick].'"><br>'; 
51 }
52 echo'
53 Your Wish/Idea for the tinc Project:<br>
54 <textarea rows="5" cols="100" name="content"></textarea><br>
55 <input type="submit" name="submit" value="save">
56 </form>
57 ';
58
59 }
60
61 if($_GET[content]=="true"){
62 echo get_content();
63 die();
64 }
65 ?>
66
67 #Wislist
68 ##Drop your Ideas into this Box
69 ####(The Idea will stay for a while and will check form the dev. Team)
70 <br />
71 <?php add_content(); ?>
72 <div style="border:1px solid #ccc; width:500px; height:300px; max-height:300px; overflow:auto;" name="shoutbox" id="shoutbox"></div>
73 <?php output_form(); ?>