Support Forums

Full Version: Simple GuestBook
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is my third project. Again for the sake of doing less work I uploaded it instead of pasting it.

Download:
http://www.mediafire.com/?yuntonjjnjz
Good job there man, that actually a simple script and I was amazed that it worked with only few lines.
Well done!

May I suggest you a change in your writting style.

Your script
PHP Code:
<?php
$message
=$_POST["message"];
$name=$_POST["fname"];
?>
<?php
$file
=fopen("mboard.txt","a");
fwrite($file,$name);
fwrite($file,": ");
fwrite($file,$message);
fwrite($file,"<br><br>");
fclose($file);
?>
<script type="text/javascript">
<!--
window.location = "http://nevets04.comoj.com/board.php"
//-->
</script> 

A bit better looking
PHP Code:
<?php
$message
=$_POST["message"];
$name=$_POST["fname"];

$file=fopen("mboard.txt","a");
fwrite($file,$name);
fwrite($file,": ");
fwrite($file,$message);
fwrite($file,"<br><br>");
fclose($file);

echo <<<HTML
<script type="text/javascript">
<!--
window.location = "http://nevets04.comoj.com/board.php"
//-->
</script>
HTML;

?>
Thanks, the only thing I'm worried about is once a lot of people post, loading time is going to really long.
Yeah that can become a real pain.
If you don't switch to MySql, you can create new file for every post and allow only limited amount of characters (255 - 500).
The you can limit the load by addin Pagination (it's pretty simple), and just load 5 posts per side...
If you also use more files and not just one, you can easy delete specified posts.

But I gone bit too far, are you planing to make this better or is it just a learning project?

(12-21-2009, 11:47 PM)Master of The Universe Wrote: [ -> ]Yeah that can become a real pain.
If you don't switch to MySql, you can create new file for every post and allow only limited amount of characters (255 - 500).
The you can limit the load by addin Pagination (it's pretty simple), and just load 5 posts per side...
If you also use more files and not just one, you can easy delete specified posts.

But I gone bit too far, are you planing to make this better or is it just a learning project?


More just a learning project, but I still appreciate the help if I ever need to use this (which I probably will)
Nice script Smile !

But, be careful !
When you display the messages, don't forget htmlentities !
You will be victim of XSS if you don't use that.

PS : You can concatenate string and variables like this, if you want :
PHP Code:
fwrite($file$name ": " $message "<br><br>"); 
(12-22-2009, 07:57 AM)Spl3en Wrote: [ -> ]Nice script Smile !

But, be careful !
When you display the messages, don't forget htmlentities !
You will be victim of XSS if you don't use that.

PS : You can concatenate string and variables like this, if you want :
PHP Code:
fwrite($file$name ": " $message "<br><br>"); 

Thanks, I was looking for ways to fix xss exploits
Nice Nevets.