We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
need two codes; guestbook and poll
Topic Started: Feb 1 2007, 09:47 AM (788 Views)
Black Shadow
Join the Dark Side...We have cookies :)
[ *  *  *  * ]
Ok i need two flatfile (no mysql ) codes, a guestbook which must have that anti-spam thing where you must tipe a specific word in order to post your message and a simple poll.I await suggestions, thx ^_^
Offline Profile Quote Post Goto Top
 
jarocks
Member Avatar
Gods don't need a title.
[ *  *  * ]
Xml would be the best way to store the data if your not using sql
Offline Profile Quote Post Goto Top
 
IceMetalPunk
Member Avatar
We are all IMPerfect. Be proud!
[ *  *  *  *  *  * ]
For the guestbook:

To add to the guestbook:
Quote:
 
<?php
if (!$_POST['secword'] || $_POST['secword']!="SECRET_WORD") {
exit("Sorry, the secret word you entered was incorrect.");
}
if (!$_POST['txt'] || $_POST['txt']=="") {
exit("You did not enter a message to post.");
}
if (!$_POST['myname']) { $_POST['myname']="<i>Anonymous</i>"; }
else { $_POST['myname']="<b>".$_POST['myname']."</b>"; }
$f=fopen("guestbook.html","a");
fwrite($f,"<div style='width:100%; background-color:#aaaaaa'>".$_POST['myname']." ".date("F d, Y \a\t g:i:s A")."</div><div style='width:100%; background-color:#ffffff'>".$_POST['txt']."</div>");
fclose($f);
echo "Successfully added your comment to the guestbook.";
?>


The form to fill out must have a few fields:

secword is the textbox where the user needs to enter the secret word to post.

myname is the textbox where the user enters the name (s)he wants displayed for this post. If it's not supplied, it'll be set to Anonymous.

txt is the textarea where the user will enter his/her message.

To display the guestbook within another page:

Quote:
 
<?php
echo file_get_contents("guestbook.html");
?>


-IMP ;) :)
Offline Profile Quote Post Goto Top
 
Black Shadow
Join the Dark Side...We have cookies :)
[ *  *  *  * ]
i don't see where the posts are stored ?

tested on localhost and this is what i get...there wasn't any options to post just the error
Quote:
 

Notice: Undefined index: secword in c:\localhost\guest.php on line 2
Sorry, the secret word you entered was incorrect.

But the first part ain't because of the code i get that all the time dunno why :ph34r:
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Technology Chat · Next Topic »
Add Reply