|
|
|
|
![]() ![]() |
Feb 20 2005, 03:26 PM
Post
#1
|
|
|
Sheathed Motivation ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 126 Joined: 19-February 05 From: Canada Member No.: 3,868 |
Okay, this is a simple script that lets your visitors enter in messages via a chatbox/guestbook. You can use this how you like. Adjust it if need be. It's very
simple, so there is much room for improvement. Enjoy! CODE echo "<form action='chatbox.php' method='get'>"; echo "Name: <input type='text' name='visName' size=15><br>"; echo "Message: <input type='text' name='message' size = 15><br>"; echo "<input type='submit' value='Post' name='post'><br>"; echo "</form>"; CHATBOX.PHP if(isset($post)) { if(file_exists('chatbox.txt')) { $fileId = fopen('chatbox.txt', 'a'); fputs($fileId, $_POST['visName']); fputs($fileId, $_POST['message']); fclose($fileId); } else { $fileId = fopen('chatbox.txt', 'w'); fputs($fileId, $_POST['visName']); fputs($fileId, $_POST['message']); fclose($fileId); } } $fileId = fopen('chatbox.txt', 'r'); while(!feof($fileId)) { $text = fgets($fileId); echo "<table>"; echo "<tr><td>".$text."</td></tr>"; echo "</table>"; } fclose($fileId); If there are any errors in this code whatsoever, please reply here and point them out so that I can fix them. I have used this code many times, so I'm hoping that it's flawless. |
|
|
|
Feb 20 2005, 03:40 PM
Post
#2
|
|
|
Newbie ![]() Group: Members Posts: 9 Joined: 20-February 05 Member No.: 3,870 |
QUOTE(Inspired @ Feb 20 2005, 07:26 AM) Okay, this is a simple script that lets your visitors enter in messages via a chatbox/guestbook. You can use this how you like. Adjust it if need be. It's very simple, so there is much room for improvement. Enjoy! CODE echo "<form action='chatbox.php' method='get'>"; echo "Name: <input type='text' name='visName' size=15><br>"; echo "Message: <input type='text' name='message' size = 15><br>"; echo "<input type='submit' value='Post' name='post'><br>"; echo "</form>"; CHATBOX.PHP if(isset($post)) { if(file_exists('chatbox.txt')) { $fileId = fopen('chatbox.txt', 'a'); fputs($fileId, $_POST['visName']); fputs($fileId, $_POST['message']); fclose($fileId); } else { $fileId = fopen('chatbox.txt', 'w'); fputs($fileId, $_POST['visName']); fputs($fileId, $_POST['message']); fclose($fileId); } } $fileId = fopen('chatbox.txt', 'r'); while(!feof($fileId)) { $text = fgets($fileId); echo "<table>"; echo "<tr><td>".$text."</td></tr>"; echo "</table>"; } fclose($fileId); If there are any errors in this code whatsoever, please reply here and point them out so that I can fix them. I have used this code many times, so I'm hoping that it's flawless. Isnt this html code?Do you need copyright permition? |
|
|
|
Feb 20 2005, 03:59 PM
Post
#3
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 144 Joined: 19-February 05 From: Nakorn Chaisri, Thailand Member No.: 3,864 |
Absolutely not. That code is in pure PHP - and if the code is written by Inspired, he's opened it up for public use as soon as he posted it in this forum. No copyrights have been mentioned anywhere - so it's free for public domain use...
|
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 8th September 2008 - 09:32 AM |